[PATCH net-next] net/rds: Add missing include file

2019-10-06 Thread YueHaibing
Fix build error:

net/rds/ib_cm.c: In function rds_dma_hdrs_alloc:
net/rds/ib_cm.c:475:13: error: implicit declaration of function 
dma_pool_zalloc; did you mean mempool_alloc? 
[-Werror=implicit-function-declaration]
   hdrs[i] = dma_pool_zalloc(pool, GFP_KERNEL, &hdr_daddrs[i]);
 ^~~
 mempool_alloc

net/rds/ib.c: In function rds_ib_dev_free:
net/rds/ib.c:111:3: error: implicit declaration of function dma_pool_destroy; 
did you mean mempool_destroy? [-Werror=implicit-function-declaration]
   dma_pool_destroy(rds_ibdev->rid_hdrs_pool);
   ^~~~
   mempool_destroy

Reported-by: Hulk Robot 
Fixes: 9b17f5884be4 ("net/rds: Use DMA memory pool allocation for rds_header")
Signed-off-by: YueHaibing 
---
 net/rds/ib.c| 1 +
 net/rds/ib_cm.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/net/rds/ib.c b/net/rds/ib.c
index 23a2ae53f231..62d4ebeb08c1 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -30,6 +30,7 @@
  * SOFTWARE.
  *
  */
+#include 
 #include 
 #include 
 #include 
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index d08251f4a00c..6b345c858dba 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -30,6 +30,7 @@
  * SOFTWARE.
  *
  */
+#include 
 #include 
 #include 
 #include 
-- 
2.20.1




Re: [PATCH 1/2] arm64: dts: imx8mn: Add system counter node

2019-10-06 Thread Shawn Guo
On Tue, Sep 10, 2019 at 11:25:17AM -0400, Anson Huang wrote:
> Add i.MX8MN system counter node to enable timer-imx-sysctr
> broadcast timer driver.
> 
> Signed-off-by: Anson Huang 

Applied both, thanks.


[PATCH -next] ASoc: tas2770: Fix build error without GPIOLIB

2019-10-06 Thread YueHaibing
If GPIOLIB is not set, building fails:

sound/soc/codecs/tas2770.c: In function tas2770_reset:
sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function 
gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? 
[-Werror=implicit-function-declaration]
   gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
   ^~~~
   gpio_set_value_cansleep
sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function 
devm_gpiod_get_optional; did you mean devm_regulator_get_optional? 
[-Werror=implicit-function-declaration]
  tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
^~~
devm_regulator_get_optional
sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use 
in this function); did you mean GPIOF_INIT_HIGH?
 GPIOD_OUT_HIGH);
 ^~
 GPIOF_INIT_HIGH

Reported-by: Hulk Robot 
Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: YueHaibing 
---
 sound/soc/codecs/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index bcac957..d639f17 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -1108,6 +1108,7 @@ config SND_SOC_TAS2552
 config SND_SOC_TAS2770
tristate "Texas Instruments TAS2770 speaker amplifier"
depends on I2C
+   select GPIOLIB
 
 config SND_SOC_TAS5086
tristate "Texas Instruments TAS5086 speaker amplifier"
-- 
2.7.4




[PATCH -next] media: cx231xx: remove duplicated include from cx231xx-417.c

2019-10-06 Thread YueHaibing
Remove duplicated include.

Signed-off-by: YueHaibing 
---
 drivers/media/usb/cx231xx/cx231xx-417.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index 46d0215deee6..1aec4459f50a 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 





Re: [PATCH 1/2] arm64: dts: imx8mm: Remove incorrect fallback compatible for ocotp

2019-10-06 Thread Shawn Guo
On Wed, Sep 11, 2019 at 10:24:46AM -0400, Anson Huang wrote:
> Compared to i.MX7D, i.MX8MM has different ocotp layout, so it should
> NOT use "fsl,imx7d-ocotp" as ocotp's fallback compatible, remove it.
> 
> Signed-off-by: Anson Huang 

Applied both, thanks.


Re: [PATCH v4 1/4] x86/kvm: Add "nopvspin" parameter to disable PV spinlocks

2019-10-06 Thread Zhenzhong Duan

On 2019/10/4 22:52, Boris Ostrovsky wrote:


On 10/3/19 10:02 AM, Zhenzhong Duan wrote:

  void __init kvm_spinlock_init(void)
  {
-   /* Does host kernel support KVM_FEATURE_PV_UNHALT? */
-   if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
-   return;
-
-   if (kvm_para_has_hint(KVM_HINTS_REALTIME))
+   /*
+* Don't use the pvqspinlock code if no KVM_FEATURE_PV_UNHALT feature
+* support, or there is REALTIME hints or only 1 vCPU.
+*/
+   if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT) ||
+   kvm_para_has_hint(KVM_HINTS_REALTIME) ||
+   num_possible_cpus() == 1) {
+   pr_info("PV spinlocks disabled\n");
return;
+   }
  
-	/* Don't use the pvqspinlock code if there is only 1 vCPU. */

-   if (num_possible_cpus() == 1)
+   if (nopvspin) {
+   pr_info("PV spinlocks disabled forced by \"nopvspin\" 
parameter.\n");
+   static_branch_disable(&virt_spin_lock_key);

Would it make sense to bring here the other site where the key is
disabled (in kvm_smp_prepare_cpus())?


Thanks for point out, I'll do it. Just not clear if I should do that in a 
separate patch,
there is a history about that code:

Its original place was here and then moved to kvm_smp_prepare_cpus() by below 
commit:
34226b6b ("KVM: X86: Fix setup the virt_spin_lock_key before static key get 
initialized")
which fixed jump_label_init() calling late issue.

Then 8990cac6 ("x86/jump_label: Initialize static branching early") move 
jump_label_init()
early, so commit 34226b6b could be reverted.



(and, in fact, shouldn't all of the checks that result in early return
above disable the key?)


I think we should enable he key for 
!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT) case,
there is lock holder preemption issue as qspinlock is fair lock, 
virt_spin_lock()
is an optimization to that, imaging one pcpu running 10 vcpus of same guest
contending a same lock.

For kvm_para_has_hint(KVM_HINTS_REALTIME) case, hypervisor hints there is
no preemption and we should disable virt_spin_lock_key to use native qspinlock.

For the UP case, we don't care virt_spin_lock_key value.

For nopvspin case, we intentionally check native qspinlock code performance,
compare it with PV qspinlock, etc. So virt_spin_lock() optimization should be 
disabled.

Let me know if anything wrong with above understanding. Thanks

Zhenzhong



Re: [PATCH v4 3/4] xen: Mark "xen_nopvspin" parameter obsolete

2019-10-06 Thread Zhenzhong Duan



On 2019/10/4 22:57, Boris Ostrovsky wrote:

On 10/3/19 10:02 AM, Zhenzhong Duan wrote:

Map "xen_nopvspin" to "nopvspin", fix stale description of "xen_nopvspin"
as we use qspinlock now.

Signed-off-by: Zhenzhong Duan 
Cc: Jonathan Corbet 
Cc: Boris Ostrovsky 
Cc: Juergen Gross 
Cc: Stefano Stabellini 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Borislav Petkov 
Cc: "H. Peter Anvin" 

Reviewed-by: Boris Ostrovsky 

with a small nit


  void __init xen_init_spinlocks(void)
  {
+   if (nopvspin)
+   xen_pvspin = false;
  
  	/*  Don't need to use pvqspinlock code if there is only 1 vCPU. */

if (num_possible_cpus() == 1)

I'd fold the change into this 'if' statement, I think it will still be
clear what the comment refers to.


Good suggestion, will do that. Thanks

Zhenzhong



Re: [PATCH 1/2] ARM: dts: imx7d: Correct speed grading fuse settings

2019-10-06 Thread Shawn Guo
On Thu, Sep 12, 2019 at 10:56:31AM +0800, Anson Huang wrote:
> The 800MHz opp speed grading fuse mask should be 0xd instead
> of 0xf according to fuse map definition:
> 
> SPEED_GRADING[1:0]MHz
>   00  800
>   01  500
>   10  1000
>   11  1200
> 
> Signed-off-by: Anson Huang 

Applied both, thanks.


Re: [PATCH v5 01/10] mm/memunmap: Use the correct start and end pfn when removing pages from zone

2019-10-06 Thread David Hildenbrand
On 05.10.19 08:13, Aneesh Kumar K.V wrote:
> On 10/4/19 2:33 PM, David Hildenbrand wrote:
>> On 04.10.19 11:00, David Hildenbrand wrote:
>>> On 03.10.19 18:48, Aneesh Kumar K.V wrote:
 On 10/1/19 8:33 PM, David Hildenbrand wrote:
> On 01.10.19 16:57, David Hildenbrand wrote:
>> On 01.10.19 16:40, David Hildenbrand wrote:
>>> From: "Aneesh Kumar K.V" 
>>>
>>> With altmap, all the resource pfns are not initialized. While 
>>> initializing
>>> pfn, altmap reserve space is skipped. Hence when removing pfn from zone
>>> skip pfns that were never initialized.
>>>
>>> Update memunmap_pages to calculate start and end pfn based on altmap
>>> values. This fixes a kernel crash that is observed when destroying
>>> a namespace.
>>>
>>> [   81.356173] kernel BUG at include/linux/mm.h:1107!
>>> cpu 0x1: Vector: 700 (Program Check) at [c00274087890]
>>>   pc: c04b9728: memunmap_pages+0x238/0x340
>>>   lr: c04b9724: memunmap_pages+0x234/0x340
>>> ...
>>>   pid   = 3669, comm = ndctl
>>> kernel BUG at include/linux/mm.h:1107!
>>> [c00274087ba0] c09e3500 devm_action_release+0x30/0x50
>>> [c00274087bc0] c09e4758 release_nodes+0x268/0x2d0
>>> [c00274087c30] c09dd144 
>>> device_release_driver_internal+0x174/0x240
>>> [c00274087c70] c09d9dfc unbind_store+0x13c/0x190
>>> [c00274087cb0] c09d8a24 drv_attr_store+0x44/0x60
>>> [c00274087cd0] c05a7470 sysfs_kf_write+0x70/0xa0
>>> [c00274087d10] c05a5cac kernfs_fop_write+0x1ac/0x290
>>> [c00274087d60] c04be45c __vfs_write+0x3c/0x70
>>> [c00274087d80] c04c26e4 vfs_write+0xe4/0x200
>>> [c00274087dd0] c04c2a6c ksys_write+0x7c/0x140
>>> [c00274087e20] c000bbd0 system_call+0x5c/0x68
>>>
>>> Cc: Dan Williams 
>>> Cc: Andrew Morton 
>>> Cc: Jason Gunthorpe 
>>> Cc: Logan Gunthorpe 
>>> Cc: Ira Weiny 
>>> Reviewed-by: Pankaj Gupta 
>>> Signed-off-by: Aneesh Kumar K.V 
>>> [ move all pfn-realted declarations into a single line ]
>>> Signed-off-by: David Hildenbrand 
>>> ---
>>>mm/memremap.c | 13 -
>>>1 file changed, 8 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/mm/memremap.c b/mm/memremap.c
>>> index 557e53c6fb46..026788b2ac69 100644
>>> --- a/mm/memremap.c
>>> +++ b/mm/memremap.c
>>> @@ -123,7 +123,7 @@ static void dev_pagemap_cleanup(struct dev_pagemap 
>>> *pgmap)
>>>void memunmap_pages(struct dev_pagemap *pgmap)
>>>{
>>> struct resource *res = &pgmap->res;
>>> -   unsigned long pfn;
>>> +   unsigned long pfn, nr_pages, start_pfn, end_pfn;
>>> int nid;
>>>
>>> dev_pagemap_kill(pgmap);
>>> @@ -131,14 +131,17 @@ void memunmap_pages(struct dev_pagemap *pgmap)
>>> put_page(pfn_to_page(pfn));
>>> dev_pagemap_cleanup(pgmap);
>>>
>>> +   start_pfn = pfn_first(pgmap);
>>> +   end_pfn = pfn_end(pgmap);
>>> +   nr_pages = end_pfn - start_pfn;
>>> +
>>> /* pages are dead and unused, undo the arch mapping */
>>> -   nid = page_to_nid(pfn_to_page(PHYS_PFN(res->start)));
>>> +   nid = page_to_nid(pfn_to_page(start_pfn));
>>>
>>> mem_hotplug_begin();
>>> if (pgmap->type == MEMORY_DEVICE_PRIVATE) {
>>> -   pfn = PHYS_PFN(res->start);
>>> -   __remove_pages(page_zone(pfn_to_page(pfn)), pfn,
>>> -PHYS_PFN(resource_size(res)), NULL);
>>> +   __remove_pages(page_zone(pfn_to_page(start_pfn)), 
>>> start_pfn,
>>> +  nr_pages, NULL);
>>> } else {
>>> arch_remove_memory(nid, res->start, resource_size(res),
>>> pgmap_altmap(pgmap));
>>>
>>
>> Aneesh, I was wondering why the use of "res->start" is correct (and we
>> shouldn't also witch to start_pfn/nr_pages here. It would be good if Dan
>> could review.
>>
>
> To be more precise, I wonder if it should actually be
>
> __remove_pages(page_zone(pfn_to_page(start_pfn)), res->start,
>  resource_size(res))
>

 yes, that would be make it much clear.

 But for MEMORY_DEVICE_PRIVATE start_pfn and pfn should be same?
>>>
>>> Okay, let's recap. We should call add_pages()/__remove_pages()
>>> and arch_add_memory()/arch_remove_memory() with the exact same ranges.
>>>
>>> So with PHYS_PFN(res->start) and PHYS_PFN(resource_size(res)
>>>
>>> Now, only a subset of the pages gets actually initialized,
>>> meaning the NID and the ZONE we read could be stale.
>>> That, we have to fix.
>>>
>>> What about something like this

Re: [PATCH] rsi: fix potential null dereference in rsi_probe()

2019-10-06 Thread Kalle Valo
Johan Hovold  writes:

> On Fri, Oct 04, 2019 at 01:47:36PM +, Kalle Valo wrote:
>> Denis Efremov  wrote:
>> 
>> > The id pointer can be NULL in rsi_probe().
>
> While the existing code in rsi_probe() may lead you to believe that,
> this statement is false. 
>
>> > It is checked everywhere except
>> > for the else branch in the idProduct condition. The patch adds NULL check
>> > before the id dereference in the rsi_dbg() call.
>> > 
>> > Fixes: 54fdb318c111 ("rsi: add new device model for 9116")
>> > Cc: Amitkumar Karwar 
>> > Cc: Siva Rebbagondla 
>> > Cc: Kalle Valo 
>> > Signed-off-by: Denis Efremov 
>> 
>> Patch applied to wireless-drivers-next.git, thanks.
>> 
>> f170d44bc4ec rsi: fix potential null dereference in rsi_probe()
>
> I just sent a revert to prevent the confusion from spreading (e.g. to
> stable autosel and contributers looking for things to work on). Hope you
> don't mind, Kalle.

That's great, thanks Johan.

-- 
Kalle Valo


Re: [PATCH 1/2] Revert "rsi: fix potential null dereference in rsi_probe()"

2019-10-06 Thread Kalle Valo
Johan Hovold  writes:

> This reverts commit f170d44bc4ec2feae5f6206980e7ae7fbf0432a0.
>
> USB core will never call a USB-driver probe function with a NULL
> device-id pointer.
>
> Reverting before removing the existing checks in order to document this
> and prevent the offending commit from being "autoselected" for stable.
>
> Signed-off-by: Johan Hovold 

I'll queue these two to v5.4.

-- 
Kalle Valo


Re: [PATCH] ARM: dts: imx6: Extend support for Phytec phycore i.MX6ULL SoM

2019-10-06 Thread Shawn Guo
On Thu, Sep 12, 2019 at 10:29:28PM +0200, Parthiban Nallathambi wrote:
> Extend Phycore i.MX6UL SoM for i.MX6ULL with on board eMMC. Phycore
> i.MX6ULL is deployed with same carrier board Segin as the pins are
> compatible with UL version.
> 
> Signed-off-by: Parthiban Nallathambi 

What is the base that the patch was generated from?  It doesn't apply to
my tree.

Shawn

> ---
>  arch/arm/boot/dts/imx6ul-phytec-pcl063.dtsi   | 26 +--
>  .../dts/imx6ul-phytec-phyboard-segin-full.dts |  5 
>  arch/arm/boot/dts/imx6ull-phytec-pcl063.dtsi  | 24 +
>  3 files changed, 53 insertions(+), 2 deletions(-)
>  create mode 100644 arch/arm/boot/dts/imx6ull-phytec-pcl063.dtsi
> 
> diff --git a/arch/arm/boot/dts/imx6ul-phytec-pcl063.dtsi 
> b/arch/arm/boot/dts/imx6ul-phytec-pcl063.dtsi
> index fc2997449b49..822a178ce438 100644
> --- a/arch/arm/boot/dts/imx6ul-phytec-pcl063.dtsi
> +++ b/arch/arm/boot/dts/imx6ul-phytec-pcl063.dtsi
> @@ -7,7 +7,6 @@
>  #include 
>  #include 
>  #include 
> -#include "imx6ul.dtsi"
>  
>  / {
>   model = "Phytec phyCORE i.MX6 UltraLite";
> @@ -65,7 +64,7 @@
>   pinctrl-names = "default";
>   pinctrl-0 = <&pinctrl_gpmi_nand>;
>   nand-on-flash-bbt;
> - status = "okay";
> + status = "disabled";
>  };
>  
>  &i2c1 {
> @@ -90,6 +89,15 @@
>   status = "okay";
>  };
>  
> +&usdhc2 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_usdhc2>;
> + bus-width = <8>;
> + no-1-8-v;
> + non-removable;
> + status = "disabled";
> +};
> +
>  &iomuxc {
>   pinctrl_enet1: enet1grp {
>   fsl,pins = <
> @@ -145,4 +153,18 @@
>   >;
>   };
>  
> + pinctrl_usdhc2: usdhc2grp {
> + fsl,pins = <
> + MX6UL_PAD_NAND_WE_B__USDHC2_CMD 0x170f9
> + MX6UL_PAD_NAND_RE_B__USDHC2_CLK 0x100f9
> + MX6UL_PAD_NAND_DATA00__USDHC2_DATA0 0x170f9
> + MX6UL_PAD_NAND_DATA01__USDHC2_DATA1 0x170f9
> + MX6UL_PAD_NAND_DATA02__USDHC2_DATA2 0x170f9
> + MX6UL_PAD_NAND_DATA03__USDHC2_DATA3 0x170f9
> + MX6UL_PAD_NAND_DATA04__USDHC2_DATA4 0x170f9
> + MX6UL_PAD_NAND_DATA05__USDHC2_DATA5 0x170f9
> + MX6UL_PAD_NAND_DATA06__USDHC2_DATA6 0x170f9
> + MX6UL_PAD_NAND_DATA07__USDHC2_DATA7 0x170f9
> + >;
> + };
>  };
> diff --git a/arch/arm/boot/dts/imx6ul-phytec-phyboard-segin-full.dts 
> b/arch/arm/boot/dts/imx6ul-phytec-phyboard-segin-full.dts
> index b6a1407a9d44..76f2447f2657 100644
> --- a/arch/arm/boot/dts/imx6ul-phytec-phyboard-segin-full.dts
> +++ b/arch/arm/boot/dts/imx6ul-phytec-phyboard-segin-full.dts
> @@ -5,6 +5,7 @@
>   */
>  
>  /dts-v1/;
> +#include "imx6ul.dtsi"
>  #include "imx6ul-phytec-pcl063.dtsi"
>  #include "imx6ul-phytec-phyboard-segin.dtsi"
>  #include "imx6ul-phytec-peb-eval-01.dtsi"
> @@ -37,6 +38,10 @@
>   status = "okay";
>  };
>  
> +&gpmi {
> + status = "okay";
> +};
> +
>  &i2c_rtc {
>   status = "okay";
>  };
> diff --git a/arch/arm/boot/dts/imx6ull-phytec-pcl063.dtsi 
> b/arch/arm/boot/dts/imx6ull-phytec-pcl063.dtsi
> new file mode 100644
> index ..3f749d9f09a5
> --- /dev/null
> +++ b/arch/arm/boot/dts/imx6ull-phytec-pcl063.dtsi
> @@ -0,0 +1,24 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (C) 2018 PHYTEC Messtechnik GmbH
> + * Author: Stefan Riedmueller 
> + */
> +
> +#include "imx6ul-phytec-pcl063.dtsi"
> +
> +/ {
> + model = "PHYTEC phyCORE-i.MX 6ULL";
> + compatible = "phytec,imx6ull-pcl063", "fsl,imx6ull";
> +};
> +
> +&iomuxc {
> + /delete-node/ gpioledssomgrp;
> +};
> +
> +&iomuxc_snvs {
> + pinctrl_gpioleds_som: gpioledssomgrp {
> + fsl,pins = <
> + MX6ULL_PAD_SNVS_TAMPER4__GPIO5_IO04 0x0b0b0
> + >;
> + };
> +};
> -- 
> 2.21.0
> 


Re: [PATCH] ARM: dts: imx7s: Correct GPT's ipg clock source

2019-10-06 Thread Shawn Guo
On Mon, Sep 16, 2019 at 04:29:09PM +0800, Anson Huang wrote:
> i.MX7S/D's GPT ipg clock should be from GPT clock root and
> controlled by CCM's GPT CCGR, using correct clock source for
> GPT ipg clock instead of IMX7D_CLK_DUMMY.

So both 'ipg' and 'per' clock are coming from GPT root clock?

> Signed-off-by: Anson Huang 

It looks like a fix, so do we need a Fixes tag here?

Shawn

> ---
>  arch/arm/boot/dts/imx7s.dtsi | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
> index 710f850..e2e604d 100644
> --- a/arch/arm/boot/dts/imx7s.dtsi
> +++ b/arch/arm/boot/dts/imx7s.dtsi
> @@ -448,7 +448,7 @@
>   compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
>   reg = <0x302d 0x1>;
>   interrupts = ;
> - clocks = <&clks IMX7D_CLK_DUMMY>,
> + clocks = <&clks IMX7D_GPT1_ROOT_CLK>,
><&clks IMX7D_GPT1_ROOT_CLK>;
>   clock-names = "ipg", "per";
>   };
> @@ -457,7 +457,7 @@
>   compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
>   reg = <0x302e 0x1>;
>   interrupts = ;
> - clocks = <&clks IMX7D_CLK_DUMMY>,
> + clocks = <&clks IMX7D_GPT2_ROOT_CLK>,
><&clks IMX7D_GPT2_ROOT_CLK>;
>   clock-names = "ipg", "per";
>   status = "disabled";
> @@ -467,7 +467,7 @@
>   compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
>   reg = <0x302f 0x1>;
>   interrupts = ;
> - clocks = <&clks IMX7D_CLK_DUMMY>,
> + clocks = <&clks IMX7D_GPT3_ROOT_CLK>,
><&clks IMX7D_GPT3_ROOT_CLK>;
>   clock-names = "ipg", "per";
>   status = "disabled";
> @@ -477,7 +477,7 @@
>   compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
>   reg = <0x3030 0x1>;
>   interrupts = ;
> - clocks = <&clks IMX7D_CLK_DUMMY>,
> + clocks = <&clks IMX7D_GPT4_ROOT_CLK>,
><&clks IMX7D_GPT4_ROOT_CLK>;
>   clock-names = "ipg", "per";
>   status = "disabled";
> -- 
> 2.7.4
> 


Re: [PATCH 1/1] iio: (bma400) add driver for the BMA400

2019-10-06 Thread Jonathan Cameron
On Wed, 25 Sep 2019 01:39:41 +
Dan Robertson  wrote:

> Add a IIO driver for the Bosch BMA400 3-axes ultra-low power accelerometer.
> The driver supports reading from the acceleration and temperature
> registers. The driver also supports reading and configuring the output data
> rate, oversampling ratio, and scale.
> 
> Signed-off-by: Dan Robertson 
Hi Dan,

So my first thought was that Bosch have been moderately good at keeping their
interfaces consistent across generations.   Seems not this time from
a quick look!

Minor stuff inline.  Quite a bit of it is stylistic rather than functional.
I'm a lazy maintainer and tend to end up reading a lot of code so want to
think as little as possible ;)

I'd also expect a modern driver to have DT bindings.  Might let that go if
it was being used with ACPI but neither is true here.

Thanks,

Jonathan

> ---
>  drivers/iio/accel/Kconfig   |  19 +
>  drivers/iio/accel/Makefile  |   2 +
>  drivers/iio/accel/bma400.h  |  74 +++
>  drivers/iio/accel/bma400_core.c | 862 
>  drivers/iio/accel/bma400_i2c.c  |  54 ++
>  5 files changed, 1011 insertions(+)
>  create mode 100644 drivers/iio/accel/bma400.h
>  create mode 100644 drivers/iio/accel/bma400_core.c
>  create mode 100644 drivers/iio/accel/bma400_i2c.c
> 
> diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
> index 9b9656ce37e6..cca6727e037e 100644
> --- a/drivers/iio/accel/Kconfig
> +++ b/drivers/iio/accel/Kconfig
> @@ -112,6 +112,25 @@ config BMA220
> To compile this driver as a module, choose M here: the
> module will be called bma220_spi.
>  
> +config BMA400
> + tristate "Bosch BMA400 3-Axis Accelerometer Driver"
> + depends on I2C
> + select REGMAP
> + select BMA400_I2C if (I2C)
> + help
> +   Say Y here if you want to build a driver for the Bosch BMA400
> +   triaxial acceleration sensor.
> +
> +   To compile this driver as a module, choose M here: the
> +   module will be called bma400_core and you will also get
> +   bma400_i2c for I2C
> +
> +config BMA400_I2C
> + tristate
> + depends on BMA400
> + depends on I2C
> + select REGMAP_I2C
> +
>  config BMC150_ACCEL
>   tristate "Bosch BMC150 Accelerometer Driver"
>   select IIO_BUFFER
> diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile
> index 56bd0215e0d4..3a051cf37f40 100644
> --- a/drivers/iio/accel/Makefile
> +++ b/drivers/iio/accel/Makefile
> @@ -14,6 +14,8 @@ obj-$(CONFIG_ADXL372_I2C) += adxl372_i2c.o
>  obj-$(CONFIG_ADXL372_SPI) += adxl372_spi.o
>  obj-$(CONFIG_BMA180) += bma180.o
>  obj-$(CONFIG_BMA220) += bma220_spi.o
> +obj-$(CONFIG_BMA400) += bma400_core.o
> +obj-$(CONFIG_BMA400_I2C) += bma400_i2c.o
>  obj-$(CONFIG_BMC150_ACCEL) += bmc150-accel-core.o
>  obj-$(CONFIG_BMC150_ACCEL_I2C) += bmc150-accel-i2c.o
>  obj-$(CONFIG_BMC150_ACCEL_SPI) += bmc150-accel-spi.o
> diff --git a/drivers/iio/accel/bma400.h b/drivers/iio/accel/bma400.h
> new file mode 100644
> index ..7fa92bc457f6
> --- /dev/null
> +++ b/drivers/iio/accel/bma400.h
> @@ -0,0 +1,74 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * bma400.h - Register constants and other forward declarations
> + *needed by the bma400 sources.
> + *
> + * Copyright 2019 Dan Robertson 
> + *

Blank line not needed.

> + */
> +
> +#include 
> +
> +/*
> + * Read-Only Registers
> + */
> +
> +/* Status and ID registers */
> +#define BMA400_CHIP_ID_REG  0x00
> +#define BMA400_ERR_REG  0x02
> +#define BMA400_STATUS_REG   0x03
> +
> +/* Acceleration registers */
> +#define BMA400_X_AXIS_LSB_REG   0x04
> +#define BMA400_X_AXIS_MSB_REG   0x05
> +#define BMA400_Y_AXIS_LSB_REG   0x06
> +#define BMA400_Y_AXIS_MSB_REG   0x07
> +#define BMA400_Z_AXIS_LSB_REG   0x08
> +#define BMA400_Z_AXIS_MSB_REG   0x09
> +
> +/* Sensort time registers */
> +#define BMA400_SENSOR_TIME0 0x0a
> +#define BMA400_SENSOR_TIME1 0x0b
> +#define BMA400_SENSOR_TIME2 0x0c
> +
> +/* Event and interrupt registers */
> +#define BMA400_EVENT_REG0x0d
> +#define BMA400_INT_STAT0_REG0x0e
> +#define BMA400_INT_STAT1_REG0x0f
> +#define BMA400_INT_STAT2_REG0x10
> +
> +/* Temperature register */
> +#define BMA400_TEMP_DATA_REG0x11
> +
> +/* FIFO length and data registers */
> +#define BMA400_FIFO_LENGTH0_REG 0x12
> +#define BMA400_FIFO_LENGTH1_REG 0x13
> +#define BMA400_FIFO_DATA_REG0x14
> +
> +/* Step count registers */
> +#define BMA400_STEP_CNT0_REG0x15
> +#define BMA400_STEP_CNT1_REG0x16
> +#define BMA400_STEP_CNT3_REG0x17
> +#define BMA400_STEP_STAT_REG0x18
> +
> +/*
> + * Read-write configuration registers
> + */
> +#define BMA400_ACC_CONFIG0_REG  0x19
> +#define BMA400_ACC_CONFIG1_REG  0x1a
> +#define BMA400_ACC_CONFIG2_REG  0x1b
> +#define BMA400_CMD_REG  0x7e
> +
> +/* Chip ID of BMA 400 devices found in the chip ID register. */
> +#define BMA400_ID_REG_VAL   0x90
> +
> +/* The

Re: [PATCH] lib: test_user_copy: style cleanup

2019-10-06 Thread Christian Brauner
On Sun, Oct 06, 2019 at 10:30:28AM +1100, Aleksa Sarai wrote:
> While writing the tests for copy_struct_from_user(), I used a construct
> that Linus doesn't appear to be too fond of:
> 
> On 2019-10-04, Linus Torvalds  wrote:
> > Hmm. That code is ugly, both before and after the fix.
> >
> > This just doesn't make sense for so many reasons:
> >
> > if ((ret |= test(umem_src == NULL, "kmalloc failed")))
> >
> > where the insanity comes from
> >
> >  - why "|=" when you know that "ret" was zero before (and it had to
> >be, for the test to make sense)
> >
> >  - why do this as a single line anyway?
> >
> >  - don't do the stupid "double parenthesis" to hide a warning. Make it
> >use an actual comparison if you add a layer of parentheses.
> 
> So instead, use a bog-standard check that isn't nearly as ugly.
> 
> Fixes: 341115822f88 ("usercopy: Add parentheses around assignment in 
> test_copy_struct_from_user")
> Fixes: f5a1a536fa14 ("lib: introduce copy_struct_from_user() helper")
> Signed-off-by: Aleksa Sarai 

Fwiw, I think the commit message doesn't necessarily need to mention
stylistic preferences nor a specific mail. It's sufficient enough to say
that the new way makes things way more obvious. But ok. :)

I'll pick this up now.

Reviewed-by: Christian Brauner 


Re: [PATCH v3 0/2] Simplify count_read/count_write/signal_read

2019-10-06 Thread Jonathan Cameron
On Sat, 5 Oct 2019 13:19:38 -0400
William Breathitt Gray  wrote:

> On Sat, Oct 05, 2019 at 03:33:08PM +0100, Jonathan Cameron wrote:
> > Hi William,
> > 
> > This all makes sense to me.  Do you want to wait for some more reviews
> > or should I pick them up now through IIO?  We are really early in
> > the cycle so plenty of time, unless there are new drivers coming you
> > want to use these from the start.
> > 
> > Thanks,
> > 
> > Jonathan  
> 
> Getting this in sooner would be better since that will save Fabien from
> having to introduce the COUNTER_COUNT_TALLY type in the cros_ec patch
> submission.
> 
> The only concern left now is that the TI eQEP driver needs to be updated
> as well for these changes, but it's not in the IIO testing branch yet.
> 
> Do you want to merge this patchset first, or wait until TI eQEP makes it
> into the testing branch? Alternatively, I can merge the cros_ec patchset
> and Intel QEP patchset into my personal repository when they are ready,
> then later submit a git pull request to you with these changes if you
> prefer that route.

OK, so I need to do a pull request to be able to move the testing branch
to the point where I can do the immutable branch needed for that TI set.
Should do that later this week. So I'll take the TI eQEP series at that
point. If you want to prep a version of this that includes this driver
that would be great.  Should be able to pull both in next weekend at
the latest.  If it takes a bit longer for you to be ready, no problem!

Thanks,

Jonathan



> 
> William Breathitt Gray
> 
> > On Wed, 18 Sep 2019 23:22:44 +0900
> > William Breathitt Gray  wrote:
> >   
> > > Changes in v3:
> > >  - Squash code changes to single patch to avoid compilation error
> > > 
> > > The changes in this patchset will not affect the userspace interface.
> > > Rather, these changes are intended to simplify the kernelspace Counter
> > > callbacks for counter device driver authors.
> > > 
> > > The following main changes are proposed:
> > > 
> > > * Retire the opaque counter_count_read_value/counter_count_write_value
> > >   structures and simply represent count data as an unsigned integer.
> > > 
> > > * Retire the opaque counter_signal_read_value structure and represent
> > >   Signal data as a counter_signal_value enum.
> > > 
> > > These changes should reduce some complexity and code in the use and
> > > implementation of the count_read, count_write, and signal_read
> > > callbacks.
> > > 
> > > The opaque structures for Count data and Signal data were introduced
> > > originally in anticipation of supporting various representations of
> > > counter data (e.g. arbitrary-precision tallies, floating-point spherical
> > > coordinate positions, etc). However, with the counter device drivers
> > > that have appeared, it's become apparent that utilizing opaque
> > > structures in kernelspace is not the best approach to take.
> > > 
> > > I believe it is best to let userspace applications decide how to
> > > interpret the count data they receive. There are a couple of reasons why
> > > it would be good to do so:
> > > 
> > > * Users use their devices in unexpected ways.
> > > 
> > >   For example, a quadrature encoder counter device is typically used to
> > >   keep track of the position of a motor, but a user could set the device
> > >   in a pulse-direction mode and instead use it to count sporadic rising
> > >   edges from an arbitrary signal line unrelated to positioning. Users
> > >   should have the freedom to decide what their data represents.
> > > 
> > > * Most counter devices represent data as unsigned integers anyway.
> > > 
> > >   For example, whether the device is a tally counter or position
> > >   counter, the count data is represented to the user as an unsigned
> > >   integer value. So specifying that one device is representing tallies
> > >   while the other specifies positions does not provide much utility from
> > >   an interface perspective.
> > > 
> > > For these reasons, the count_read and count_write callbacks have been
> > > redefined to pass count data directly as unsigned long instead of passed
> > > via opaque structures:
> > > 
> > > count_read(struct counter_device *counter,
> > >struct counter_count *count, unsigned long *val);
> > > count_write(struct counter_device *counter,
> > > struct counter_count *count, unsigned long val);
> > > 
> > > Similarly, the signal_read is redefined to pass Signal data directly as
> > > a counter_signal_value enum instead of via an opaque structure:
> > > 
> > > signal_read(struct counter_device *counter,
> > > struct counter_signal *signal,
> > > enum counter_signal_value *val);
> > > 
> > > The counter_signal_value enum is simply the counter_signal_level enum
> > > redefined to remove the references to the Signal data "level" data type.
> > > 
> > > William Breathitt Gray (2):
> > >   counter: Simplify th

Re: [PATCH] counter: stm32: clean up indentation issue

2019-10-06 Thread Jonathan Cameron
On Sat, 5 Oct 2019 13:30:04 -0400
William Breathitt Gray  wrote:

> On Wed, Sep 25, 2019 at 10:51:26AM +0100, Colin King wrote:
> > From: Colin Ian King 
> > 
> > There is an if statement that is indented one level too deeply,
> > remove the extraneous tabs.
> > 
> > Signed-off-by: Colin Ian King 
> > ---
> >  drivers/counter/stm32-timer-cnt.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/counter/stm32-timer-cnt.c 
> > b/drivers/counter/stm32-timer-cnt.c
> > index 644ba18a72ad..613dcccf79e1 100644
> > --- a/drivers/counter/stm32-timer-cnt.c
> > +++ b/drivers/counter/stm32-timer-cnt.c
> > @@ -219,8 +219,8 @@ static ssize_t stm32_count_enable_write(struct 
> > counter_device *counter,
> >  
> > if (enable) {
> > regmap_read(priv->regmap, TIM_CR1, &cr1);
> > -   if (!(cr1 & TIM_CR1_CEN))
> > -   clk_enable(priv->clk);
> > +   if (!(cr1 & TIM_CR1_CEN))
> > +   clk_enable(priv->clk);
> >  
> > regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN,
> >TIM_CR1_CEN);
> > -- 
> > 2.20.1  
> 
> Acked-by: William Breathitt Gray 
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to poke it.

Thanks,

Jonathan

> 
> Fabrice,
> 
> I noticed the TIM_CR1_CEN check is happening before the
> regmap_update_bits call for the enable path, while the disable path does
> the check after. Is this logic is correct.
> 
> William Breathitt Gray



Re: [PATCH] iio: gyro: clean up indentation issue

2019-10-06 Thread Jonathan Cameron
On Wed, 25 Sep 2019 13:32:53 +0100
Colin King  wrote:

> From: Colin Ian King 
> 
> There is a return statement that is indented incorrectly, add in
> the missing tab.
> 
> Signed-off-by: Colin Ian King 
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to ignore it.

Thanks,

Jonathan

> ---
>  drivers/iio/gyro/itg3200_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/gyro/itg3200_core.c b/drivers/iio/gyro/itg3200_core.c
> index 998fb8d66fe3..981ae2291505 100644
> --- a/drivers/iio/gyro/itg3200_core.c
> +++ b/drivers/iio/gyro/itg3200_core.c
> @@ -154,7 +154,7 @@ static int itg3200_write_raw(struct iio_dev *indio_dev,
> t);
>  
>   mutex_unlock(&indio_dev->mlock);
> - return ret;
> + return ret;
>  
>   default:
>   return -EINVAL;



Re: [PATCH] iio: imu: adis16480: clean up a condition

2019-10-06 Thread Jonathan Cameron
On Thu, 26 Sep 2019 14:36:30 +0300
Dan Carpenter  wrote:

> On Thu, Sep 26, 2019 at 11:06:39AM +, Ardelean, Alexandru wrote:
> > On Thu, 2019-09-26 at 11:10 +0300, Dan Carpenter wrote:  
> > > [External]
> > > 
> > > The "t" variable is unsigned so it can't be less than zero.  We really
> > > are just trying to prevent divide by zero bugs so just checking against
> > > zero is sufficient.

I'm not sure that true.  It if were signed we'd be detecting that the
input from userspace was negative.  That is clearly garbage for a frequency
control..  I'll hazard a guess that it was intended to catch that
as well as the divide by 0 case. 

This would be clearer if we first checked that val and val2 are both not
negative, then did the zero test on t.

If people agree, anyone want to spin a patch to do that?

Thanks,

Jonathan

> > > 
> > > Signed-off-by: Dan Carpenter 
> > > ---
> > >  drivers/iio/imu/adis16480.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
> > > index b99d73887c9f..e144e567675d 100644
> > > --- a/drivers/iio/imu/adis16480.c
> > > +++ b/drivers/iio/imu/adis16480.c
> > > @@ -318,7 +318,7 @@ static int adis16480_set_freq(struct iio_dev
> > > *indio_dev, int val, int val2)
> > >   unsigned int t, reg;  
> > 
> > I would just change the type of "t" to "int".
> > Especially, since "val" & "val2" are "int".
> >   
> 
> Yeah, but negatives or high values are basically fine.  We only care
> zero.
> 
> regards,
> dan carpenter
> 



Re: [PATCH 01/10] iio: imu: adis: rename txrx_lock -> state_lock

2019-10-06 Thread Jonathan Cameron
On Thu, 26 Sep 2019 14:18:03 +0300
Alexandru Ardelean  wrote:

> The lock can be extended a bit to protect other elements that are not
> particular to just TX/RX. Another idea would have been to just add a new
> `state_lock`, but that would mean 2 locks which would be redundant, and
> probably cause more potential for dead-locks.
> 
> What will be done in the next patches, will be to add some unlocked
> versions for read/write_reg functions.
> 
> Signed-off-by: Alexandru Ardelean 

Would be good to document the scope of the lock as a comment when it
is defined.  What exactly is 'state' in this case?

Thanks,

Jonathan

> ---
>  drivers/iio/imu/adis.c| 10 +-
>  drivers/iio/imu/adis_buffer.c |  4 ++--
>  include/linux/iio/imu/adis.h  |  2 +-
>  3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index 1631c255deab..3c2d896e3a96 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -70,7 +70,7 @@ int adis_write_reg(struct adis *adis, unsigned int reg,
>   },
>   };
>  
> - mutex_lock(&adis->txrx_lock);
> + mutex_lock(&adis->state_lock);
>  
>   spi_message_init(&msg);
>  
> @@ -114,7 +114,7 @@ int adis_write_reg(struct adis *adis, unsigned int reg,
>   }
>  
>  out_unlock:
> - mutex_unlock(&adis->txrx_lock);
> + mutex_unlock(&adis->state_lock);
>  
>   return ret;
>  }
> @@ -166,7 +166,7 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
>   },
>   };
>  
> - mutex_lock(&adis->txrx_lock);
> + mutex_lock(&adis->state_lock);
>   spi_message_init(&msg);
>  
>   if (adis->current_page != page) {
> @@ -211,7 +211,7 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
>   }
>  
>  out_unlock:
> - mutex_unlock(&adis->txrx_lock);
> + mutex_unlock(&adis->state_lock);
>  
>   return ret;
>  }
> @@ -437,7 +437,7 @@ EXPORT_SYMBOL_GPL(adis_single_conversion);
>  int adis_init(struct adis *adis, struct iio_dev *indio_dev,
>   struct spi_device *spi, const struct adis_data *data)
>  {
> - mutex_init(&adis->txrx_lock);
> + mutex_init(&adis->state_lock);
>   adis->spi = spi;
>   adis->data = data;
>   iio_device_set_drvdata(indio_dev, adis);
> diff --git a/drivers/iio/imu/adis_buffer.c b/drivers/iio/imu/adis_buffer.c
> index 9ac8356d9a95..bf581a2c321d 100644
> --- a/drivers/iio/imu/adis_buffer.c
> +++ b/drivers/iio/imu/adis_buffer.c
> @@ -123,7 +123,7 @@ static irqreturn_t adis_trigger_handler(int irq, void *p)
>   return -ENOMEM;
>  
>   if (adis->data->has_paging) {
> - mutex_lock(&adis->txrx_lock);
> + mutex_lock(&adis->state_lock);
>   if (adis->current_page != 0) {
>   adis->tx[0] = ADIS_WRITE_REG(ADIS_REG_PAGE_ID);
>   adis->tx[1] = 0;
> @@ -138,7 +138,7 @@ static irqreturn_t adis_trigger_handler(int irq, void *p)
>  
>   if (adis->data->has_paging) {
>   adis->current_page = 0;
> - mutex_unlock(&adis->txrx_lock);
> + mutex_unlock(&adis->state_lock);
>   }
>  
>   iio_push_to_buffers_with_timestamp(indio_dev, adis->buffer,
> diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
> index 4c53815bb729..3ed5eceaac2d 100644
> --- a/include/linux/iio/imu/adis.h
> +++ b/include/linux/iio/imu/adis.h
> @@ -61,7 +61,7 @@ struct adis {
>   const struct adis_data  *data;
>   struct adis_burst   *burst;
>  
> - struct mutextxrx_lock;
> + struct mutexstate_lock;
>   struct spi_message  msg;
>   struct spi_transfer *xfer;
>   unsigned intcurrent_page;



[PATCH v6 04/10] mm/memory_hotplug: Don't access uninitialized memmaps in shrink_zone_span()

2019-10-06 Thread David Hildenbrand
Let's limit shrinking to !ZONE_DEVICE so we can fix the current code. We
should never try to touch the memmap of offline sections where we could
have uninitialized memmaps and could trigger BUGs when calling
page_to_nid() on poisoned pages.

There is no reliable way to distinguish an uninitialized memmap from an
initialized memmap that belongs to ZONE_DEVICE, as we don't have
anything like SECTION_IS_ONLINE we can use similar to
pfn_to_online_section() for !ZONE_DEVICE memory. E.g.,
set_zone_contiguous() similarly relies on pfn_to_online_section() and
will therefore never set a ZONE_DEVICE zone consecutive. Stopping to
shrink the ZONE_DEVICE therefore results in no observable changes,
besides /proc/zoneinfo indicating different boundaries - something we
can totally live with.

Before commit d0dc12e86b31 ("mm/memory_hotplug: optimize memory
hotplug"), the memmap was initialized with 0 and the node with the
right value. So the zone might be wrong but not garbage. After that
commit, both the zone and the node will be garbage when touching
uninitialized memmaps.

Cc: Andrew Morton 
Cc: Oscar Salvador 
Cc: David Hildenbrand 
Cc: Michal Hocko 
Cc: Pavel Tatashin 
Cc: Dan Williams 
Fixes: d0dc12e86b31 ("mm/memory_hotplug: optimize memory hotplug")
Reported-by: Aneesh Kumar K.V 
Signed-off-by: David Hildenbrand 
---
 mm/memory_hotplug.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 86b4dc18e831..f96608d24f6a 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -331,7 +331,7 @@ static unsigned long find_smallest_section_pfn(int nid, 
struct zone *zone,
 unsigned long end_pfn)
 {
for (; start_pfn < end_pfn; start_pfn += PAGES_PER_SUBSECTION) {
-   if (unlikely(!pfn_valid(start_pfn)))
+   if (unlikely(!pfn_to_online_page(start_pfn)))
continue;
 
if (unlikely(pfn_to_nid(start_pfn) != nid))
@@ -356,7 +356,7 @@ static unsigned long find_biggest_section_pfn(int nid, 
struct zone *zone,
/* pfn is the end pfn of a memory section. */
pfn = end_pfn - 1;
for (; pfn >= start_pfn; pfn -= PAGES_PER_SUBSECTION) {
-   if (unlikely(!pfn_valid(pfn)))
+   if (unlikely(!pfn_to_online_page(pfn)))
continue;
 
if (unlikely(pfn_to_nid(pfn) != nid))
@@ -415,7 +415,7 @@ static void shrink_zone_span(struct zone *zone, unsigned 
long start_pfn,
 */
pfn = zone_start_pfn;
for (; pfn < zone_end_pfn; pfn += PAGES_PER_SUBSECTION) {
-   if (unlikely(!pfn_valid(pfn)))
+   if (unlikely(!pfn_to_online_page(pfn)))
continue;
 
if (page_zone(pfn_to_page(pfn)) != zone)
@@ -463,6 +463,16 @@ static void __remove_zone(struct zone *zone, unsigned long 
start_pfn,
struct pglist_data *pgdat = zone->zone_pgdat;
unsigned long flags;
 
+#ifdef CONFIG_ZONE_DEVICE
+   /*
+* Zone shrinking code cannot properly deal with ZONE_DEVICE. So
+* we will not try to shrink the zones - which is okay as
+* set_zone_contiguous() cannot deal with ZONE_DEVICE either way.
+*/
+   if (zone_idx(zone) == ZONE_DEVICE)
+   return;
+#endif
+
pgdat_resize_lock(zone->zone_pgdat, &flags);
shrink_zone_span(zone, start_pfn, start_pfn + nr_pages);
update_pgdat_span(pgdat);
-- 
2.21.0



[PATCH v6 02/10] mm/memmap_init: Update variable name in memmap_init_zone

2019-10-06 Thread David Hildenbrand
From: "Aneesh Kumar K.V" 

The third argument is actually number of pages. Changes the variable name
from size to nr_pages to indicate this better.

No functional change in this patch.

Cc: Andrew Morton 
Cc: Michal Hocko 
Cc: Vlastimil Babka 
Cc: Oscar Salvador 
Cc: Mel Gorman 
Cc: Mike Rapoport 
Cc: Dan Williams 
Cc: Alexander Duyck 
Cc: Pavel Tatashin 
Cc: Alexander Potapenko 
Reviewed-by: Pankaj Gupta 
Reviewed-by: David Hildenbrand 
Signed-off-by: Aneesh Kumar K.V 
Signed-off-by: David Hildenbrand 
---
 mm/page_alloc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 15c2050c629b..b0b2d5464000 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5936,10 +5936,10 @@ void __meminit memmap_init_zone(unsigned long size, int 
nid, unsigned long zone,
 #ifdef CONFIG_ZONE_DEVICE
 void __ref memmap_init_zone_device(struct zone *zone,
   unsigned long start_pfn,
-  unsigned long size,
+  unsigned long nr_pages,
   struct dev_pagemap *pgmap)
 {
-   unsigned long pfn, end_pfn = start_pfn + size;
+   unsigned long pfn, end_pfn = start_pfn + nr_pages;
struct pglist_data *pgdat = zone->zone_pgdat;
struct vmem_altmap *altmap = pgmap_altmap(pgmap);
unsigned long zone_idx = zone_idx(zone);
@@ -5956,7 +5956,7 @@ void __ref memmap_init_zone_device(struct zone *zone,
 */
if (altmap) {
start_pfn = altmap->base_pfn + vmem_altmap_offset(altmap);
-   size = end_pfn - start_pfn;
+   nr_pages = end_pfn - start_pfn;
}
 
for (pfn = start_pfn; pfn < end_pfn; pfn++) {
@@ -6003,7 +6003,7 @@ void __ref memmap_init_zone_device(struct zone *zone,
}
 
pr_info("%s initialised %lu pages in %ums\n", __func__,
-   size, jiffies_to_msecs(jiffies - start));
+   nr_pages, jiffies_to_msecs(jiffies - start));
 }
 
 #endif
-- 
2.21.0



[PATCH v6 03/10] mm/memory_hotplug: Don't access uninitialized memmaps in shrink_pgdat_span()

2019-10-06 Thread David Hildenbrand
We might use the nid of memmaps that were never initialized. For
example, if the memmap was poisoned, we will crash the kernel in
pfn_to_nid() right now. Let's use the calculated boundaries of the separate
zones instead. This now also avoids having to iterate over a whole bunch of
subsections again, after shrinking one zone.

Before commit d0dc12e86b31 ("mm/memory_hotplug: optimize memory
hotplug"), the memmap was initialized to 0 and the node was set to the
right value. After that commit, the node might be garbage.

We'll have to fix shrink_zone_span() next.

Cc: Andrew Morton 
Cc: Oscar Salvador 
Cc: David Hildenbrand 
Cc: Michal Hocko 
Cc: Pavel Tatashin 
Cc: Dan Williams 
Cc: Wei Yang 
Fixes: d0dc12e86b31 ("mm/memory_hotplug: optimize memory hotplug")
Reported-by: Aneesh Kumar K.V 
Signed-off-by: David Hildenbrand 
---
 mm/memory_hotplug.c | 72 ++---
 1 file changed, 15 insertions(+), 57 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 680b4b3e57d9..86b4dc18e831 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -436,67 +436,25 @@ static void shrink_zone_span(struct zone *zone, unsigned 
long start_pfn,
zone_span_writeunlock(zone);
 }
 
-static void shrink_pgdat_span(struct pglist_data *pgdat,
- unsigned long start_pfn, unsigned long end_pfn)
+static void update_pgdat_span(struct pglist_data *pgdat)
 {
-   unsigned long pgdat_start_pfn = pgdat->node_start_pfn;
-   unsigned long p = pgdat_end_pfn(pgdat); /* pgdat_end_pfn namespace 
clash */
-   unsigned long pgdat_end_pfn = p;
-   unsigned long pfn;
-   int nid = pgdat->node_id;
-
-   if (pgdat_start_pfn == start_pfn) {
-   /*
-* If the section is smallest section in the pgdat, it need
-* shrink pgdat->node_start_pfn and pgdat->node_spanned_pages.
-* In this case, we find second smallest valid mem_section
-* for shrinking zone.
-*/
-   pfn = find_smallest_section_pfn(nid, NULL, end_pfn,
-   pgdat_end_pfn);
-   if (pfn) {
-   pgdat->node_start_pfn = pfn;
-   pgdat->node_spanned_pages = pgdat_end_pfn - pfn;
-   }
-   } else if (pgdat_end_pfn == end_pfn) {
-   /*
-* If the section is biggest section in the pgdat, it need
-* shrink pgdat->node_spanned_pages.
-* In this case, we find second biggest valid mem_section for
-* shrinking zone.
-*/
-   pfn = find_biggest_section_pfn(nid, NULL, pgdat_start_pfn,
-  start_pfn);
-   if (pfn)
-   pgdat->node_spanned_pages = pfn - pgdat_start_pfn + 1;
-   }
-
-   /*
-* If the section is not biggest or smallest mem_section in the pgdat,
-* it only creates a hole in the pgdat. So in this case, we need not
-* change the pgdat.
-* But perhaps, the pgdat has only hole data. Thus it check the pgdat
-* has only hole or not.
-*/
-   pfn = pgdat_start_pfn;
-   for (; pfn < pgdat_end_pfn; pfn += PAGES_PER_SUBSECTION) {
-   if (unlikely(!pfn_valid(pfn)))
-   continue;
-
-   if (pfn_to_nid(pfn) != nid)
-   continue;
+   unsigned long node_start_pfn = 0, node_end_pfn = 0;
+   struct zone *zone;
 
-   /* Skip range to be removed */
-   if (pfn >= start_pfn && pfn < end_pfn)
-   continue;
+   for (zone = pgdat->node_zones;
+zone < pgdat->node_zones + MAX_NR_ZONES; zone++) {
+   unsigned long zone_end_pfn = zone->zone_start_pfn +
+zone->spanned_pages;
 
-   /* If we find valid section, we have nothing to do */
-   return;
+   /* No need to lock the zones, they can't change. */
+   if (zone_end_pfn > node_end_pfn)
+   node_end_pfn = zone_end_pfn;
+   if (zone->zone_start_pfn < node_start_pfn)
+   node_start_pfn = zone->zone_start_pfn;
}
 
-   /* The pgdat has no valid section */
-   pgdat->node_start_pfn = 0;
-   pgdat->node_spanned_pages = 0;
+   pgdat->node_start_pfn = node_start_pfn;
+   pgdat->node_spanned_pages = node_end_pfn - node_start_pfn;
 }
 
 static void __remove_zone(struct zone *zone, unsigned long start_pfn,
@@ -507,7 +465,7 @@ static void __remove_zone(struct zone *zone, unsigned long 
start_pfn,
 
pgdat_resize_lock(zone->zone_pgdat, &flags);
shrink_zone_span(zone, start_pfn, start_pfn + nr_pages);
-   shrink_pgdat_span(pgdat, start_pfn, start_pfn + nr_pages);
+   update_pgdat_span(pgdat);
pgda

[PATCH v6 01/10] mm/memunmap: Don't access uninitialized memmap in memunmap_pages()

2019-10-06 Thread David Hildenbrand
From: "Aneesh Kumar K.V" 

With an altmap, the memmap falling into the reserved altmap space are
not initialized and, therefore, contain a garbage NID and a garbage
zone. Make sure to read the NID/zone from a memmap that was initialzed.

This fixes a kernel crash that is observed when destroying a namespace:

[   81.356173] kernel BUG at include/linux/mm.h:1107!
cpu 0x1: Vector: 700 (Program Check) at [c00274087890]
pc: c04b9728: memunmap_pages+0x238/0x340
lr: c04b9724: memunmap_pages+0x234/0x340
...
pid   = 3669, comm = ndctl
kernel BUG at include/linux/mm.h:1107!
[c00274087ba0] c09e3500 devm_action_release+0x30/0x50
[c00274087bc0] c09e4758 release_nodes+0x268/0x2d0
[c00274087c30] c09dd144 device_release_driver_internal+0x174/0x240
[c00274087c70] c09d9dfc unbind_store+0x13c/0x190
[c00274087cb0] c09d8a24 drv_attr_store+0x44/0x60
[c00274087cd0] c05a7470 sysfs_kf_write+0x70/0xa0
[c00274087d10] c05a5cac kernfs_fop_write+0x1ac/0x290
[c00274087d60] c04be45c __vfs_write+0x3c/0x70
[c00274087d80] c04c26e4 vfs_write+0xe4/0x200
[c00274087dd0] c04c2a6c ksys_write+0x7c/0x140
[c00274087e20] c000bbd0 system_call+0x5c/0x68

Cc: Dan Williams 
Cc: Andrew Morton 
Cc: Jason Gunthorpe 
Cc: Logan Gunthorpe 
Cc: Ira Weiny 
Signed-off-by: Aneesh Kumar K.V 
[ minimze code changes, rephrase description ]
Signed-off-by: David Hildenbrand 
---
 mm/memremap.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/mm/memremap.c b/mm/memremap.c
index 557e53c6fb46..8c2fb44c3b4d 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -123,6 +123,7 @@ static void dev_pagemap_cleanup(struct dev_pagemap *pgmap)
 void memunmap_pages(struct dev_pagemap *pgmap)
 {
struct resource *res = &pgmap->res;
+   struct page *first_page;
unsigned long pfn;
int nid;
 
@@ -131,14 +132,16 @@ void memunmap_pages(struct dev_pagemap *pgmap)
put_page(pfn_to_page(pfn));
dev_pagemap_cleanup(pgmap);
 
+   /* make sure to access a memmap that was actually initialized */
+   first_page = pfn_to_page(pfn_first(pgmap));
+
/* pages are dead and unused, undo the arch mapping */
-   nid = page_to_nid(pfn_to_page(PHYS_PFN(res->start)));
+   nid = page_to_nid(first_page);
 
mem_hotplug_begin();
if (pgmap->type == MEMORY_DEVICE_PRIVATE) {
-   pfn = PHYS_PFN(res->start);
-   __remove_pages(page_zone(pfn_to_page(pfn)), pfn,
-PHYS_PFN(resource_size(res)), NULL);
+   __remove_pages(page_zone(first_page), PHYS_PFN(res->start),
+  PHYS_PFN(resource_size(res)), NULL);
} else {
arch_remove_memory(nid, res->start, resource_size(res),
pgmap_altmap(pgmap));
-- 
2.21.0



[PATCH v6 06/10] mm/memory_hotplug: Poison memmap in remove_pfn_range_from_zone()

2019-10-06 Thread David Hildenbrand
Let's poison the pages similar to when adding new memory in
sparse_add_section(). Also call remove_pfn_range_from_zone() from
memunmap_pages(), so we can poison the memmap from there as well.

While at it, calculate the pfn in memunmap_pages() only once.

Cc: Andrew Morton 
Cc: David Hildenbrand 
Cc: Oscar Salvador 
Cc: Michal Hocko 
Cc: Pavel Tatashin 
Cc: Dan Williams 
Signed-off-by: David Hildenbrand 
---
 mm/memory_hotplug.c | 3 +++
 mm/memremap.c   | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 5b003ffa5dc9..bf5173e7913d 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -464,6 +464,9 @@ void __ref remove_pfn_range_from_zone(struct zone *zone,
struct pglist_data *pgdat = zone->zone_pgdat;
unsigned long flags;
 
+   /* Poison struct pages because they are now uninitialized again. */
+   page_init_poison(pfn_to_page(start_pfn), sizeof(struct page) * 
nr_pages);
+
 #ifdef CONFIG_ZONE_DEVICE
/*
 * Zone shrinking code cannot properly deal with ZONE_DEVICE. So
diff --git a/mm/memremap.c b/mm/memremap.c
index 70263e6f093e..7fed8bd32a18 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -139,6 +139,8 @@ void memunmap_pages(struct dev_pagemap *pgmap)
nid = page_to_nid(first_page);
 
mem_hotplug_begin();
+   remove_pfn_range_from_zone(page_zone(first_page), PHYS_PFN(res->start),
+  PHYS_PFN(resource_size(res)));
if (pgmap->type == MEMORY_DEVICE_PRIVATE) {
__remove_pages(PHYS_PFN(res->start),
   PHYS_PFN(resource_size(res)), NULL);
-- 
2.21.0



[PATCH v6 09/10] mm/memory_hotplug: Drop local variables in shrink_zone_span()

2019-10-06 Thread David Hildenbrand
Get rid of the unnecessary local variables.

Cc: Andrew Morton 
Cc: Oscar Salvador 
Cc: David Hildenbrand 
Cc: Michal Hocko 
Cc: Pavel Tatashin 
Cc: Dan Williams 
Cc: Wei Yang 
Signed-off-by: David Hildenbrand 
---
 mm/memory_hotplug.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 8dafa1ba8d9f..843481bd507d 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -374,14 +374,11 @@ static unsigned long find_biggest_section_pfn(int nid, 
struct zone *zone,
 static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
 unsigned long end_pfn)
 {
-   unsigned long zone_start_pfn = zone->zone_start_pfn;
-   unsigned long z = zone_end_pfn(zone); /* zone_end_pfn namespace clash */
-   unsigned long zone_end_pfn = z;
unsigned long pfn;
int nid = zone_to_nid(zone);
 
zone_span_writelock(zone);
-   if (zone_start_pfn == start_pfn) {
+   if (zone->zone_start_pfn == start_pfn) {
/*
 * If the section is smallest section in the zone, it need
 * shrink zone->zone_start_pfn and zone->zone_spanned_pages.
@@ -389,25 +386,25 @@ static void shrink_zone_span(struct zone *zone, unsigned 
long start_pfn,
 * for shrinking zone.
 */
pfn = find_smallest_section_pfn(nid, zone, end_pfn,
-   zone_end_pfn);
+   zone_end_pfn(zone));
if (pfn) {
+   zone->spanned_pages = zone_end_pfn(zone) - pfn;
zone->zone_start_pfn = pfn;
-   zone->spanned_pages = zone_end_pfn - pfn;
} else {
zone->zone_start_pfn = 0;
zone->spanned_pages = 0;
}
-   } else if (zone_end_pfn == end_pfn) {
+   } else if (zone_end_pfn(zone) == end_pfn) {
/*
 * If the section is biggest section in the zone, it need
 * shrink zone->spanned_pages.
 * In this case, we find second biggest valid mem_section for
 * shrinking zone.
 */
-   pfn = find_biggest_section_pfn(nid, zone, zone_start_pfn,
+   pfn = find_biggest_section_pfn(nid, zone, zone->zone_start_pfn,
   start_pfn);
if (pfn)
-   zone->spanned_pages = pfn - zone_start_pfn + 1;
+   zone->spanned_pages = pfn - zone->zone_start_pfn + 1;
else {
zone->zone_start_pfn = 0;
zone->spanned_pages = 0;
-- 
2.21.0



[PATCH v6 07/10] mm/memory_hotplug: We always have a zone in find_(smallest|biggest)_section_pfn

2019-10-06 Thread David Hildenbrand
With shrink_pgdat_span() out of the way, we now always have a valid
zone.

Cc: Andrew Morton 
Cc: Oscar Salvador 
Cc: David Hildenbrand 
Cc: Michal Hocko 
Cc: Pavel Tatashin 
Cc: Dan Williams 
Cc: Wei Yang 
Signed-off-by: David Hildenbrand 
---
 mm/memory_hotplug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index bf5173e7913d..f294918f7211 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -337,7 +337,7 @@ static unsigned long find_smallest_section_pfn(int nid, 
struct zone *zone,
if (unlikely(pfn_to_nid(start_pfn) != nid))
continue;
 
-   if (zone && zone != page_zone(pfn_to_page(start_pfn)))
+   if (zone != page_zone(pfn_to_page(start_pfn)))
continue;
 
return start_pfn;
@@ -362,7 +362,7 @@ static unsigned long find_biggest_section_pfn(int nid, 
struct zone *zone,
if (unlikely(pfn_to_nid(pfn) != nid))
continue;
 
-   if (zone && zone != page_zone(pfn_to_page(pfn)))
+   if (zone != page_zone(pfn_to_page(pfn)))
continue;
 
return pfn;
-- 
2.21.0



[PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2019-10-06 Thread David Hildenbrand
If we have holes, the holes will automatically get detected and removed
once we remove the next bigger/smaller section. The extra checks can
go.

Cc: Andrew Morton 
Cc: Oscar Salvador 
Cc: Michal Hocko 
Cc: David Hildenbrand 
Cc: Pavel Tatashin 
Cc: Dan Williams 
Cc: Wei Yang 
Signed-off-by: David Hildenbrand 
---
 mm/memory_hotplug.c | 34 +++---
 1 file changed, 7 insertions(+), 27 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index f294918f7211..8dafa1ba8d9f 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -393,6 +393,9 @@ static void shrink_zone_span(struct zone *zone, unsigned 
long start_pfn,
if (pfn) {
zone->zone_start_pfn = pfn;
zone->spanned_pages = zone_end_pfn - pfn;
+   } else {
+   zone->zone_start_pfn = 0;
+   zone->spanned_pages = 0;
}
} else if (zone_end_pfn == end_pfn) {
/*
@@ -405,34 +408,11 @@ static void shrink_zone_span(struct zone *zone, unsigned 
long start_pfn,
   start_pfn);
if (pfn)
zone->spanned_pages = pfn - zone_start_pfn + 1;
+   else {
+   zone->zone_start_pfn = 0;
+   zone->spanned_pages = 0;
+   }
}
-
-   /*
-* The section is not biggest or smallest mem_section in the zone, it
-* only creates a hole in the zone. So in this case, we need not
-* change the zone. But perhaps, the zone has only hole data. Thus
-* it check the zone has only hole or not.
-*/
-   pfn = zone_start_pfn;
-   for (; pfn < zone_end_pfn; pfn += PAGES_PER_SUBSECTION) {
-   if (unlikely(!pfn_to_online_page(pfn)))
-   continue;
-
-   if (page_zone(pfn_to_page(pfn)) != zone)
-   continue;
-
-   /* Skip range to be removed */
-   if (pfn >= start_pfn && pfn < end_pfn)
-   continue;
-
-   /* If we find valid section, we have nothing to do */
-   zone_span_writeunlock(zone);
-   return;
-   }
-
-   /* The zone has no valid section */
-   zone->zone_start_pfn = 0;
-   zone->spanned_pages = 0;
zone_span_writeunlock(zone);
 }
 
-- 
2.21.0



[PATCH v6 10/10] mm/memory_hotplug: Cleanup __remove_pages()

2019-10-06 Thread David Hildenbrand
Let's drop the basically unused section stuff and simplify.

Also, let's use a shorter variant to calculate the number of pages to
the next section boundary.

Cc: Andrew Morton 
Cc: Oscar Salvador 
Cc: Michal Hocko 
Cc: Pavel Tatashin 
Cc: Dan Williams 
Cc: Wei Yang 
Signed-off-by: David Hildenbrand 
---
 mm/memory_hotplug.c | 17 ++---
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 843481bd507d..2275240cfa10 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -490,25 +490,20 @@ static void __remove_section(unsigned long pfn, unsigned 
long nr_pages,
 void __remove_pages(unsigned long pfn, unsigned long nr_pages,
struct vmem_altmap *altmap)
 {
+   const unsigned long end_pfn = pfn + nr_pages;
+   unsigned long cur_nr_pages;
unsigned long map_offset = 0;
-   unsigned long nr, start_sec, end_sec;
 
map_offset = vmem_altmap_offset(altmap);
 
if (check_pfn_span(pfn, nr_pages, "remove"))
return;
 
-   start_sec = pfn_to_section_nr(pfn);
-   end_sec = pfn_to_section_nr(pfn + nr_pages - 1);
-   for (nr = start_sec; nr <= end_sec; nr++) {
-   unsigned long pfns;
-
+   for (; pfn < end_pfn; pfn += cur_nr_pages) {
cond_resched();
-   pfns = min(nr_pages, PAGES_PER_SECTION
-   - (pfn & ~PAGE_SECTION_MASK));
-   __remove_section(pfn, pfns, map_offset, altmap);
-   pfn += pfns;
-   nr_pages -= pfns;
+   /* Select all remaining pages up to the next section boundary */
+   cur_nr_pages = min(end_pfn - pfn, -(pfn | PAGE_SECTION_MASK));
+   __remove_section(pfn, cur_nr_pages, map_offset, altmap);
map_offset = 0;
}
 }
-- 
2.21.0



Re: [PATCH 01/10] iio: imu: adis: rename txrx_lock -> state_lock

2019-10-06 Thread Jonathan Cameron
On Sun, 6 Oct 2019 09:53:33 +0100
Jonathan Cameron  wrote:

> On Thu, 26 Sep 2019 14:18:03 +0300
> Alexandru Ardelean  wrote:
> 
> > The lock can be extended a bit to protect other elements that are not
> > particular to just TX/RX. Another idea would have been to just add a new
> > `state_lock`, but that would mean 2 locks which would be redundant, and
> > probably cause more potential for dead-locks.
> > 
> > What will be done in the next patches, will be to add some unlocked
> > versions for read/write_reg functions.
> > 
> > Signed-off-by: Alexandru Ardelean   
> 
> Would be good to document the scope of the lock as a comment when it
> is defined.  What exactly is 'state' in this case?
As this can be done as a follow up and the rest of the series is fine
as is...

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> 
> Thanks,
> 
> Jonathan
> 
> > ---
> >  drivers/iio/imu/adis.c| 10 +-
> >  drivers/iio/imu/adis_buffer.c |  4 ++--
> >  include/linux/iio/imu/adis.h  |  2 +-
> >  3 files changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> > index 1631c255deab..3c2d896e3a96 100644
> > --- a/drivers/iio/imu/adis.c
> > +++ b/drivers/iio/imu/adis.c
> > @@ -70,7 +70,7 @@ int adis_write_reg(struct adis *adis, unsigned int reg,
> > },
> > };
> >  
> > -   mutex_lock(&adis->txrx_lock);
> > +   mutex_lock(&adis->state_lock);
> >  
> > spi_message_init(&msg);
> >  
> > @@ -114,7 +114,7 @@ int adis_write_reg(struct adis *adis, unsigned int reg,
> > }
> >  
> >  out_unlock:
> > -   mutex_unlock(&adis->txrx_lock);
> > +   mutex_unlock(&adis->state_lock);
> >  
> > return ret;
> >  }
> > @@ -166,7 +166,7 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
> > },
> > };
> >  
> > -   mutex_lock(&adis->txrx_lock);
> > +   mutex_lock(&adis->state_lock);
> > spi_message_init(&msg);
> >  
> > if (adis->current_page != page) {
> > @@ -211,7 +211,7 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
> > }
> >  
> >  out_unlock:
> > -   mutex_unlock(&adis->txrx_lock);
> > +   mutex_unlock(&adis->state_lock);
> >  
> > return ret;
> >  }
> > @@ -437,7 +437,7 @@ EXPORT_SYMBOL_GPL(adis_single_conversion);
> >  int adis_init(struct adis *adis, struct iio_dev *indio_dev,
> > struct spi_device *spi, const struct adis_data *data)
> >  {
> > -   mutex_init(&adis->txrx_lock);
> > +   mutex_init(&adis->state_lock);
> > adis->spi = spi;
> > adis->data = data;
> > iio_device_set_drvdata(indio_dev, adis);
> > diff --git a/drivers/iio/imu/adis_buffer.c b/drivers/iio/imu/adis_buffer.c
> > index 9ac8356d9a95..bf581a2c321d 100644
> > --- a/drivers/iio/imu/adis_buffer.c
> > +++ b/drivers/iio/imu/adis_buffer.c
> > @@ -123,7 +123,7 @@ static irqreturn_t adis_trigger_handler(int irq, void 
> > *p)
> > return -ENOMEM;
> >  
> > if (adis->data->has_paging) {
> > -   mutex_lock(&adis->txrx_lock);
> > +   mutex_lock(&adis->state_lock);
> > if (adis->current_page != 0) {
> > adis->tx[0] = ADIS_WRITE_REG(ADIS_REG_PAGE_ID);
> > adis->tx[1] = 0;
> > @@ -138,7 +138,7 @@ static irqreturn_t adis_trigger_handler(int irq, void 
> > *p)
> >  
> > if (adis->data->has_paging) {
> > adis->current_page = 0;
> > -   mutex_unlock(&adis->txrx_lock);
> > +   mutex_unlock(&adis->state_lock);
> > }
> >  
> > iio_push_to_buffers_with_timestamp(indio_dev, adis->buffer,
> > diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
> > index 4c53815bb729..3ed5eceaac2d 100644
> > --- a/include/linux/iio/imu/adis.h
> > +++ b/include/linux/iio/imu/adis.h
> > @@ -61,7 +61,7 @@ struct adis {
> > const struct adis_data  *data;
> > struct adis_burst   *burst;
> >  
> > -   struct mutextxrx_lock;
> > +   struct mutexstate_lock;
> > struct spi_message  msg;
> > struct spi_transfer *xfer;
> > unsigned intcurrent_page;  
> 



Re: [PATCH 02/10] iio: imu: adis: add unlocked read/write function versions

2019-10-06 Thread Jonathan Cameron
On Thu, 26 Sep 2019 14:18:04 +0300
Alexandru Ardelean  wrote:

> This will allow more flexible control to group reads & writes into a single
> lock (particularly the state_lock).
> 
> The end-goal is to remove the indio_dev->mlock usage, and the simplest fix
> would have been to just add another lock, which would not be a good idea on
> the long-run.
> 
> Signed-off-by: Alexandru Ardelean 
Applied to the togreg branch of iio.git and pushed out as testing etc.

Jonathan

> ---
>  drivers/iio/imu/adis.c   |  34 +--
>  include/linux/iio/imu/adis.h | 114 ++-
>  2 files changed, 128 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index 3c2d896e3a96..4f3be011c898 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -26,7 +26,14 @@
>  #define ADIS_MSC_CTRL_DATA_RDY_DIO2  BIT(0)
>  #define ADIS_GLOB_CMD_SW_RESET   BIT(7)
>  
> -int adis_write_reg(struct adis *adis, unsigned int reg,
> +/**
> + * __adis_write_reg() - write N bytes to register (unlocked version)
> + * @adis: The adis device
> + * @reg: The address of the lower of the two registers
> + * @value: The value to write to device (up to 4 bytes)
> + * @size: The size of the @value (in bytes)
> + */
> +int __adis_write_reg(struct adis *adis, unsigned int reg,
>   unsigned int value, unsigned int size)
>  {
>   unsigned int page = reg / ADIS_PAGE_SIZE;
> @@ -70,8 +77,6 @@ int adis_write_reg(struct adis *adis, unsigned int reg,
>   },
>   };
>  
> - mutex_lock(&adis->state_lock);
> -
>   spi_message_init(&msg);
>  
>   if (adis->current_page != page) {
> @@ -96,8 +101,7 @@ int adis_write_reg(struct adis *adis, unsigned int reg,
>   adis->tx[3] = value & 0xff;
>   break;
>   default:
> - ret = -EINVAL;
> - goto out_unlock;
> + return -EINVAL;
>   }
>  
>   xfers[size].cs_change = 0;
> @@ -113,20 +117,18 @@ int adis_write_reg(struct adis *adis, unsigned int reg,
>   adis->current_page = page;
>   }
>  
> -out_unlock:
> - mutex_unlock(&adis->state_lock);
> -
>   return ret;
>  }
> -EXPORT_SYMBOL_GPL(adis_write_reg);
> +EXPORT_SYMBOL_GPL(__adis_write_reg);
>  
>  /**
> - * adis_read_reg() - read 2 bytes from a 16-bit register
> + * __adis_read_reg() - read N bytes from register (unlocked version)
>   * @adis: The adis device
>   * @reg: The address of the lower of the two registers
>   * @val: The value read back from the device
> + * @size: The size of the @val buffer
>   */
> -int adis_read_reg(struct adis *adis, unsigned int reg,
> +int __adis_read_reg(struct adis *adis, unsigned int reg,
>   unsigned int *val, unsigned int size)
>  {
>   unsigned int page = reg / ADIS_PAGE_SIZE;
> @@ -188,15 +190,14 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
>   spi_message_add_tail(&xfers[3], &msg);
>   break;
>   default:
> - ret = -EINVAL;
> - goto out_unlock;
> + return -EINVAL;
>   }
>  
>   ret = spi_sync(adis->spi, &msg);
>   if (ret) {
>   dev_err(&adis->spi->dev, "Failed to read register 0x%02X: %d\n",
>   reg, ret);
> - goto out_unlock;
> + return ret;
>   } else {
>   adis->current_page = page;
>   }
> @@ -210,12 +211,9 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
>   break;
>   }
>  
> -out_unlock:
> - mutex_unlock(&adis->state_lock);
> -
>   return ret;
>  }
> -EXPORT_SYMBOL_GPL(adis_read_reg);
> +EXPORT_SYMBOL_GPL(__adis_read_reg);
>  
>  #ifdef CONFIG_DEBUG_FS
>  
> diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
> index 3ed5eceaac2d..3a028c40e04e 100644
> --- a/include/linux/iio/imu/adis.h
> +++ b/include/linux/iio/imu/adis.h
> @@ -75,11 +75,121 @@ int adis_init(struct adis *adis, struct iio_dev 
> *indio_dev,
>   struct spi_device *spi, const struct adis_data *data);
>  int adis_reset(struct adis *adis);
>  
> -int adis_write_reg(struct adis *adis, unsigned int reg,
> +int __adis_write_reg(struct adis *adis, unsigned int reg,
>   unsigned int val, unsigned int size);
> -int adis_read_reg(struct adis *adis, unsigned int reg,
> +int __adis_read_reg(struct adis *adis, unsigned int reg,
>   unsigned int *val, unsigned int size);
>  
> +/**
> + * __adis_write_reg_8() - Write single byte to a register (unlocked version)
> + * @adis: The adis device
> + * @reg: The address of the register to be written
> + * @value: The value to write
> + */
> +static inline int __adis_write_reg_8(struct adis *adis, unsigned int reg,
> + uint8_t val)
> +{
> + return __adis_write_reg(adis, reg, val, 1);
> +}
> +
> +/**
> + * __adis_write_reg_16() - Write 2 bytes to a pair of registers (unlocked 
> version)
> + * @adis: The adis device
> + * @reg: The address of the low

Re: [PATCH 03/10] iio: imu: adis[16480]: group RW into a single lock in adis_enable_irq()

2019-10-06 Thread Jonathan Cameron
On Thu, 26 Sep 2019 14:18:05 +0300
Alexandru Ardelean  wrote:

> The adis_enable_irq() does a read & a write. This change keeps a lock for
> the duration of both operations vs for each op.
> 
> The change is also needed in adis16480, since that has it's own
> implementation for adis_enable_irq().
> 
> Signed-off-by: Alexandru Ardelean 
Applied.

Thanks,

Jonathan

> ---
>  drivers/iio/imu/adis.c  | 17 +++--
>  drivers/iio/imu/adis16480.c |  4 ++--
>  2 files changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index 4f3be011c898..dc30f70d36f3 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -250,12 +250,16 @@ int adis_enable_irq(struct adis *adis, bool enable)
>   int ret = 0;
>   uint16_t msc;
>  
> - if (adis->data->enable_irq)
> - return adis->data->enable_irq(adis, enable);
> + mutex_lock(&adis->state_lock);
> +
> + if (adis->data->enable_irq) {
> + ret = adis->data->enable_irq(adis, enable);
> + goto out_unlock;
> + }
>  
> - ret = adis_read_reg_16(adis, adis->data->msc_ctrl_reg, &msc);
> + ret = __adis_read_reg_16(adis, adis->data->msc_ctrl_reg, &msc);
>   if (ret)
> - goto error_ret;
> + goto out_unlock;
>  
>   msc |= ADIS_MSC_CTRL_DATA_RDY_POL_HIGH;
>   msc &= ~ADIS_MSC_CTRL_DATA_RDY_DIO2;
> @@ -264,9 +268,10 @@ int adis_enable_irq(struct adis *adis, bool enable)
>   else
>   msc &= ~ADIS_MSC_CTRL_DATA_RDY_EN;
>  
> - ret = adis_write_reg_16(adis, adis->data->msc_ctrl_reg, msc);
> + ret = __adis_write_reg_16(adis, adis->data->msc_ctrl_reg, msc);
>  
> -error_ret:
> +out_unlock:
> + mutex_unlock(&adis->state_lock);
>   return ret;
>  }
>  EXPORT_SYMBOL(adis_enable_irq);
> diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
> index b99d73887c9f..dc13d8a33612 100644
> --- a/drivers/iio/imu/adis16480.c
> +++ b/drivers/iio/imu/adis16480.c
> @@ -936,14 +936,14 @@ static int adis16480_enable_irq(struct adis *adis, bool 
> enable)
>   uint16_t val;
>   int ret;
>  
> - ret = adis_read_reg_16(adis, ADIS16480_REG_FNCTIO_CTRL, &val);
> + ret = __adis_read_reg_16(adis, ADIS16480_REG_FNCTIO_CTRL, &val);
>   if (ret < 0)
>   return ret;
>  
>   val &= ~ADIS16480_DRDY_EN_MSK;
>   val |= ADIS16480_DRDY_EN(enable);
>  
> - return adis_write_reg_16(adis, ADIS16480_REG_FNCTIO_CTRL, val);
> + return __adis_write_reg_16(adis, ADIS16480_REG_FNCTIO_CTRL, val);
>  }
>  
>  static int adis16480_initial_setup(struct iio_dev *indio_dev)



Re: [PATCH 04/10] iio: imu: adis: create an unlocked version of adis_check_status()

2019-10-06 Thread Jonathan Cameron
On Thu, 26 Sep 2019 14:18:06 +0300
Alexandru Ardelean  wrote:

> This one also gets re-used in certain operations, so it makes sense to
> have an unlocked version of this to group it with other
> reads/writes/operations to have a single lock for the whole state change.
> 
> Signed-off-by: Alexandru Ardelean 
Applied.

Thanks,

J
> ---
>  drivers/iio/imu/adis.c   |  8 
>  include/linux/iio/imu/adis.h | 13 -
>  2 files changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index dc30f70d36f3..e461b9ae22a5 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -277,18 +277,18 @@ int adis_enable_irq(struct adis *adis, bool enable)
>  EXPORT_SYMBOL(adis_enable_irq);
>  
>  /**
> - * adis_check_status() - Check the device for error conditions
> + * __adis_check_status() - Check the device for error conditions (unlocked)
>   * @adis: The adis device
>   *
>   * Returns 0 on success, a negative error code otherwise
>   */
> -int adis_check_status(struct adis *adis)
> +int __adis_check_status(struct adis *adis)
>  {
>   uint16_t status;
>   int ret;
>   int i;
>  
> - ret = adis_read_reg_16(adis, adis->data->diag_stat_reg, &status);
> + ret = __adis_read_reg_16(adis, adis->data->diag_stat_reg, &status);
>   if (ret < 0)
>   return ret;
>  
> @@ -306,7 +306,7 @@ int adis_check_status(struct adis *adis)
>  
>   return -EIO;
>  }
> -EXPORT_SYMBOL_GPL(adis_check_status);
> +EXPORT_SYMBOL_GPL(__adis_check_status);
>  
>  /**
>   * adis_reset() - Reset the device
> diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
> index 3a028c40e04e..f4ffba0c36b1 100644
> --- a/include/linux/iio/imu/adis.h
> +++ b/include/linux/iio/imu/adis.h
> @@ -263,7 +263,18 @@ static inline int adis_read_reg_32(struct adis *adis, 
> unsigned int reg,
>  }
>  
>  int adis_enable_irq(struct adis *adis, bool enable);
> -int adis_check_status(struct adis *adis);
> +int __adis_check_status(struct adis *adis);
> +
> +static inline int adis_check_status(struct adis *adis)
> +{
> + int ret;
> +
> + mutex_lock(&adis->state_lock);
> + ret = __adis_check_status(adis);
> + mutex_unlock(&adis->state_lock);
> +
> + return ret;
> +}
>  
>  int adis_initial_startup(struct adis *adis);
>  



Re: [PATCH 06/10] iio: imu: adis: protect initial startup routine with state lock

2019-10-06 Thread Jonathan Cameron
On Thu, 26 Sep 2019 14:18:08 +0300
Alexandru Ardelean  wrote:

> The initial startup routine is called by some ADIS drivers during probe,
> and before registering with IIO. Normally, userspace should not be able to
> do any access to the device (as there shouldn't be any available).
> 
> This change extends the state lock to the entire initial-startup routine.
> Behaviourally nothing should change, but this should make the library
> function a bit more robust.
> 
> Signed-off-by: Alexandru Ardelean 
Applied.

Thanks,

> ---
>  drivers/iio/imu/adis.c | 16 ++--
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index b14101bf34b9..7468294d1776 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -331,7 +331,7 @@ static int adis_self_test(struct adis *adis)
>  {
>   int ret;
>  
> - ret = adis_write_reg_16(adis, adis->data->msc_ctrl_reg,
> + ret = __adis_write_reg_16(adis, adis->data->msc_ctrl_reg,
>   adis->data->self_test_mask);
>   if (ret) {
>   dev_err(&adis->spi->dev, "Failed to initiate self test: %d\n",
> @@ -341,10 +341,10 @@ static int adis_self_test(struct adis *adis)
>  
>   msleep(adis->data->startup_delay);
>  
> - ret = adis_check_status(adis);
> + ret = __adis_check_status(adis);
>  
>   if (adis->data->self_test_no_autoclear)
> - adis_write_reg_16(adis, adis->data->msc_ctrl_reg, 0x00);
> + __adis_write_reg_16(adis, adis->data->msc_ctrl_reg, 0x00);
>  
>   return ret;
>  }
> @@ -362,19 +362,23 @@ int adis_initial_startup(struct adis *adis)
>  {
>   int ret;
>  
> + mutex_lock(&adis->state_lock);
> +
>   ret = adis_self_test(adis);
>   if (ret) {
>   dev_err(&adis->spi->dev, "Self-test failed, trying reset.\n");
> - adis_reset(adis);
> + __adis_reset(adis);
>   msleep(adis->data->startup_delay);
>   ret = adis_self_test(adis);
>   if (ret) {
>   dev_err(&adis->spi->dev, "Second self-test failed, 
> giving up.\n");
> - return ret;
> + goto out_unlock;
>   }
>   }
>  
> - return 0;
> +out_unlock:
> + mutex_unlock(&adis->state_lock);
> + return ret;
>  }
>  EXPORT_SYMBOL_GPL(adis_initial_startup);
>  



Linux 4.4.195

2019-10-06 Thread Greg KH
I'm announcing the release of the 4.4.195 kernel.

All users of the 4.4 kernel series must upgrade.

The updated 4.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.4.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile  |2 -
 arch/arm/mach-zynq/platsmp.c  |2 -
 arch/ia64/kernel/module.c |8 +++-
 arch/x86/kernel/apic/apic.c   |8 
 arch/x86/kernel/smp.c |   46 +++---
 arch/x86/kvm/emulate.c|2 +
 arch/x86/kvm/x86.c|   21 +--
 drivers/acpi/cppc_acpi.c  |6 ++-
 drivers/acpi/custom_method.c  |5 ++
 drivers/base/soc.c|2 +
 drivers/bluetooth/btusb.c |3 +
 drivers/char/hw_random/core.c |2 -
 drivers/char/mem.c|   21 +++
 drivers/crypto/talitos.c  |1 
 drivers/dma/bcm2835-dma.c |4 +-
 drivers/dma/edma.c|9 +++--
 drivers/dma/iop-adma.c|   18 +-
 drivers/firmware/efi/cper.c   |   15 
 drivers/gpu/drm/drm_probe_helper.c|9 -
 drivers/hid/hid-lg.c  |   22 
 drivers/hid/hid-lg4ff.c   |1 
 drivers/hid/hid-prodikeys.c   |   12 +-
 drivers/hid/hidraw.c  |2 -
 drivers/hwmon/acpi_power_meter.c  |4 +-
 drivers/i2c/busses/i2c-riic.c |1 
 drivers/irqchip/irq-gic-v3-its.c  |9 ++---
 drivers/isdn/mISDN/socket.c   |2 +
 drivers/leds/leds-lp5562.c|6 ++-
 drivers/md/md.c   |   14 ++-
 drivers/md/raid1.c|   13 ++-
 drivers/md/raid5.c|4 +-
 drivers/media/i2c/ov9650.c|5 ++
 drivers/media/pci/saa7134/saa7134-i2c.c   |   12 --
 drivers/media/pci/saa7146/hexium_gemini.c |3 +
 drivers/media/platform/omap3isp/isp.c |8 
 drivers/media/platform/omap3isp/ispccdc.c |1 
 drivers/media/platform/omap3isp/ispccp2.c |1 
 drivers/media/platform/omap3isp/ispcsi2.c |1 
 drivers/media/platform/omap3isp/isppreview.c  |1 
 drivers/media/platform/omap3isp/ispresizer.c  |1 
 drivers/media/platform/omap3isp/ispstat.c |2 +
 drivers/media/radio/si470x/radio-si470x-usb.c |5 ++
 drivers/media/rc/iguanair.c   |   15 +++-
 drivers/media/usb/cpia2/cpia2_usb.c   |4 ++
 drivers/media/usb/dvb-usb/dib0700_devices.c   |8 
 drivers/media/usb/gspca/konica.c  |5 ++
 drivers/media/usb/gspca/nw80x.c   |5 ++
 drivers/media/usb/gspca/ov519.c   |   10 +
 drivers/media/usb/gspca/ov534.c   |5 ++
 drivers/media/usb/gspca/ov534_9.c |1 
 drivers/media/usb/gspca/se401.c   |5 ++
 drivers/media/usb/gspca/sn9c20x.c |   12 ++
 drivers/media/usb/gspca/sonixb.c  |5 ++
 drivers/media/usb/gspca/sonixj.c  |5 ++
 drivers/media/usb/gspca/spca1528.c|5 ++
 drivers/media/usb/gspca/sq930x.c  |5 ++
 drivers/media/usb/gspca/sunplus.c |5 ++
 drivers/media/usb/gspca/vc032x.c  |5 ++
 drivers/media/usb/gspca/w996Xcf.c |5 ++
 drivers/media/usb/hdpvr/hdpvr-core.c  |   13 ++-
 drivers/media/usb/ttusb-dec/ttusb_dec.c   |2 -
 drivers/mmc/host/sdhci.c  |4 +-
 drivers/mtd/chips/cfi_cmdset_0002.c   |   18 ++
 drivers/net/arcnet/arcnet.c   |   31 +
 drivers/net/ethernet/marvell/skge.c   |2 -
 drivers/net/ethernet/nxp/lpc_eth.c|   13 +++
 drivers/net/phy/national.c|9 +++--
 drivers/net/usb/cdc_ncm.c |6 ++-
 drivers/net/usb/usbnet.c  |8 
 drivers/net/wireless/libertas/if_usb.c|3 +
 drivers/parisc/dino.c |   24 +
 fs/btrfs/ctree.c  |5 ++
 fs/btrfs/extent-tree.c|8 
 fs/btrfs/qgroup.c |   33 ++
 fs/cifs/smb2ops.c |5 ++
 fs/ext4/inode.c   |9 +
 fs/f2fs/segment.c |   44 ++--
 fs/f2fs/super.

Re: [PATCH 08/10] iio: imu: adis16400: rework locks using ADIS library's state lock

2019-10-06 Thread Jonathan Cameron
On Thu, 26 Sep 2019 14:18:10 +0300
Alexandru Ardelean  wrote:

> This change removes the use of indio_dev's mlock in favor using the state
> lock from the ADIS library.
> 
> The set_freq() & get_freq() hooks are unlocked, so they require specific
> locking. That is because in some cases the get_freq() hook is used in
> combination with adis16400_set_filter().
> 
> In cases where only one read/write is done, the functions that hold the
> state lock are used.
> 
> Signed-off-by: Alexandru Ardelean 
Applied.

Thanks,

Jonathan

> ---
>  drivers/iio/imu/adis16400.c | 51 ++---
>  1 file changed, 25 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/iio/imu/adis16400.c b/drivers/iio/imu/adis16400.c
> index 0575ff706bd4..e042a2aabf6b 100644
> --- a/drivers/iio/imu/adis16400.c
> +++ b/drivers/iio/imu/adis16400.c
> @@ -162,6 +162,7 @@ struct adis16400_chip_info {
>   unsigned int accel_scale_micro;
>   int temp_scale_nano;
>   int temp_offset;
> + /* set_freq() & get_freq() need to avoid using ADIS lib's state lock */
>   int (*set_freq)(struct adis16400_state *st, unsigned int freq);
>   int (*get_freq)(struct adis16400_state *st);
>  };
> @@ -326,7 +327,7 @@ static int adis16334_get_freq(struct adis16400_state *st)
>   int ret;
>   uint16_t t;
>  
> - ret = adis_read_reg_16(&st->adis, ADIS16400_SMPL_PRD, &t);
> + ret = __adis_read_reg_16(&st->adis, ADIS16400_SMPL_PRD, &t);
>   if (ret < 0)
>   return ret;
>  
> @@ -350,7 +351,7 @@ static int adis16334_set_freq(struct adis16400_state *st, 
> unsigned int freq)
>   t <<= ADIS16334_RATE_DIV_SHIFT;
>   t |= ADIS16334_RATE_INT_CLK;
>  
> - return adis_write_reg_16(&st->adis, ADIS16400_SMPL_PRD, t);
> + return __adis_write_reg_16(&st->adis, ADIS16400_SMPL_PRD, t);
>  }
>  
>  static int adis16400_get_freq(struct adis16400_state *st)
> @@ -358,7 +359,7 @@ static int adis16400_get_freq(struct adis16400_state *st)
>   int sps, ret;
>   uint16_t t;
>  
> - ret = adis_read_reg_16(&st->adis, ADIS16400_SMPL_PRD, &t);
> + ret = __adis_read_reg_16(&st->adis, ADIS16400_SMPL_PRD, &t);
>   if (ret < 0)
>   return ret;
>  
> @@ -390,7 +391,7 @@ static int adis16400_set_freq(struct adis16400_state *st, 
> unsigned int freq)
>   else
>   st->adis.spi->max_speed_hz = ADIS16400_SPI_FAST;
>  
> - return adis_write_reg_8(&st->adis, ADIS16400_SMPL_PRD, val);
> + return __adis_write_reg_8(&st->adis, ADIS16400_SMPL_PRD, val);
>  }
>  
>  static const unsigned int adis16400_3db_divisors[] = {
> @@ -404,7 +405,7 @@ static const unsigned int adis16400_3db_divisors[] = {
>   [7] = 200, /* Not a valid setting */
>  };
>  
> -static int adis16400_set_filter(struct iio_dev *indio_dev, int sps, int val)
> +static int __adis16400_set_filter(struct iio_dev *indio_dev, int sps, int 
> val)
>  {
>   struct adis16400_state *st = iio_priv(indio_dev);
>   uint16_t val16;
> @@ -415,11 +416,11 @@ static int adis16400_set_filter(struct iio_dev 
> *indio_dev, int sps, int val)
>   break;
>   }
>  
> - ret = adis_read_reg_16(&st->adis, ADIS16400_SENS_AVG, &val16);
> + ret = __adis_read_reg_16(&st->adis, ADIS16400_SENS_AVG, &val16);
>   if (ret < 0)
>   return ret;
>  
> - ret = adis_write_reg_16(&st->adis, ADIS16400_SENS_AVG,
> + ret = __adis_write_reg_16(&st->adis, ADIS16400_SENS_AVG,
>(val16 & ~0x07) | i);
>   return ret;
>  }
> @@ -507,32 +508,31 @@ static int adis16400_write_raw(struct iio_dev 
> *indio_dev,
>   struct iio_chan_spec const *chan, int val, int val2, long info)
>  {
>   struct adis16400_state *st = iio_priv(indio_dev);
> + struct mutex *slock = &st->adis.state_lock;
>   int ret, sps;
>  
>   switch (info) {
>   case IIO_CHAN_INFO_CALIBBIAS:
> - mutex_lock(&indio_dev->mlock);
>   ret = adis_write_reg_16(&st->adis,
>   adis16400_addresses[chan->scan_index], val);
> - mutex_unlock(&indio_dev->mlock);
>   return ret;
>   case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY:
>   /*
>* Need to cache values so we can update if the frequency
>* changes.
>*/
> - mutex_lock(&indio_dev->mlock);
> + mutex_lock(slock);
>   st->filt_int = val;
>   /* Work out update to current value */
>   sps = st->variant->get_freq(st);
>   if (sps < 0) {
> - mutex_unlock(&indio_dev->mlock);
> + mutex_unlock(slock);
>   return sps;
>   }
>  
> - ret = adis16400_set_filter(indio_dev, sps,
> + ret = __adis16400_set_filter(indio_dev, sps,
>   val * 1000 + val2 / 1000);
> - mutex_unlock(&indio_dev->

Linux 4.9.195

2019-10-06 Thread Greg KH
I'm announcing the release of the 4.9.195 kernel.

All users of the 4.9 kernel series must upgrade.

The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.9.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile |2 
 arch/arm/boot/dts/exynos5420-peach-pit.dts   |1 
 arch/arm/boot/dts/exynos5800-peach-pi.dts|1 
 arch/arm/boot/dts/imx7d-cl-som-imx7.dts  |4 
 arch/arm/mach-zynq/platsmp.c |2 
 arch/arm64/mm/proc.S |9 +
 arch/ia64/kernel/module.c|8 +
 arch/s390/crypto/aes_s390.c  |6 +
 arch/x86/kernel/apic/apic.c  |8 +
 arch/x86/kernel/smp.c|   46 +
 arch/x86/kvm/emulate.c   |2 
 arch/x86/kvm/x86.c   |   21 +++-
 drivers/acpi/cppc_acpi.c |6 -
 drivers/acpi/custom_method.c |5 -
 drivers/acpi/pci_irq.c   |4 
 drivers/base/soc.c   |2 
 drivers/bluetooth/btusb.c|3 
 drivers/char/hw_random/core.c|2 
 drivers/char/mem.c   |   21 
 drivers/crypto/talitos.c |1 
 drivers/devfreq/exynos-bus.c |   31 +++---
 drivers/devfreq/governor_passive.c   |7 -
 drivers/dma/bcm2835-dma.c|4 
 drivers/dma/edma.c   |9 +
 drivers/dma/iop-adma.c   |   18 +--
 drivers/edac/altera_edac.c   |4 
 drivers/firmware/efi/cper.c  |   15 +++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c |5 +
 drivers/gpu/drm/drm_probe_helper.c   |9 +
 drivers/hid/hid-lg.c |   10 +-
 drivers/hid/hid-lg4ff.c  |1 
 drivers/hid/hid-prodikeys.c  |   12 ++
 drivers/hid/hidraw.c |2 
 drivers/hwmon/acpi_power_meter.c |4 
 drivers/i2c/busses/i2c-riic.c|1 
 drivers/infiniband/core/cq.c |8 +
 drivers/infiniband/core/device.c |   15 ++-
 drivers/infiniband/core/mad.c|2 
 drivers/infiniband/hw/hfi1/mad.c |   45 +++--
 drivers/iommu/amd_iommu.c|4 
 drivers/irqchip/irq-gic-v3-its.c |9 -
 drivers/isdn/mISDN/socket.c  |2 
 drivers/leds/leds-lp5562.c   |6 +
 drivers/md/md.c  |   14 ++
 drivers/md/raid1.c   |   13 ++
 drivers/md/raid5.c   |4 
 drivers/media/dvb-core/dvbdev.c  |4 
 drivers/media/i2c/ov9650.c   |5 +
 drivers/media/i2c/tvp5150.c  |2 
 drivers/media/pci/saa7134/saa7134-i2c.c  |   12 +-
 drivers/media/pci/saa7146/hexium_gemini.c|3 
 drivers/media/platform/exynos4-is/fimc-is.c  |1 
 drivers/media/platform/exynos4-is/media-dev.c|2 
 drivers/media/platform/omap3isp/isp.c|8 +
 drivers/media/platform/omap3isp/ispccdc.c|1 
 drivers/media/platform/omap3isp/ispccp2.c|1 
 drivers/media/platform/omap3isp/ispcsi2.c|1 
 drivers/media/platform/omap3isp/isppreview.c |1 
 drivers/media/platform/omap3isp/ispresizer.c |1 
 drivers/media/platform/omap3isp/ispstat.c|2 
 drivers/media/radio/si470x/radio-si470x-usb.c|5 -
 drivers/media/rc/iguanair.c  |   15 +--
 drivers/media/usb/cpia2/cpia2_usb.c  |4 
 drivers/media/usb/dvb-usb/dib0700_devices.c  |8 +
 drivers/media/usb/gspca/konica.c |5 +
 drivers/media/usb/gspca/nw80x.c  |5 +
 drivers/media/usb/gspca/ov519.c  |   10 ++
 drivers/media/usb/gspca/ov534.c  |5 +
 drivers/media/usb/gspca/ov534_9.c|1 
 drivers/media/usb/gspca/se401.c  |5 +
 drivers/media/usb/gspca/sn9c20x.c|   12 ++
 drivers/media/usb/gspca/sonixb.c |5 +
 drivers/media/usb/gspca/sonixj.c |5 +
 drivers/media/usb/gspca/spca1528.c   |5 +
 drivers/media/usb/gspca/sq930x.c |5 +
 drivers/media/usb/gspca/sunplus.c|5 +
 drivers/media/usb/gspca/vc032x.c |5 +
 drivers/media/usb/gspca/w996Xc

Re: [PATCH 07/10] iio: imu: adis: group single conversion under a single state lock

2019-10-06 Thread Jonathan Cameron
On Thu, 26 Sep 2019 14:18:09 +0300
Alexandru Ardelean  wrote:

> Signed-off-by: Alexandru Ardelean 
Applied.
Thanks,

J
> ---
>  drivers/iio/imu/adis.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index 7468294d1776..5e28464ea05b 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -404,15 +404,15 @@ int adis_single_conversion(struct iio_dev *indio_dev,
>   unsigned int uval;
>   int ret;
>  
> - mutex_lock(&indio_dev->mlock);
> + mutex_lock(&adis->state_lock);
>  
> - ret = adis_read_reg(adis, chan->address, &uval,
> + ret = __adis_read_reg(adis, chan->address, &uval,
>   chan->scan_type.storagebits / 8);
>   if (ret)
>   goto err_unlock;
>  
>   if (uval & error_mask) {
> - ret = adis_check_status(adis);
> + ret = __adis_check_status(adis);
>   if (ret)
>   goto err_unlock;
>   }
> @@ -424,7 +424,7 @@ int adis_single_conversion(struct iio_dev *indio_dev,
>  
>   ret = IIO_VAL_INT;
>  err_unlock:
> - mutex_unlock(&indio_dev->mlock);
> + mutex_unlock(&adis->state_lock);
>   return ret;
>  }
>  EXPORT_SYMBOL_GPL(adis_single_conversion);



Linux 4.19.77

2019-10-06 Thread Greg KH
I'm announcing the release of the 4.19.77 kernel.

All users of the 4.19 kernel series must upgrade.

The updated 4.19.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.19.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile  |2 
 arch/arm/boot/dts/exynos5420-peach-pit.dts|1 
 arch/arm/boot/dts/exynos5800-peach-pi.dts |1 
 arch/arm/boot/dts/imx7-colibri.dtsi   |1 
 arch/arm/boot/dts/imx7d-cl-som-imx7.dts   |4 
 arch/arm/mach-zynq/platsmp.c  |2 
 arch/arm/plat-samsung/watchdog-reset.c|1 
 arch/arm64/boot/dts/rockchip/rk3328.dtsi  |3 
 arch/arm64/include/asm/cputype.h  |   21 -
 arch/arm64/include/asm/pgtable.h  |6 
 arch/arm64/include/asm/tlbflush.h |1 
 arch/arm64/kernel/cpufeature.c|2 
 arch/arm64/mm/proc.S  |9 
 arch/ia64/kernel/module.c |8 
 arch/m68k/include/asm/atarihw.h   |9 
 arch/m68k/include/asm/io_mm.h |6 
 arch/m68k/include/asm/macintosh.h |1 
 arch/powerpc/platforms/powernv/opal-imc.c |   12 
 arch/s390/crypto/aes_s390.c   |6 
 arch/x86/include/asm/intel-family.h   |3 
 arch/x86/kernel/apic/apic.c   |  115 ---
 arch/x86/kernel/apic/vector.c |   11 
 arch/x86/kernel/smp.c |   46 +--
 arch/x86/kvm/emulate.c|2 
 arch/x86/kvm/x86.c|   21 +
 arch/x86/mm/pti.c |8 
 block/blk-flush.c |   10 
 block/blk-mq.c|5 
 block/blk.h   |7 
 drivers/acpi/acpi_processor.c |   10 
 drivers/acpi/cppc_acpi.c  |6 
 drivers/acpi/custom_method.c  |5 
 drivers/acpi/pci_irq.c|4 
 drivers/ata/ahci.c|  116 ---
 drivers/ata/ahci.h|2 
 drivers/base/soc.c|2 
 drivers/block/loop.c  |1 
 drivers/block/nbd.c   |4 
 drivers/char/hw_random/core.c |2 
 drivers/char/mem.c|   21 +
 drivers/devfreq/exynos-bus.c  |   31 +-
 drivers/devfreq/governor_passive.c|7 
 drivers/dma/bcm2835-dma.c |4 
 drivers/dma/iop-adma.c|   18 -
 drivers/dma/ti/edma.c |9 
 drivers/edac/altera_edac.c|4 
 drivers/edac/amd64_edac.c |   28 +
 drivers/edac/edac_mc.c|8 
 drivers/edac/pnd2_edac.c  |7 
 drivers/firmware/arm_scmi/driver.c|8 
 drivers/firmware/efi/cper.c   |   15 
 drivers/firmware/qcom_scm.c   |7 
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |1 
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  |5 
 drivers/hwmon/acpi_power_meter.c  |4 
 drivers/i2c/busses/i2c-riic.c |1 
 drivers/infiniband/hw/hfi1/mad.c  |   45 +-
 drivers/infiniband/hw/mlx5/main.c |1 
 drivers/iommu/Makefile|2 
 drivers/iommu/amd_iommu.c |4 
 drivers/iommu/amd_iommu.h |   14 
 drivers/iommu/amd_iommu_init.c|5 
 drivers/iommu/amd_iommu_quirks.c  |   92 ++
 drivers/iommu/iova.c  |4 
 drivers/isdn/mISDN/socket.c   |2 
 drivers/leds/led-triggers.c   |1 
 drivers/leds/leds-lp5562.c|6 
 drivers/md/bcache/closure.c   |   10 
 drivers/md/dm-rq.c|1 
 drivers/md/md.c   |   28 +
 drivers/md/md.h   |3 
 drivers/md/raid0.c|   33 ++
 drivers/md/raid0.h|   14 
 drivers/md/raid1.c|   39 +-
 drivers/md/raid5.c|   10 
 drivers/media/cec/cec-notifier.c  |2 
 drivers/media/dvb-core/dvb_frontend.c |4 

Re: Linux 4.4.195

2019-10-06 Thread Greg KH
diff --git a/Makefile b/Makefile
index bea8f3f591c4..721fa569a680 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 4
-SUBLEVEL = 194
+SUBLEVEL = 195
 EXTRAVERSION =
 NAME = Blurry Fish Butt
 
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index f66816c49186..dabe33ac988e 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -65,7 +65,7 @@ int zynq_cpun_start(u32 address, int cpu)
* 0x4: Jump by mov instruction
* 0x8: Jumping address
*/
-   memcpy((__force void *)zero, &zynq_secondary_trampoline,
+   memcpy_toio(zero, &zynq_secondary_trampoline,
trampoline_size);
writel(address, zero + trampoline_size);
 
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index 36b2c94a8eb5..14c7184daaf6 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -912,8 +912,12 @@ module_finalize (const Elf_Ehdr *hdr, const Elf_Shdr 
*sechdrs, struct module *mo
 void
 module_arch_cleanup (struct module *mod)
 {
-   if (mod->arch.init_unw_table)
+   if (mod->arch.init_unw_table) {
unw_remove_unwind_table(mod->arch.init_unw_table);
-   if (mod->arch.core_unw_table)
+   mod->arch.init_unw_table = NULL;
+   }
+   if (mod->arch.core_unw_table) {
unw_remove_unwind_table(mod->arch.core_unw_table);
+   mod->arch.core_unw_table = NULL;
+   }
 }
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 834d1b5b4355..be3d4dcf3a10 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1265,6 +1265,14 @@ void setup_local_APIC(void)
return;
}
 
+   /*
+* If this comes from kexec/kcrash the APIC might be enabled in
+* SPIV. Soft disable it before doing further initialization.
+*/
+   value = apic_read(APIC_SPIV);
+   value &= ~APIC_SPIV_APIC_ENABLED;
+   apic_write(APIC_SPIV, value);
+
 #ifdef CONFIG_X86_32
/* Pound the ESR really hard over the head with a big hammer - mbligh */
if (lapic_is_integrated() && apic->disable_esr) {
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 12c8286206ce..6a0ba9d09b0e 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -176,6 +176,12 @@ asmlinkage __visible void smp_reboot_interrupt(void)
irq_exit();
 }
 
+static int register_stop_handler(void)
+{
+   return register_nmi_handler(NMI_LOCAL, smp_stop_nmi_callback,
+   NMI_FLAG_FIRST, "smp_stop");
+}
+
 static void native_stop_other_cpus(int wait)
 {
unsigned long flags;
@@ -209,39 +215,41 @@ static void native_stop_other_cpus(int wait)
apic->send_IPI_allbutself(REBOOT_VECTOR);
 
/*
-* Don't wait longer than a second if the caller
-* didn't ask us to wait.
+* Don't wait longer than a second for IPI completion. The
+* wait request is not checked here because that would
+* prevent an NMI shutdown attempt in case that not all
+* CPUs reach shutdown state.
 */
timeout = USEC_PER_SEC;
-   while (num_online_cpus() > 1 && (wait || timeout--))
+   while (num_online_cpus() > 1 && timeout--)
udelay(1);
}
-   
-   /* if the REBOOT_VECTOR didn't work, try with the NMI */
-   if ((num_online_cpus() > 1) && (!smp_no_nmi_ipi))  {
-   if (register_nmi_handler(NMI_LOCAL, smp_stop_nmi_callback,
-NMI_FLAG_FIRST, "smp_stop"))
-   /* Note: we ignore failures here */
-   /* Hope the REBOOT_IRQ is good enough */
-   goto finish;
-
-   /* sync above data before sending IRQ */
-   wmb();
 
-   pr_emerg("Shutting down cpus with NMI\n");
+   /* if the REBOOT_VECTOR didn't work, try with the NMI */
+   if (num_online_cpus() > 1) {
+   /*
+* If NMI IPI is enabled, try to register the stop handler
+* and send the IPI. In any case try to wait for the other
+* CPUs to stop.
+*/
+   if (!smp_no_nmi_ipi && !register_stop_handler()) {
+   /* Sync above data before sending IRQ */
+   wmb();
 
-   apic->send_IPI_allbutself(NMI_VECTOR);
+   pr_emerg("Shutting down cpus with NMI\n");
 
+   apic->send_IPI_allbutself(NMI_VECTOR);
+   }
/*
-* Don't wait longer than a 10 ms if the caller
-* didn't ask us to w

Re: Linux 4.9.195

2019-10-06 Thread Greg KH
diff --git a/Makefile b/Makefile
index 6e3c81c3bf40..bee0218e3fb5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 9
-SUBLEVEL = 194
+SUBLEVEL = 195
 EXTRAVERSION =
 NAME = Roaring Lionus
 
diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts 
b/arch/arm/boot/dts/exynos5420-peach-pit.dts
index ec4a00f1ce01..8b754ae8c8f7 100644
--- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
+++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts
@@ -427,6 +427,7 @@
regulator-name = "vdd_ldo10";
regulator-min-microvolt = <180>;
regulator-max-microvolt = <180>;
+   regulator-always-on;
regulator-state-mem {
regulator-off-in-suspend;
};
diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts 
b/arch/arm/boot/dts/exynos5800-peach-pi.dts
index 01f466816fea..1f90df2d7ecd 100644
--- a/arch/arm/boot/dts/exynos5800-peach-pi.dts
+++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts
@@ -427,6 +427,7 @@
regulator-name = "vdd_ldo10";
regulator-min-microvolt = <180>;
regulator-max-microvolt = <180>;
+   regulator-always-on;
regulator-state-mem {
regulator-off-in-suspend;
};
diff --git a/arch/arm/boot/dts/imx7d-cl-som-imx7.dts 
b/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
index 205130600853..72d1b8209f5e 100644
--- a/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
+++ b/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
@@ -43,7 +43,7 @@
  <&clks IMX7D_ENET1_TIME_ROOT_CLK>;
assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
assigned-clock-rates = <0>, <1>;
-   phy-mode = "rgmii";
+   phy-mode = "rgmii-id";
phy-handle = <ðphy0>;
fsl,magic-packet;
status = "okay";
@@ -69,7 +69,7 @@
  <&clks IMX7D_ENET2_TIME_ROOT_CLK>;
assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
assigned-clock-rates = <0>, <1>;
-   phy-mode = "rgmii";
+   phy-mode = "rgmii-id";
phy-handle = <ðphy1>;
fsl,magic-packet;
status = "okay";
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index 7cd9865bdeb7..94929eb707f0 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -65,7 +65,7 @@ int zynq_cpun_start(u32 address, int cpu)
* 0x4: Jump by mov instruction
* 0x8: Jumping address
*/
-   memcpy((__force void *)zero, &zynq_secondary_trampoline,
+   memcpy_toio(zero, &zynq_secondary_trampoline,
trampoline_size);
writel(address, zero + trampoline_size);
 
diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index 3ceec224d3d2..3b95e3126eeb 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -263,6 +263,15 @@ skip_pgd:
msr sctlr_el1, x18
isb
 
+   /*
+* Invalidate the local I-cache so that any instructions fetched
+* speculatively from the PoC are discarded, since they may have
+* been dynamically patched at the PoU.
+*/
+   ic  iallu
+   dsb nsh
+   isb
+
/* Set the flag to zero to indicate that we're all done */
str wzr, [flag_ptr]
ret
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index d1d945c6bd05..9fe114620b9d 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -912,8 +912,12 @@ module_finalize (const Elf_Ehdr *hdr, const Elf_Shdr 
*sechdrs, struct module *mo
 void
 module_arch_cleanup (struct module *mod)
 {
-   if (mod->arch.init_unw_table)
+   if (mod->arch.init_unw_table) {
unw_remove_unwind_table(mod->arch.init_unw_table);
-   if (mod->arch.core_unw_table)
+   mod->arch.init_unw_table = NULL;
+   }
+   if (mod->arch.core_unw_table) {
unw_remove_unwind_table(mod->arch.core_unw_table);
+   mod->arch.core_unw_table = NULL;
+   }
 }
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index 591cbdf615af..1a906dd7ca7d 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -572,6 +572,9 @@ static int xts_aes_encrypt(struct blkcipher_desc *desc,
struct s390_xts_ctx *xts_ctx = crypto_blkcipher_ctx(desc->tfm);
struct blkcipher_walk walk;
 
+   if (!nbytes)
+   return -EINVAL;
+
if (unlikely(!xts_ctx->fc))
return xts_fallback_encrypt(desc, dst, src, nbytes);
 
@@

Re: [PATCH v4 1/2] dt-bindings: soc: al-pos: Amazon's Annapurna Labs POS

2019-10-06 Thread Shenhar, Talel

thanks for the review.

On 10/4/2019 6:05 PM, Rob Herring wrote:

On Thu, Oct 3, 2019 at 6:33 AM Talel Shenhar  wrote:

Fails 'make dt_binding_check' (drop the '-'):

ack, shall be part of v5



+
+examples:
+  - |
+al_pos_edac@f0070084 {

edac@...

ack, shall be part of v5



+  compatible = "amazon,al-pos-edac";
+  reg = <0x0 0xf0070084 0x0 0x0008>;
+  interrupt-parent = <&amazon_system_fabric>;
+  interrupts = <24 IRQ_TYPE_LEVEL_HIGH>;

Not documented.


looks good?

   interrupts:

    description: Interrupt for the error event.
    maxItems: 1




Re: [PATCH 05/10] iio: imu: adis: create an unlocked version of adis_reset()

2019-10-06 Thread Jonathan Cameron
On Thu, 26 Sep 2019 14:18:07 +0300
Alexandru Ardelean  wrote:

> The reset routine may also be important to be protected by the state-lock
> and grouped with other operations, so create an unlocked version, so that
> this can be done.
> 
> Signed-off-by: Alexandru Ardelean 
Applied
> ---
>  drivers/iio/imu/adis.c   |  8 
>  include/linux/iio/imu/adis.h | 19 ++-
>  2 files changed, 22 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index e461b9ae22a5..b14101bf34b9 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -309,23 +309,23 @@ int __adis_check_status(struct adis *adis)
>  EXPORT_SYMBOL_GPL(__adis_check_status);
>  
>  /**
> - * adis_reset() - Reset the device
> + * __adis_reset() - Reset the device (unlocked version)
>   * @adis: The adis device
>   *
>   * Returns 0 on success, a negative error code otherwise
>   */
> -int adis_reset(struct adis *adis)
> +int __adis_reset(struct adis *adis)
>  {
>   int ret;
>  
> - ret = adis_write_reg_8(adis, adis->data->glob_cmd_reg,
> + ret = __adis_write_reg_8(adis, adis->data->glob_cmd_reg,
>   ADIS_GLOB_CMD_SW_RESET);
>   if (ret)
>   dev_err(&adis->spi->dev, "Failed to reset device: %d\n", ret);
>  
>   return ret;
>  }
> -EXPORT_SYMBOL_GPL(adis_reset);
> +EXPORT_SYMBOL_GPL(__adis_reset);
>  
>  static int adis_self_test(struct adis *adis)
>  {
> diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
> index f4ffba0c36b1..966af241710f 100644
> --- a/include/linux/iio/imu/adis.h
> +++ b/include/linux/iio/imu/adis.h
> @@ -73,7 +73,24 @@ struct adis {
>  
>  int adis_init(struct adis *adis, struct iio_dev *indio_dev,
>   struct spi_device *spi, const struct adis_data *data);
> -int adis_reset(struct adis *adis);
> +int __adis_reset(struct adis *adis);
> +
> +/**
> + * adis_reset() - Reset the device
> + * @adis: The adis device
> + *
> + * Returns 0 on success, a negative error code otherwise
> + */
> +static inline int adis_reset(struct adis *adis)
> +{
> + int ret;
> +
> + mutex_lock(&adis->state_lock);
> + ret = __adis_reset(adis);
> + mutex_unlock(&adis->state_lock);
> +
> + return ret;
> +}
>  
>  int __adis_write_reg(struct adis *adis, unsigned int reg,
>   unsigned int val, unsigned int size);



Linux 5.2.19

2019-10-06 Thread Greg KH
I'm announcing the release of the 5.2.19 kernel.

All users of the 5.2 kernel series must upgrade.

The updated 5.2.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-5.2.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/sound/hd-audio/models.rst |3 
 Makefile|2 
 arch/arm/boot/dts/am3517-evm.dts|   23 -
 arch/arm/boot/dts/exynos5420-peach-pit.dts  |1 
 arch/arm/boot/dts/exynos5800-peach-pi.dts   |1 
 arch/arm/boot/dts/imx7-colibri.dtsi |1 
 arch/arm/boot/dts/imx7d-cl-som-imx7.dts |4 
 arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi|   37 -
 arch/arm/configs/omap2plus_defconfig|1 
 arch/arm/mach-at91/.gitignore   |1 
 arch/arm/mach-at91/Makefile |5 
 arch/arm/mach-at91/pm_suspend.S |2 
 arch/arm/mach-ep93xx/edb93xx.c  |2 
 arch/arm/mach-ep93xx/simone.c   |2 
 arch/arm/mach-ep93xx/ts72xx.c   |4 
 arch/arm/mach-ep93xx/vision_ep9307.c|2 
 arch/arm/mach-omap2/.gitignore  |1 
 arch/arm/mach-omap2/Makefile|5 
 arch/arm/mach-omap2/sleep33xx.S |2 
 arch/arm/mach-omap2/sleep43xx.S |2 
 arch/arm/mach-zynq/platsmp.c|2 
 arch/arm/mm/copypage-xscale.c   |6 
 arch/arm/plat-samsung/watchdog-reset.c  |1 
 arch/arm64/boot/dts/rockchip/rk3328.dtsi|3 
 arch/arm64/include/asm/cputype.h|   21 -
 arch/arm64/include/asm/exception.h  |2 
 arch/arm64/include/asm/tlbflush.h   |1 
 arch/arm64/kernel/cpufeature.c  |2 
 arch/arm64/kernel/entry.S   |   36 -
 arch/arm64/kernel/image-vars.h  |   51 ++
 arch/arm64/kernel/image.h   |   42 --
 arch/arm64/kernel/traps.c   |9 
 arch/arm64/kernel/vmlinux.lds.S |2 
 arch/arm64/mm/init.c|6 
 arch/arm64/mm/proc.S|9 
 arch/ia64/kernel/module.c   |8 
 arch/m68k/include/asm/atarihw.h |9 
 arch/m68k/include/asm/io_mm.h   |6 
 arch/m68k/include/asm/macintosh.h   |1 
 arch/powerpc/Makefile   |2 
 arch/powerpc/platforms/powernv/opal-imc.c   |   12 
 arch/s390/crypto/aes_s390.c |6 
 arch/s390/include/asm/string.h  |9 
 arch/x86/include/asm/intel-family.h |3 
 arch/x86/include/asm/kvm_host.h |7 
 arch/x86/kernel/amd_nb.c|3 
 arch/x86/kernel/apic/apic.c |  115 +++--
 arch/x86/kernel/apic/vector.c   |   11 
 arch/x86/kernel/smp.c   |   46 +-
 arch/x86/kvm/emulate.c  |2 
 arch/x86/kvm/mmu.c  |   47 +-
 arch/x86/kvm/svm.c  |4 
 arch/x86/kvm/vmx/vmx.c  |6 
 arch/x86/kvm/x86.c  |   21 -
 arch/x86/mm/numa.c  |4 
 arch/x86/mm/pti.c   |8 
 arch/x86/platform/intel/iosf_mbi.c  |  100 ++--
 block/blk-flush.c   |   10 
 block/blk-mq.c  |   25 -
 block/blk-throttle.c|3 
 block/blk.h |7 
 block/mq-deadline.c |   19 
 drivers/acpi/acpi_lpss.c|8 
 drivers/acpi/acpi_processor.c   |   10 
 drivers/acpi/apei/ghes.c|   17 
 drivers/acpi/cppc_acpi.c|6 
 drivers/acpi/custom_method.c|5 
 drivers/acpi/pci_irq.c  |4 
 drivers/ata/ahci.c  |  116 +++--
 drivers/ata/ahci.h  |2 
 driv

Linux 4.14.147

2019-10-06 Thread Greg KH
I'm announcing the release of the 4.14.147 kernel.

All users of the 4.14 kernel series must upgrade.

The updated 4.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.14.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile  |6 +-
 arch/arm/boot/dts/exynos5420-peach-pit.dts|1 
 arch/arm/boot/dts/exynos5800-peach-pi.dts |1 
 arch/arm/boot/dts/imx7d-cl-som-imx7.dts   |4 -
 arch/arm/mach-zynq/platsmp.c  |2 
 arch/arm/plat-samsung/watchdog-reset.c|1 
 arch/arm64/boot/dts/rockchip/rk3328.dtsi  |3 +
 arch/arm64/kernel/cpufeature.c|5 ++
 arch/arm64/mm/proc.S  |9 
 arch/ia64/kernel/module.c |8 ++-
 arch/powerpc/include/asm/opal.h   |2 
 arch/powerpc/platforms/powernv/opal-wrappers.S|2 
 arch/powerpc/sysdev/xive/native.c |   11 
 arch/s390/crypto/aes_s390.c   |6 ++
 arch/x86/Makefile |2 
 arch/x86/kernel/apic/apic.c   |8 +++
 arch/x86/kernel/smp.c |   46 
 arch/x86/kvm/emulate.c|2 
 arch/x86/kvm/x86.c|   21 +++--
 block/blk-mq.c|2 
 block/blk-sysfs.c |3 +
 drivers/acpi/acpi_processor.c |   10 +++-
 drivers/acpi/acpi_video.c |   37 
 drivers/acpi/cppc_acpi.c  |6 +-
 drivers/acpi/custom_method.c  |5 +-
 drivers/acpi/pci_irq.c|4 +
 drivers/base/soc.c|2 
 drivers/block/nbd.c   |4 +
 drivers/bluetooth/btusb.c |3 +
 drivers/char/hw_random/core.c |2 
 drivers/char/mem.c|   21 +
 drivers/crypto/talitos.c  |1 
 drivers/devfreq/exynos-bus.c  |   31 +++--
 drivers/devfreq/governor_passive.c|7 +--
 drivers/dma/bcm2835-dma.c |4 +
 drivers/dma/edma.c|9 ++--
 drivers/dma/iop-adma.c|   18 
 drivers/edac/altera_edac.c|4 +
 drivers/edac/amd64_edac.c |   28 
 drivers/edac/edac_mc.c|8 ++-
 drivers/edac/pnd2_edac.c  |7 ++-
 drivers/firmware/efi/cper.c   |   15 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  |5 ++
 drivers/gpu/drm/drm_probe_helper.c|9 +++-
 drivers/hid/hid-lg.c  |   10 ++--
 drivers/hid/hid-lg4ff.c   |1 
 drivers/hid/hid-prodikeys.c   |   12 -
 drivers/hid/hid-sony.c|2 
 drivers/hid/hidraw.c  |2 
 drivers/hwmon/acpi_power_meter.c  |4 -
 drivers/i2c/busses/i2c-riic.c |1 
 drivers/infiniband/core/cq.c  |8 ++-
 drivers/infiniband/core/device.c  |   15 ++
 drivers/infiniband/core/mad.c |2 
 drivers/infiniband/hw/hfi1/mad.c  |   45 
 drivers/iommu/amd_iommu.c |4 +
 drivers/iommu/iova.c  |4 +
 drivers/irqchip/irq-gic-v3-its.c  |9 +---
 drivers/isdn/mISDN/socket.c   |2 
 drivers/leds/leds-lp5562.c|6 ++
 drivers/md/dm-zoned-target.c  |2 
 drivers/md/md.c   |   28 
 drivers/md/md.h   |3 +
 drivers/md/raid0.c|   33 ++
 drivers/md/raid0.h|   14 ++
 drivers/md/raid1.c|   39 +++--
 drivers/md/raid5.c|   10 +++-
 drivers/media/cec/cec-notifier.c  |2 
 drivers/media/dvb-core/dvbdev.c   |4 +
 drivers/media/i2c/ov5640.c|5 ++
 drivers/media/i2c/ov5645.c|   26 ---
 drivers/media/i2c/ov9650.c|5 ++
 drivers/media/i2c/tvp5150.c   |2 
 drive

Re: [PATCH 09/10] iio: gyro: adis16136: rework locks using ADIS library's state lock

2019-10-06 Thread Jonathan Cameron
On Thu, 26 Sep 2019 14:18:11 +0300
Alexandru Ardelean  wrote:

> This replaces indio_dev's mlock with the state lock/mutex from the ADIS
> library.
> 
> The __adis16136_get_freq() function has been prefixed to mark it as
> unlocked. The adis16136_{set,get}_filter() functions now hold the state
> lock for all the ops that they do.
> 
> Signed-off-by: Alexandru Ardelean 
Applied.

Thanks,

Jonathan

> ---
>  drivers/iio/gyro/adis16136.c | 31 +--
>  1 file changed, 21 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c
> index 5bec7ad53d8b..2d2c48f0b996 100644
> --- a/drivers/iio/gyro/adis16136.c
> +++ b/drivers/iio/gyro/adis16136.c
> @@ -185,12 +185,12 @@ static int adis16136_set_freq(struct adis16136 
> *adis16136, unsigned int freq)
>   return adis_write_reg_16(&adis16136->adis, ADIS16136_REG_SMPL_PRD, t);
>  }
>  
> -static int adis16136_get_freq(struct adis16136 *adis16136, unsigned int 
> *freq)
> +static int __adis16136_get_freq(struct adis16136 *adis16136, unsigned int 
> *freq)
>  {
>   uint16_t t;
>   int ret;
>  
> - ret = adis_read_reg_16(&adis16136->adis, ADIS16136_REG_SMPL_PRD, &t);
> + ret = __adis_read_reg_16(&adis16136->adis, ADIS16136_REG_SMPL_PRD, &t);
>   if (ret < 0)
>   return ret;
>  
> @@ -224,10 +224,13 @@ static ssize_t adis16136_read_frequency(struct device 
> *dev,
>  {
>   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>   struct adis16136 *adis16136 = iio_priv(indio_dev);
> + struct mutex *slock = &adis16136->adis.state_lock;
>   unsigned int freq;
>   int ret;
>  
> - ret = adis16136_get_freq(adis16136, &freq);
> + mutex_lock(slock);
> + ret = __adis16136_get_freq(adis16136, &freq);
> + mutex_unlock(slock);
>   if (ret < 0)
>   return ret;
>  
> @@ -252,42 +255,50 @@ static const unsigned adis16136_3db_divisors[] = {
>  static int adis16136_set_filter(struct iio_dev *indio_dev, int val)
>  {
>   struct adis16136 *adis16136 = iio_priv(indio_dev);
> + struct mutex *slock = &adis16136->adis.state_lock;
>   unsigned int freq;
>   int i, ret;
>  
> - ret = adis16136_get_freq(adis16136, &freq);
> + mutex_lock(slock);
> + ret = __adis16136_get_freq(adis16136, &freq);
>   if (ret < 0)
> - return ret;
> + goto out_unlock;
>  
>   for (i = ARRAY_SIZE(adis16136_3db_divisors) - 1; i >= 1; i--) {
>   if (freq / adis16136_3db_divisors[i] >= val)
>   break;
>   }
>  
> - return adis_write_reg_16(&adis16136->adis, ADIS16136_REG_AVG_CNT, i);
> + ret = __adis_write_reg_16(&adis16136->adis, ADIS16136_REG_AVG_CNT, i);
> +out_unlock:
> + mutex_unlock(slock);
> +
> + return ret;
>  }
>  
>  static int adis16136_get_filter(struct iio_dev *indio_dev, int *val)
>  {
>   struct adis16136 *adis16136 = iio_priv(indio_dev);
> + struct mutex *slock = &adis16136->adis.state_lock;
>   unsigned int freq;
>   uint16_t val16;
>   int ret;
>  
> - mutex_lock(&indio_dev->mlock);
> + mutex_lock(slock);
>  
> - ret = adis_read_reg_16(&adis16136->adis, ADIS16136_REG_AVG_CNT, &val16);
> + ret = __adis_read_reg_16(&adis16136->adis, ADIS16136_REG_AVG_CNT,
> +  &val16);
>   if (ret < 0)
>   goto err_unlock;
>  
> - ret = adis16136_get_freq(adis16136, &freq);
> + ret = __adis16136_get_freq(adis16136, &freq);
>   if (ret < 0)
>   goto err_unlock;
>  
>   *val = freq / adis16136_3db_divisors[val16 & 0x07];
>  
>  err_unlock:
> - mutex_unlock(&indio_dev->mlock);
> + mutex_unlock(slock);
>  
>   return ret ? ret : IIO_VAL_INT;
>  }



Linux 5.3.4

2019-10-06 Thread Greg KH
I'm announcing the release of the 5.3.4 kernel.

All users of the 5.3 kernel series must upgrade.

The updated 5.3.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-5.3.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-spdif.yaml |4 
 Documentation/sound/hd-audio/models.rst|3 
 Makefile   |2 
 arch/arm/boot/dts/am3517-evm.dts   |   23 
 arch/arm/boot/dts/exynos5420-peach-pit.dts |1 
 arch/arm/boot/dts/exynos5800-peach-pi.dts  |1 
 arch/arm/boot/dts/imx7-colibri.dtsi|1 
 arch/arm/boot/dts/imx7d-cl-som-imx7.dts|4 
 arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi   |   37 -
 arch/arm/configs/omap2plus_defconfig   |1 
 arch/arm/mach-at91/.gitignore  |1 
 arch/arm/mach-at91/Makefile|5 
 arch/arm/mach-at91/pm_suspend.S|2 
 arch/arm/mach-ep93xx/edb93xx.c |2 
 arch/arm/mach-ep93xx/simone.c  |2 
 arch/arm/mach-ep93xx/ts72xx.c  |4 
 arch/arm/mach-ep93xx/vision_ep9307.c   |2 
 arch/arm/mach-omap2/.gitignore |1 
 arch/arm/mach-omap2/Makefile   |5 
 arch/arm/mach-omap2/sleep33xx.S|2 
 arch/arm/mach-omap2/sleep43xx.S|2 
 arch/arm/mach-zynq/platsmp.c   |2 
 arch/arm/mm/copypage-xscale.c  |6 
 arch/arm/plat-samsung/watchdog-reset.c |1 
 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts   |4 
 arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts |4 
 arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts|4 
 arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi   |4 
 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts |4 
 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts|4 
 arch/arm64/boot/dts/freescale/imx8mq.dtsi  |5 
 arch/arm64/boot/dts/qcom/qcs404-evb.dtsi   |4 
 arch/arm64/boot/dts/rockchip/rk3328.dtsi   |3 
 arch/arm64/include/asm/atomic_ll_sc.h  |   89 
+-
 arch/arm64/include/asm/cputype.h   |   21 
 arch/arm64/include/asm/exception.h |2 
 arch/arm64/include/asm/tlbflush.h  |1 
 arch/arm64/kernel/cpufeature.c |2 
 arch/arm64/kernel/entry.S  |   36 -
 arch/arm64/kernel/image-vars.h |   51 +
 arch/arm64/kernel/image.h  |   42 -
 arch/arm64/kernel/traps.c  |9 
 arch/arm64/kernel/vmlinux.lds.S|2 
 arch/arm64/mm/init.c   |6 
 arch/arm64/mm/proc.S   |9 
 arch/ia64/kernel/module.c  |8 
 arch/m68k/include/asm/atarihw.h|9 
 arch/m68k/include/asm/io_mm.h  |6 
 arch/m68k/include/asm/macintosh.h  |1 
 arch/powerpc/Makefile  |2 
 arch/powerpc/platforms/powernv/opal-imc.c  |   12 
 arch/s390/crypto/aes_s390.c|6 
 arch/s390/include/asm/string.h |9 
 arch/x86/include/asm/intel-family.h|3 
 arch/x86/include/asm/kvm_host.h|7 
 arch/x86/kernel/amd_nb.c   |3 
 arch/x86/kernel/apic/apic.c|  115 
++-
 arch/x86/ker

Re: [PATCH 10/10] iio: imu: adis16480: use state lock for filter freq set

2019-10-06 Thread Jonathan Cameron
On Thu, 26 Sep 2019 14:18:12 +0300
Alexandru Ardelean  wrote:

> It's the only operation that does 2 operations (a read & a write), so the
> unlocked functions can be used under a single state lock.
> 
> Signed-off-by: Alexandru Ardelean 
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/imu/adis16480.c | 13 ++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
> index dc13d8a33612..01dae50e985b 100644
> --- a/drivers/iio/imu/adis16480.c
> +++ b/drivers/iio/imu/adis16480.c
> @@ -550,6 +550,7 @@ static int adis16480_set_filter_freq(struct iio_dev 
> *indio_dev,
>   const struct iio_chan_spec *chan, unsigned int freq)
>  {
>   struct adis16480 *st = iio_priv(indio_dev);
> + struct mutex *slock = &st->adis.state_lock;
>   unsigned int enable_mask, offset, reg;
>   unsigned int diff, best_diff;
>   unsigned int i, best_freq;
> @@ -560,9 +561,11 @@ static int adis16480_set_filter_freq(struct iio_dev 
> *indio_dev,
>   offset = ad16480_filter_data[chan->scan_index][1];
>   enable_mask = BIT(offset + 2);
>  
> - ret = adis_read_reg_16(&st->adis, reg, &val);
> + mutex_lock(slock);
> +
> + ret = __adis_read_reg_16(&st->adis, reg, &val);
>   if (ret < 0)
> - return ret;
> + goto out_unlock;
>  
>   if (freq == 0) {
>   val &= ~enable_mask;
> @@ -584,7 +587,11 @@ static int adis16480_set_filter_freq(struct iio_dev 
> *indio_dev,
>   val |= enable_mask;
>   }
>  
> - return adis_write_reg_16(&st->adis, reg, val);
> + ret = __adis_write_reg_16(&st->adis, reg, val);
> +out_unlock:
> + mutex_unlock(slock);
> +
> + return ret;
>  }
>  
>  static int adis16480_read_raw(struct iio_dev *indio_dev,



Re: [PATCH] iio: adc: sc27xx: Use devm_hwspin_lock_request_specific() to simplify code

2019-10-06 Thread Jonathan Cameron
On Fri, 27 Sep 2019 10:41:19 +0800
Baolin Wang  wrote:

> Change to use devm_hwspin_lock_request_specific() to help to simplify the
> cleanup code for drivers requesting one hwlock.
> 
> Signed-off-by: Baolin Wang 
Applied to the togreg branch of iio.git and pushed out as testing for the
autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/sc27xx_adc.c |   16 +---
>  1 file changed, 1 insertion(+), 15 deletions(-)
> 
> diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
> index a6c0465..66b387f 100644
> --- a/drivers/iio/adc/sc27xx_adc.c
> +++ b/drivers/iio/adc/sc27xx_adc.c
> @@ -477,13 +477,6 @@ static void sc27xx_adc_disable(void *_data)
>  SC27XX_MODULE_ADC_EN, 0);
>  }
>  
> -static void sc27xx_adc_free_hwlock(void *_data)
> -{
> - struct hwspinlock *hwlock = _data;
> -
> - hwspin_lock_free(hwlock);
> -}
> -
>  static int sc27xx_adc_probe(struct platform_device *pdev)
>  {
>   struct device *dev = &pdev->dev;
> @@ -520,19 +513,12 @@ static int sc27xx_adc_probe(struct platform_device 
> *pdev)
>   return ret;
>   }
>  
> - sc27xx_data->hwlock = hwspin_lock_request_specific(ret);
> + sc27xx_data->hwlock = devm_hwspin_lock_request_specific(dev, ret);
>   if (!sc27xx_data->hwlock) {
>   dev_err(dev, "failed to request hwspinlock\n");
>   return -ENXIO;
>   }
>  
> - ret = devm_add_action_or_reset(dev, sc27xx_adc_free_hwlock,
> -   sc27xx_data->hwlock);
> - if (ret) {
> - dev_err(dev, "failed to add hwspinlock action\n");
> - return ret;
> - }
> -
>   sc27xx_data->dev = dev;
>  
>   ret = sc27xx_adc_enable(sc27xx_data);



Question about using #ifdef CONFIG_PPC64 in driver code

2019-10-06 Thread Oded Gabbay
Hi Greg,
a while ago we had an argument about identifying in my driver's code
whether I'm running on x86 or powerpc. I tried to do something
dynamically (based on parent pci bridge ID), and you and other people
objected to it.

I see in other drivers (more then a few) that they are using #ifdef
CONFIG_PPC64 in some places for similar things (e.g. to run code that
is only needed in case of powerpc).

e.g. from ocxl driver in misc:

#ifdef CONFIG_PPC64
static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx,
...
#endif
and also:

#ifdef CONFIG_PPC64
if (cpu_has_feature(CPU_FTR_P9_TIDR))
arg.flags[0] |= OCXL_IOCTL_FEATURES_FLAGS0_P9_WAIT;
#endif

Is this approach acceptable on you ?
Can I do something similar in my driver:

#ifdef CONFIG_PPC64
  foo (64)
#else
  foo (48)
#endif

Thanks,
Oded


Re: [PATCH 1/4] iio: pressure: bmp280: use bulk regulator ops

2019-10-06 Thread Jonathan Cameron
On Wed, 2 Oct 2019 17:57:30 +0200
Bartosz Golaszewski  wrote:

> śr., 2 paź 2019 o 15:06 kbuild test robot  napisał(a):
> >
> > Hi Bartosz,
> >
> > I love your patch! Yet something to improve:
> >
> > [auto build test ERROR on iio/togreg]
> > [cannot apply to v5.4-rc1 next-20191002]
> > [if your patch is applied to the wrong git tree, please drop us a note to 
> > help
> > improve the system. BTW, we also suggest to use '--base' option to specify 
> > the
> > base tree in git format-patch, please see 
> > https://stackoverflow.com/a/37406982]
> >
> > url:
> > https://github.com/0day-ci/linux/commits/Bartosz-Golaszewski/iio-pressure-bmp280-code-shrink/20191002-194508
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
> > config: sh-allmodconfig (attached as .config)
> > compiler: sh4-linux-gcc (GCC) 7.4.0
> > reproduce:
> > wget 
> > https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
> > ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # save the attached .config to linux build tree
> > GCC_VERSION=7.4.0 make.cross ARCH=sh
> >
> > If you fix the issue, kindly add following tag
> > Reported-by: kbuild test robot 
> >
> > All errors (new ones prefixed by >>):
> >
> >drivers/iio/pressure/bmp280-core.c: In function 'bmp280_common_probe':  
> > >> drivers/iio/pressure/bmp280-core.c:1041:2: error: implicit declaration 
> > >> of function 'regulator_bulk_set_supply_names'; did you mean 
> > >> 'regulator_bulk_register_supply_alias'? 
> > >> [-Werror=implicit-function-declaration]  
> >  regulator_bulk_set_supply_names(data->supplies,
> >  ^~~
> >  regulator_bulk_register_supply_alias
> >cc1: some warnings being treated as errors
> >  
> 
> This function has been introduced in commit d0087e72710c ("regulator:
> provide regulator_bulk_set_supply_names()") and released in v5.4-rc1
> but it's not present in this tree. In other words: a false positive.
Kind of handy to known though ;)  My tree doesn't contain it yet
either.  That should be fixed later this week after a pull request
and rebase.  I'll not be applying this series until after that.

Thanks,

Jonathan

> 
> Bart
> 
> > vim +1041 drivers/iio/pressure/bmp280-core.c
> >
> >986
> >987  int bmp280_common_probe(struct device *dev,
> >988  struct regmap *regmap,
> >989  unsigned int chip,
> >990  const char *name,
> >991  int irq)
> >992  {
> >993  int ret;
> >994  struct iio_dev *indio_dev;
> >995  struct bmp280_data *data;
> >996  unsigned int chip_id;
> >997  struct gpio_desc *gpiod;
> >998
> >999  indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
> >   1000  if (!indio_dev)
> >   1001  return -ENOMEM;
> >   1002
> >   1003  data = iio_priv(indio_dev);
> >   1004  mutex_init(&data->lock);
> >   1005  data->dev = dev;
> >   1006
> >   1007  indio_dev->dev.parent = dev;
> >   1008  indio_dev->name = name;
> >   1009  indio_dev->channels = bmp280_channels;
> >   1010  indio_dev->info = &bmp280_info;
> >   1011  indio_dev->modes = INDIO_DIRECT_MODE;
> >   1012
> >   1013  switch (chip) {
> >   1014  case BMP180_CHIP_ID:
> >   1015  indio_dev->num_channels = 2;
> >   1016  data->chip_info = &bmp180_chip_info;
> >   1017  data->oversampling_press = ilog2(8);
> >   1018  data->oversampling_temp = ilog2(1);
> >   1019  data->start_up_time = 1;
> >   1020  break;
> >   1021  case BMP280_CHIP_ID:
> >   1022  indio_dev->num_channels = 2;
> >   1023  data->chip_info = &bmp280_chip_info;
> >   1024  data->oversampling_press = ilog2(16);
> >   1025  data->oversampling_temp = ilog2(2);
> >   1026  data->start_up_time = 2000;
> >   1027  break;
> >   1028  case BME280_CHIP_ID:
> >   1029  indio_dev->num_channels = 3;
> >   1030  data->chip_info = &bme280_chip_info;
> >   1031  data->oversampling_press = ilog2(16);
> >   1032  data->oversampling_humid = ilog2(16);
> >   1033  data->oversampling_temp = ilog2(2);
> >   1034  data->start_up_time = 2000;
> >   1035  break;
> >   1036  default:
> >   1037  return -EINVAL;
> >   1038  }
> >   1039
> >   1040  /* Bring up regulators */  
> > > 1041  regulator_bulk_set_supply_names(data->supplies,  
> >   1042  bmp280_supply_names,
> >   1043  BMP280

Re: [PATCH 1/4] iio: pressure: bmp280: use bulk regulator ops

2019-10-06 Thread Jonathan Cameron
On Wed,  2 Oct 2019 10:57:56 +0200
Bartosz Golaszewski  wrote:

> From: Bartosz Golaszewski 
> 
> The vddd and vdda supplies are always operated on together. We can
> shrink the code a bit by using the bulk regulator helpers.
> 
> Signed-off-by: Bartosz Golaszewski 
Looks good. Will pick up once I have the precursors in my branch.

Thanks,

Jonathan

> ---
>  drivers/iio/pressure/bmp280-core.c | 69 +-
>  1 file changed, 30 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/iio/pressure/bmp280-core.c 
> b/drivers/iio/pressure/bmp280-core.c
> index 8d0f15f27dc5..c21f8ce7b09c 100644
> --- a/drivers/iio/pressure/bmp280-core.c
> +++ b/drivers/iio/pressure/bmp280-core.c
> @@ -74,6 +74,12 @@ struct bmp280_calib {
>   s8  H6;
>  };
>  
> +static const char *const bmp280_supply_names[] = {
> + "vddd", "vdda"
> +};
> +
> +#define BMP280_NUM_SUPPLIES ARRAY_SIZE(bmp280_supply_names)
> +
>  struct bmp280_data {
>   struct device *dev;
>   struct mutex lock;
> @@ -85,8 +91,7 @@ struct bmp280_data {
>   struct bmp180_calib bmp180;
>   struct bmp280_calib bmp280;
>   } calib;
> - struct regulator *vddd;
> - struct regulator *vdda;
> + struct regulator_bulk_data supplies[BMP280_NUM_SUPPLIES];
>   unsigned int start_up_time; /* in microseconds */
>  
>   /* log of base 2 of oversampling rate */
> @@ -1033,27 +1038,23 @@ int bmp280_common_probe(struct device *dev,
>   }
>  
>   /* Bring up regulators */
> - data->vddd = devm_regulator_get(dev, "vddd");
> - if (IS_ERR(data->vddd)) {
> - dev_err(dev, "failed to get VDDD regulator\n");
> - return PTR_ERR(data->vddd);
> - }
> - ret = regulator_enable(data->vddd);
> + regulator_bulk_set_supply_names(data->supplies,
> + bmp280_supply_names,
> + BMP280_NUM_SUPPLIES);
> +
> + ret = devm_regulator_bulk_get(dev,
> +   BMP280_NUM_SUPPLIES, data->supplies);
>   if (ret) {
> - dev_err(dev, "failed to enable VDDD regulator\n");
> + dev_err(dev, "failed to get regulators\n");
>   return ret;
>   }
> - data->vdda = devm_regulator_get(dev, "vdda");
> - if (IS_ERR(data->vdda)) {
> - dev_err(dev, "failed to get VDDA regulator\n");
> - ret = PTR_ERR(data->vdda);
> - goto out_disable_vddd;
> - }
> - ret = regulator_enable(data->vdda);
> +
> + ret = regulator_bulk_enable(BMP280_NUM_SUPPLIES, data->supplies);
>   if (ret) {
> - dev_err(dev, "failed to enable VDDA regulator\n");
> - goto out_disable_vddd;
> + dev_err(dev, "failed to enable regulators\n");
> + return ret;
>   }
> +
>   /* Wait to make sure we started up properly */
>   usleep_range(data->start_up_time, data->start_up_time + 100);
>  
> @@ -1068,17 +1069,17 @@ int bmp280_common_probe(struct device *dev,
>   data->regmap = regmap;
>   ret = regmap_read(regmap, BMP280_REG_ID, &chip_id);
>   if (ret < 0)
> - goto out_disable_vdda;
> + goto out_disable_regulators;
>   if (chip_id != chip) {
>   dev_err(dev, "bad chip id: expected %x got %x\n",
>   chip, chip_id);
>   ret = -EINVAL;
> - goto out_disable_vdda;
> + goto out_disable_regulators;
>   }
>  
>   ret = data->chip_info->chip_config(data);
>   if (ret < 0)
> - goto out_disable_vdda;
> + goto out_disable_regulators;
>  
>   dev_set_drvdata(dev, indio_dev);
>  
> @@ -1092,14 +1093,14 @@ int bmp280_common_probe(struct device *dev,
>   if (ret < 0) {
>   dev_err(data->dev,
>   "failed to read calibration coefficients\n");
> - goto out_disable_vdda;
> + goto out_disable_regulators;
>   }
>   } else if (chip_id == BMP280_CHIP_ID || chip_id == BME280_CHIP_ID) {
>   ret = bmp280_read_calib(data, &data->calib.bmp280, chip_id);
>   if (ret < 0) {
>   dev_err(data->dev,
>   "failed to read calibration coefficients\n");
> - goto out_disable_vdda;
> + goto out_disable_regulators;
>   }
>   }
>  
> @@ -,7 +1112,7 @@ int bmp280_common_probe(struct device *dev,
>   if (irq > 0 || (chip_id  == BMP180_CHIP_ID)) {
>   ret = bmp085_fetch_eoc_irq(dev, name, irq, data);
>   if (ret)
> - goto out_disable_vdda;
> + goto out_disable_regulators;
>   }
>  
>   /* Enable runtime PM */
> @@ -1137,10 +1138,8 @@ int bmp280_common_probe(struct device *dev,
>   pm_runtime_get_sync(data->dev);
>   pm_runtime_put_noidle(data->dev);

Re: [PATCH] staging: greybus: add blank line after declarations

2019-10-06 Thread Greg KH
On Sat, Oct 05, 2019 at 06:00:46PM -0300, Gabriela Bittencourt wrote:
> Fix CHECK: add blank line after declarations
> 
> Signed-off-by: Gabriela Bittencourt 
> ---
>  drivers/staging/greybus/control.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/greybus/control.h 
> b/drivers/staging/greybus/control.h
> index 3a29ec05f631..5a45d55349a1 100644
> --- a/drivers/staging/greybus/control.h
> +++ b/drivers/staging/greybus/control.h
> @@ -24,6 +24,7 @@ struct gb_control {
>   char *vendor_string;
>   char *product_string;
>  };
> +
>  #define to_gb_control(d) container_of(d, struct gb_control, dev)

No, the original code is "better" here, it's a common pattern despite
what checkpatch.pl tells you, sorry.

thanks,

greg k-h


Re: [PATCH 2/4] iio: pressure: bmp280: use devm_iio_device_register()

2019-10-06 Thread Jonathan Cameron
On Wed,  2 Oct 2019 10:57:57 +0200
Bartosz Golaszewski  wrote:

> From: Bartosz Golaszewski 
> 
> We can use the managed variant of iio_device_register() and remove
> the corresponding unregister operation from the remove callback.
> 
> Signed-off-by: Bartosz Golaszewski 

This results in a race where the regulators are powered down before
we remove the userspace interfaces.  All sorts of fun can therefore
occur...

If we fix that with some devm_add_action_or_reset fun then there
is still the fact that we loose the 'obviously correct' property
of the remove being a mirror of the probe because the ordering
wrt to runtime_pm is different.  

So I'd leave this one alone.

Thanks,

Jonathan


> ---
>  drivers/iio/pressure/bmp280-core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/pressure/bmp280-core.c 
> b/drivers/iio/pressure/bmp280-core.c
> index c21f8ce7b09c..f22400e1e98f 100644
> --- a/drivers/iio/pressure/bmp280-core.c
> +++ b/drivers/iio/pressure/bmp280-core.c
> @@ -1127,7 +1127,7 @@ int bmp280_common_probe(struct device *dev,
>   pm_runtime_use_autosuspend(dev);
>   pm_runtime_put(dev);
>  
> - ret = iio_device_register(indio_dev);
> + ret = devm_iio_device_register(dev, indio_dev);
>   if (ret)
>   goto out_runtime_pm_disable;
>  
> @@ -1149,7 +1149,6 @@ int bmp280_common_remove(struct device *dev)
>   struct iio_dev *indio_dev = dev_get_drvdata(dev);
>   struct bmp280_data *data = iio_priv(indio_dev);
>  
> - iio_device_unregister(indio_dev);
>   pm_runtime_get_sync(data->dev);
>   pm_runtime_put_noidle(data->dev);
>   pm_runtime_disable(data->dev);



Re: [PATCH 3/4] iio: pressure: bmp280: remove stray newline

2019-10-06 Thread Jonathan Cameron
On Wed,  2 Oct 2019 10:57:58 +0200
Bartosz Golaszewski  wrote:

> From: Bartosz Golaszewski 
> 
> Remove a stray newline from the probe callback.
> 
> Signed-off-by: Bartosz Golaszewski 
Applied to the togreg branch of iio.git and pushed out as testing for
no particular reason (well for the other patches in that tree ;)

Thanks,

Jonathan

> ---
>  drivers/iio/pressure/bmp280-core.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/iio/pressure/bmp280-core.c 
> b/drivers/iio/pressure/bmp280-core.c
> index f22400e1e98f..fdbd3bc27921 100644
> --- a/drivers/iio/pressure/bmp280-core.c
> +++ b/drivers/iio/pressure/bmp280-core.c
> @@ -1131,7 +1131,6 @@ int bmp280_common_probe(struct device *dev,
>   if (ret)
>   goto out_runtime_pm_disable;
>  
> -
>   return 0;
>  
>  out_runtime_pm_disable:



Re: [alsa-devel] [PATCH -next] ASoc: tas2770: Fix build error without GPIOLIB

2019-10-06 Thread Ladislav Michl
Dear YueHaibing,

On Sun, Oct 06, 2019 at 03:22:41PM +0800, YueHaibing wrote:
> If GPIOLIB is not set, building fails:
> 
> sound/soc/codecs/tas2770.c: In function tas2770_reset:
> sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function 
> gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? 
> [-Werror=implicit-function-declaration]
>gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
>^~~~
>gpio_set_value_cansleep
> sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
> sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function 
> devm_gpiod_get_optional; did you mean devm_regulator_get_optional? 
> [-Werror=implicit-function-declaration]
>   tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
> ^~~
> devm_regulator_get_optional
> sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first 
> use in this function); did you mean GPIOF_INIT_HIGH?
>  GPIOD_OUT_HIGH);
>  ^~
>  GPIOF_INIT_HIGH
> 
> Reported-by: Hulk Robot 
> Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
> Signed-off-by: YueHaibing 
> ---
>  sound/soc/codecs/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
> index bcac957..d639f17 100644
> --- a/sound/soc/codecs/Kconfig
> +++ b/sound/soc/codecs/Kconfig
> @@ -1108,6 +1108,7 @@ config SND_SOC_TAS2552
>  config SND_SOC_TAS2770
>   tristate "Texas Instruments TAS2770 speaker amplifier"
>   depends on I2C
> + select GPIOLIB

GPIOLIB API is working perfectly fine even if GPIOLIB is not selected
and gpiod_* functions will merely return -ENOSYS in this case.
Please see  and fix your patch accordingly.

>  config SND_SOC_TAS5086
>   tristate "Texas Instruments TAS5086 speaker amplifier"
> -- 
> 2.7.4
> 
> 
> ___
> Alsa-devel mailing list
> alsa-de...@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel


Re: [PATCH 4/4] iio: pressure: bmp280: use devm action and remove labels from probe

2019-10-06 Thread Jonathan Cameron
On Wed,  2 Oct 2019 10:57:59 +0200
Bartosz Golaszewski  wrote:

> From: Bartosz Golaszewski 
> 
> We can drop some duplicate code if we use devm_action for disabling
> regulators and pm. This allows us to completely remove all remove()
> callbacks from both i2c and spi code.
> 
> Signed-off-by: Bartosz Golaszewski 
Ah. I should read all the patches but that would be far too much like hard
work.  Roll this one and patch 2 together and we should have satisfied the
issues I had with that.

Thanks,

Jonathan

> ---
>  drivers/iio/pressure/bmp280-core.c | 61 +++---
>  drivers/iio/pressure/bmp280-i2c.c  |  6 ---
>  drivers/iio/pressure/bmp280-spi.c  |  6 ---
>  drivers/iio/pressure/bmp280.h  |  1 -
>  4 files changed, 30 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/iio/pressure/bmp280-core.c 
> b/drivers/iio/pressure/bmp280-core.c
> index fdbd3bc27921..79254dd26dfd 100644
> --- a/drivers/iio/pressure/bmp280-core.c
> +++ b/drivers/iio/pressure/bmp280-core.c
> @@ -984,6 +984,22 @@ static int bmp085_fetch_eoc_irq(struct device *dev,
>   return 0;
>  }
>  
> +static void bmp280_pm_disable(void *data)
> +{
> + struct device *dev = data;
> +
> + pm_runtime_get_sync(dev);
> + pm_runtime_put_noidle(dev);
> + pm_runtime_disable(dev);
> +}
> +
> +static void bmp280_regulators_disable(void *data)
> +{
> + struct regulator_bulk_data *supplies = data;
> +
> + regulator_bulk_disable(BMP280_NUM_SUPPLIES, supplies);
> +}
> +
>  int bmp280_common_probe(struct device *dev,
>   struct regmap *regmap,
>   unsigned int chip,
> @@ -1055,6 +1071,11 @@ int bmp280_common_probe(struct device *dev,
>   return ret;
>   }
>  
> + ret = devm_add_action_or_reset(dev, bmp280_regulators_disable,
> +data->supplies);
> + if (ret)
> + return ret;
> +
>   /* Wait to make sure we started up properly */
>   usleep_range(data->start_up_time, data->start_up_time + 100);
>  
> @@ -1069,17 +1090,16 @@ int bmp280_common_probe(struct device *dev,
>   data->regmap = regmap;
>   ret = regmap_read(regmap, BMP280_REG_ID, &chip_id);
>   if (ret < 0)
> - goto out_disable_regulators;
> + return ret;
>   if (chip_id != chip) {
>   dev_err(dev, "bad chip id: expected %x got %x\n",
>   chip, chip_id);
> - ret = -EINVAL;
> - goto out_disable_regulators;
> + return -EINVAL;
>   }
>  
>   ret = data->chip_info->chip_config(data);
>   if (ret < 0)
> - goto out_disable_regulators;
> + return ret;
>  
>   dev_set_drvdata(dev, indio_dev);
>  
> @@ -1093,14 +1113,14 @@ int bmp280_common_probe(struct device *dev,
>   if (ret < 0) {
>   dev_err(data->dev,
>   "failed to read calibration coefficients\n");
> - goto out_disable_regulators;
> + return ret;
>   }
>   } else if (chip_id == BMP280_CHIP_ID || chip_id == BME280_CHIP_ID) {
>   ret = bmp280_read_calib(data, &data->calib.bmp280, chip_id);
>   if (ret < 0) {
>   dev_err(data->dev,
>   "failed to read calibration coefficients\n");
> - goto out_disable_regulators;
> + return ret;
>   }
>   }
>  
> @@ -1112,7 +1132,7 @@ int bmp280_common_probe(struct device *dev,
>   if (irq > 0 || (chip_id  == BMP180_CHIP_ID)) {
>   ret = bmp085_fetch_eoc_irq(dev, name, irq, data);
>   if (ret)
> - goto out_disable_regulators;
> + return ret;
>   }
>  
>   /* Enable runtime PM */
> @@ -1127,35 +1147,14 @@ int bmp280_common_probe(struct device *dev,
>   pm_runtime_use_autosuspend(dev);
>   pm_runtime_put(dev);
>  
> - ret = devm_iio_device_register(dev, indio_dev);
> + ret = devm_add_action_or_reset(dev, bmp280_pm_disable, dev);
>   if (ret)
> - goto out_runtime_pm_disable;
> -
> - return 0;
> + return ret;
>  
> -out_runtime_pm_disable:
> - pm_runtime_get_sync(data->dev);
> - pm_runtime_put_noidle(data->dev);
> - pm_runtime_disable(data->dev);
> -out_disable_regulators:
> - regulator_bulk_disable(BMP280_NUM_SUPPLIES, data->supplies);
> - return ret;
> + return devm_iio_device_register(dev, indio_dev);
>  }
>  EXPORT_SYMBOL(bmp280_common_probe);
>  
> -int bmp280_common_remove(struct device *dev)
> -{
> - struct iio_dev *indio_dev = dev_get_drvdata(dev);
> - struct bmp280_data *data = iio_priv(indio_dev);
> -
> - pm_runtime_get_sync(data->dev);
> - pm_runtime_put_noidle(data->dev);
> - pm_runtime_disable(data->dev);
> - regulator_bulk_disable(BMP280_NUM_SUPPLIES, data->supplies);
> - return 0;
> -}
>

Re: [PATCH] taskstats: fix data-race

2019-10-06 Thread Dmitry Vyukov
On Sat, Oct 5, 2019 at 1:28 PM Christian Brauner
 wrote:
>
> When assiging and testing taskstats in taskstats
> taskstats_exit() there's a race around writing and reading sig->stats.
>
> cpu0:
> task calls exit()
> do_exit()
> -> taskstats_exit()
> -> taskstats_tgid_alloc()
> The task takes sighand lock and assigns new stats to sig->stats.
>
> cpu1:
> task catches signal
> do_exit()
> -> taskstats_tgid_alloc()
> -> taskstats_exit()
> The tasks reads sig->stats __without__ holding sighand lock seeing
> garbage.
>
> Fix this by taking sighand lock when reading sig->stats.
>
> Reported-by: syzbot+c5d03165a1bd1dead...@syzkaller.appspotmail.com
> Signed-off-by: Christian Brauner 
> ---
>  kernel/taskstats.c | 28 +---
>  1 file changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/kernel/taskstats.c b/kernel/taskstats.c
> index 13a0f2e6ebc2..58b145234c4a 100644
> --- a/kernel/taskstats.c
> +++ b/kernel/taskstats.c
> @@ -553,26 +553,32 @@ static int taskstats_user_cmd(struct sk_buff *skb, 
> struct genl_info *info)
>
>  static struct taskstats *taskstats_tgid_alloc(struct task_struct *tsk)
>  {
> +   int empty;
> +   struct taskstats *stats_new, *stats = NULL;
> struct signal_struct *sig = tsk->signal;
> -   struct taskstats *stats;
> -
> -   if (sig->stats || thread_group_empty(tsk))
> -   goto ret;
>
> /* No problem if kmem_cache_zalloc() fails */
> -   stats = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL);
> +   stats_new = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL);

This seems to be over-pessimistic wrt performance b/c:
1. We always allocate the object and free it on every call, even if
the stats are already allocated, whereas currently we don't.
2. We always allocate the object and free it if thread_group_empty,
whereas currently we don't.
3. We do lock/unlock on every call.

I would suggest to fix the double-checked locking properly.
Locking is not the only correct way to synchronize things. Lock-free
synchronization is also possible. It's more tricky, but it can be
correct and it's supported by KCSAN/KTSAN. It just needs to be
properly implemented and expressed. For some cases we may decide to
switch to locking instead, but it needs to be an explicit decision.

We can fix the current code by doing READ_ONCE on sig->stats (which
implies smp_read_barrier_depends since 4.15), and storing to it with
smp_store_release.

> +   empty = thread_group_empty(tsk);
>
> spin_lock_irq(&tsk->sighand->siglock);
> +   if (sig->stats || empty) {
> +   stats = sig->stats;
> +   spin_unlock_irq(&tsk->sighand->siglock);
> +   goto free_cache;
> +   }
> +
> if (!sig->stats) {
> -   sig->stats = stats;
> -   stats = NULL;
> +   sig->stats = stats_new;
> +   spin_unlock_irq(&tsk->sighand->siglock);
> +   return stats_new;
> }
> spin_unlock_irq(&tsk->sighand->siglock);
>
> -   if (stats)
> -   kmem_cache_free(taskstats_cache, stats);
> -ret:
> -   return sig->stats;
> +free_cache:
> +   kmem_cache_free(taskstats_cache, stats_new);
> +   return stats;
>  }
>
>  /* Send pid data out on exit */
> --
> 2.23.0
>
> --
> You received this message because you are subscribed to the Google Groups 
> "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to syzkaller-bugs+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/syzkaller-bugs/20191005112806.13960-1-christian.brauner%40ubuntu.com.


Re: [PATCH 1/4] dt-bindings: samsung: Indent examples with four spaces

2019-10-06 Thread Jonathan Cameron
On Wed,  2 Oct 2019 18:07:41 +0200
Krzysztof Kozlowski  wrote:

> Change the indentation of examples used in json-schema bindings from two
> to four spaces as this makes the code easier to read and seems to be
> preferred in other files.
> 

I'm assuming Rob will pick these up given they span multiple subsystems.

> Signed-off-by: Krzysztof Kozlowski 

Acked-by: Jonathan Cameron  # for iio

> ---
>  .../bindings/arm/samsung/exynos-chipid.yaml   |  4 +-
>  .../bindings/iio/adc/samsung,exynos-adc.yaml  | 64 +--
>  .../bindings/power/reset/syscon-poweroff.yaml |  8 +--
>  .../bindings/power/reset/syscon-reboot.yaml   |  8 +--
>  .../devicetree/bindings/rtc/s3c-rtc.yaml  | 12 ++--
>  5 files changed, 48 insertions(+), 48 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-chipid.yaml 
> b/Documentation/devicetree/bindings/arm/samsung/exynos-chipid.yaml
> index 9c573ad7dc7d..ce40adabb4e8 100644
> --- a/Documentation/devicetree/bindings/arm/samsung/exynos-chipid.yaml
> +++ b/Documentation/devicetree/bindings/arm/samsung/exynos-chipid.yaml
> @@ -20,6 +20,6 @@ properties:
>  examples:
>- |
>  chipid@1000 {
> -  compatible = "samsung,exynos4210-chipid";
> -  reg = <0x1000 0x100>;
> +compatible = "samsung,exynos4210-chipid";
> +reg = <0x1000 0x100>;
>  };
> diff --git 
> a/Documentation/devicetree/bindings/iio/adc/samsung,exynos-adc.yaml 
> b/Documentation/devicetree/bindings/iio/adc/samsung,exynos-adc.yaml
> index b4c6c26681d9..a0a9b909ac40 100644
> --- a/Documentation/devicetree/bindings/iio/adc/samsung,exynos-adc.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/samsung,exynos-adc.yaml
> @@ -112,40 +112,40 @@ allOf:
>  examples:
>- |
>  adc: adc@12d1 {
> -  compatible = "samsung,exynos-adc-v1";
> -  reg = <0x12d1 0x100>;
> -  interrupts = <0 106 0>;
> -  #io-channel-cells = <1>;
> -  io-channel-ranges;
> -
> -  clocks = <&clock 303>;
> -  clock-names = "adc";
> -
> -  vdd-supply = <&buck5_reg>;
> -  samsung,syscon-phandle = <&pmu_system_controller>;
> -
> -  /* NTC thermistor is a hwmon device */
> -  ncp15wb473@0 {
> -compatible = "murata,ncp15wb473";
> -pullup-uv = <180>;
> -pullup-ohm = <47000>;
> -pulldown-ohm = <0>;
> -io-channels = <&adc 4>;
> -  };
> +compatible = "samsung,exynos-adc-v1";
> +reg = <0x12d1 0x100>;
> +interrupts = <0 106 0>;
> +#io-channel-cells = <1>;
> +io-channel-ranges;
> +
> +clocks = <&clock 303>;
> +clock-names = "adc";
> +
> +vdd-supply = <&buck5_reg>;
> +samsung,syscon-phandle = <&pmu_system_controller>;
> +
> +/* NTC thermistor is a hwmon device */
> +ncp15wb473@0 {
> +compatible = "murata,ncp15wb473";
> +pullup-uv = <180>;
> +pullup-ohm = <47000>;
> +pulldown-ohm = <0>;
> +io-channels = <&adc 4>;
> +  };
>  };
>  
>- |
>  adc@126c {
> -  compatible = "samsung,exynos3250-adc";
> -  reg = <0x126C 0x100>;
> -  interrupts = <0 137 0>;
> -  #io-channel-cells = <1>;
> -  io-channel-ranges;
> -
> -  clocks = <&cmu 0>, // CLK_TSADC
> -   <&cmu 1>; // CLK_SCLK_TSADC
> -  clock-names = "adc", "sclk";
> -
> -  vdd-supply = <&buck5_reg>;
> -  samsung,syscon-phandle = <&pmu_system_controller>;
> +compatible = "samsung,exynos3250-adc";
> +reg = <0x126C 0x100>;
> +interrupts = <0 137 0>;
> +#io-channel-cells = <1>;
> +io-channel-ranges;
> +
> +clocks = <&cmu 0>, // CLK_TSADC
> + <&cmu 1>; // CLK_SCLK_TSADC
> +clock-names = "adc", "sclk";
> +
> +vdd-supply = <&buck5_reg>;
> +samsung,syscon-phandle = <&pmu_system_controller>;
>  };
> diff --git 
> a/Documentation/devicetree/bindings/power/reset/syscon-poweroff.yaml 
> b/Documentation/devicetree/bindings/power/reset/syscon-poweroff.yaml
> index fb812937b534..520e07e6f21b 100644
> --- a/Documentation/devicetree/bindings/power/reset/syscon-poweroff.yaml
> +++ b/Documentation/devicetree/bindings/power/reset/syscon-poweroff.yaml
> @@ -53,8 +53,8 @@ allOf:
>  examples:
>- |
>  poweroff {
> -  compatible = "syscon-poweroff";
> -  regmap = <®mapnode>;
> -  offset = <0x0>;
> -  mask = <0x7a>;
> +compatible = "syscon-poweroff";
> +regmap = <®mapnode>;
> +offset = <0x0>;
> +mask = <0x7a>;
>  };
> diff --git a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml 
> b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
> index a7920f5eef79..d38006b1f1f4 100644
> --- a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
> +++ b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
> @@ -53,8 +53,8 @@ allOf:
>  examples:
>  

Re: [PATCH 4/4] dt-bindings: iio: adc: exynos: Use defines instead of clock numbers

2019-10-06 Thread Jonathan Cameron
On Wed,  2 Oct 2019 18:07:44 +0200
Krzysztof Kozlowski  wrote:

> Make the examples in Exynos ADC bindings more readable and bring them
> closer to real DTS by using defines for clocks.
> 
> Signed-off-by: Krzysztof Kozlowski 

Acked-by: Jonathan Cameron 

> ---
>  .../devicetree/bindings/iio/adc/samsung,exynos-adc.yaml | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git 
> a/Documentation/devicetree/bindings/iio/adc/samsung,exynos-adc.yaml 
> b/Documentation/devicetree/bindings/iio/adc/samsung,exynos-adc.yaml
> index a0a9b909ac40..a3010e7ea051 100644
> --- a/Documentation/devicetree/bindings/iio/adc/samsung,exynos-adc.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/samsung,exynos-adc.yaml
> @@ -135,6 +135,8 @@ examples:
>  };
>  
>- |
> +#include 
> +
>  adc@126c {
>  compatible = "samsung,exynos3250-adc";
>  reg = <0x126C 0x100>;
> @@ -142,8 +144,8 @@ examples:
>  #io-channel-cells = <1>;
>  io-channel-ranges;
>  
> -clocks = <&cmu 0>, // CLK_TSADC
> - <&cmu 1>; // CLK_SCLK_TSADC
> +clocks = <&cmu CLK_TSADC>,
> + <&cmu CLK_SCLK_TSADC>;
>  clock-names = "adc", "sclk";
>  
>  vdd-supply = <&buck5_reg>;



Re: [PATCH v3 1/2] tpm: Use GFP_KERNEL for allocating struct tpm_buf

2019-10-06 Thread Jarkko Sakkinen
On Thu, Oct 03, 2019 at 05:25:16PM -0700, James Bottomley wrote:
> On Thu, 2019-10-03 at 21:51 +0300, Jarkko Sakkinen wrote:
> > Switch from GFP_HIGHUSER to GFP_KERNEL. On 32-bit platforms kmap()
> > space
> > could be unnecessarily wasted because of using GFP_HIGHUSER by taking
> > a
> > page of from the highmem.
> > 
> > Suggested-by: James Bottomley 
> > Signed-off-by: Jarkko Sakkinen 
> > ---
> >  drivers/char/tpm/tpm.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> > index a4f74dd02a35..d20745965350 100644
> > --- a/drivers/char/tpm/tpm.h
> > +++ b/drivers/char/tpm/tpm.h
> > @@ -297,7 +297,7 @@ static inline void tpm_buf_reset(struct tpm_buf
> > *buf, u16 tag, u32 ordinal)
> >  
> >  static inline int tpm_buf_init(struct tpm_buf *buf, u16 tag, u32
> > ordinal)
> >  {
> > -   buf->data_page = alloc_page(GFP_HIGHUSER);
> > +   buf->data_page = alloc_page(GFP_KERNEL);
> > if (!buf->data_page)
> > return -ENOMEM;
> 
> The kmap/kunmap needs removing as well, and now the data_page field
> isn't necessary, so it can go.  I think the result should be something
> like the below (uncompiled and untested).
> 
> James
> 
> ---
> 
> diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> index a7fea3e0ca86..b4f1cbf344b6 100644
> --- a/drivers/char/tpm/tpm.h
> +++ b/drivers/char/tpm/tpm.h
> @@ -284,7 +284,6 @@ enum tpm_buf_flags {
>  };
>  
>  struct tpm_buf {
> - struct page *data_page;
>   unsigned int flags;
>   u8 *data;
>  };
> @@ -300,20 +299,18 @@ static inline void tpm_buf_reset(struct tpm_buf *buf, 
> u16 tag, u32 ordinal)
>  
>  static inline int tpm_buf_init(struct tpm_buf *buf, u16 tag, u32 ordinal)
>  {
> - buf->data_page = alloc_page(GFP_HIGHUSER);
> - if (!buf->data_page)
> + buf->data = (u8 *)__get_free_page(GFP_KERNEL);
> + if (!buf->data)
>   return -ENOMEM;
>  
>   buf->flags = 0;
> - buf->data = kmap(buf->data_page);
>   tpm_buf_reset(buf, tag, ordinal);
>   return 0;
>  }
>  
>  static inline void tpm_buf_destroy(struct tpm_buf *buf)
>  {
> - kunmap(buf->data_page);
> - __free_page(buf->data_page);
> + free_page(buf->data);
>  }
>  
>  static inline u32 tpm_buf_length(struct tpm_buf *buf)
> 
> 

Care to make this a proper patch? Much better idea to do it this
way, agreed.

/Jarkko


Re: [PATCH v2 1/7] iio: adc: max1027: Add debugfs register read support

2019-10-06 Thread Jonathan Cameron
On Thu,  3 Oct 2019 19:33:55 +0200
Miquel Raynal  wrote:

> Until now, only write operations were supported. Force two bytes read
> operation when reading from this register (might be wrong when reading
> the temperature, but will work with any other value).

That's worrying as comments go.  Just return an error on the temperature
register if it's going to do the wrong thing.

Thanks,

Jonathan

> 
> Signed-off-by: Miquel Raynal 
> ---
>  drivers/iio/adc/max1027.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> index 214883458582..6cdfe9ef73fc 100644
> --- a/drivers/iio/adc/max1027.c
> +++ b/drivers/iio/adc/max1027.c
> @@ -309,8 +309,11 @@ static int max1027_debugfs_reg_access(struct iio_dev 
> *indio_dev,
>   struct max1027_state *st = iio_priv(indio_dev);
>   u8 *val = (u8 *)st->buffer;
>  
> - if (readval != NULL)
> - return -EINVAL;
> + if (readval) {
> + int ret = spi_read(st->spi, val, 2);
> + *readval = be16_to_cpu(st->buffer[0]);
> + return ret;
> + }
>  
>   *val = (u8)writeval;
>   return spi_write(st->spi, val, 1);



[PATCH -next] media: i2c: ov5695: Fix randbuild error

2019-10-06 Thread YueHaibing
If VIDEO_OV5695 is y and V4L2_FWNODE is m, building fails:

drivers/media/i2c/ov5695.o: In function `ov5695_probe':
ov5695.c:(.text+0xf4c): undefined reference to 
`v4l2_async_register_subdev_sensor_common'

Select V4L2_FWNODE like OV5675 does.

Fixes: 623df5d710fe ("media: i2c: ov5695: Modify the function of async register 
subdev related devices")
Signed-off-by: YueHaibing 
---
 drivers/media/i2c/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 78dc64d..70a7233 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -729,6 +729,7 @@ config VIDEO_OV5675
 config VIDEO_OV5695
tristate "OmniVision OV5695 sensor support"
depends on I2C && VIDEO_V4L2
+   select V4L2_FWNODE
help
  This is a Video4Linux2 sensor driver for the OmniVision
  OV5695 camera.
-- 
2.7.4




Re: [alsa-devel] [PATCH -next] ASoc: tas2770: Fix build error without GPIOLIB

2019-10-06 Thread Yuehaibing
On 2019/10/6 17:57, Ladislav Michl wrote:
> Dear YueHaibing,
> 
> On Sun, Oct 06, 2019 at 03:22:41PM +0800, YueHaibing wrote:
>> If GPIOLIB is not set, building fails:
>>
>> sound/soc/codecs/tas2770.c: In function tas2770_reset:
>> sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function 
>> gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? 
>> [-Werror=implicit-function-declaration]
>>gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
>>^~~~
>>gpio_set_value_cansleep
>> sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
>> sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function 
>> devm_gpiod_get_optional; did you mean devm_regulator_get_optional? 
>> [-Werror=implicit-function-declaration]
>>   tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
>> ^~~
>> devm_regulator_get_optional
>> sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first 
>> use in this function); did you mean GPIOF_INIT_HIGH?
>>  GPIOD_OUT_HIGH);
>>  ^~
>>  GPIOF_INIT_HIGH
>>
>> Reported-by: Hulk Robot 
>> Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
>> Signed-off-by: YueHaibing 
>> ---
>>  sound/soc/codecs/Kconfig | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
>> index bcac957..d639f17 100644
>> --- a/sound/soc/codecs/Kconfig
>> +++ b/sound/soc/codecs/Kconfig
>> @@ -1108,6 +1108,7 @@ config SND_SOC_TAS2552
>>  config SND_SOC_TAS2770
>>  tristate "Texas Instruments TAS2770 speaker amplifier"
>>  depends on I2C
>> +select GPIOLIB
> 
> GPIOLIB API is working perfectly fine even if GPIOLIB is not selected
> and gpiod_* functions will merely return -ENOSYS in this case.
> Please see  and fix your patch accordingly.


Thanks, will send v2 as your suggestion.

> 
>>  config SND_SOC_TAS5086
>>  tristate "Texas Instruments TAS5086 speaker amplifier"
>> -- 
>> 2.7.4
>>
>>
>> ___
>> Alsa-devel mailing list
>> alsa-de...@alsa-project.org
>> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 
> .
> 



Re: [PATCH] staging: greybus: add blank line after declarations

2019-10-06 Thread Joe Perches
On Sun, 2019-10-06 at 11:50 +0200, Greg KH wrote:
> On Sat, Oct 05, 2019 at 06:00:46PM -0300, Gabriela Bittencourt wrote:
> > Fix CHECK: add blank line after declarations
[]
> > diff --git a/drivers/staging/greybus/control.h 
> > b/drivers/staging/greybus/control.h
[]
> > @@ -24,6 +24,7 @@ struct gb_control {
> > char *vendor_string;
> > char *product_string;
> >  };
> > +
> >  #define to_gb_control(d) container_of(d, struct gb_control, dev)
> 
> No, the original code is "better" here, it's a common pattern despite
> what checkpatch.pl tells you, sorry.

Statistics please.

I believe it's not a common pattern.




Re: [PATCH v2 2/7] iio: adc: max1027: Make it optional to use interrupts

2019-10-06 Thread Jonathan Cameron
On Thu,  3 Oct 2019 19:33:56 +0200
Miquel Raynal  wrote:

> The chip has a 'start conversion' and a 'end of conversion' pair of
> pins. They can be used but this is absolutely not mandatory as regular
> polling of the value is totally fine with the current internal
> clocking setup. Turn the interrupts optional and do not error out if
> they are not inquired in the device tree. This has the effect to
> prevent triggered buffers use though.
> 
> Signed-off-by: Miquel Raynal 

Hmm. I haven't looked a this in a great deal of depth but if we support
single channel reads it should be possible to allow the use of a
trigger from elsewhere.  Looks like a fair bit of new code would be needed
to support that though.  So perhaps this is a good first step.

It's a bit annoying that the hardware doesn't provide a EOC bit
anywhere in the registers.  That would have allowed us to be a bit
cleverer.

Anyhow, this looks fine to me.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/max1027.c | 57 +--
>  1 file changed, 31 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> index 6cdfe9ef73fc..823223b77a70 100644
> --- a/drivers/iio/adc/max1027.c
> +++ b/drivers/iio/adc/max1027.c
> @@ -430,35 +430,40 @@ static int max1027_probe(struct spi_device *spi)
>   return -ENOMEM;
>   }
>  
> - ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev,
> - &iio_pollfunc_store_time,
> - &max1027_trigger_handler, NULL);
> - if (ret < 0) {
> - dev_err(&indio_dev->dev, "Failed to setup buffer\n");
> - return ret;
> - }

> + if (spi->irq) {
> + ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev,
> +   &iio_pollfunc_store_time,
> +   &max1027_trigger_handler,
> +   NULL);
> + if (ret < 0) {
> + dev_err(&indio_dev->dev, "Failed to setup buffer\n");
> + return ret;
> + }
>  
> - st->trig = devm_iio_trigger_alloc(&spi->dev, "%s-trigger",
> - indio_dev->name);
> - if (st->trig == NULL) {
> - ret = -ENOMEM;
> - dev_err(&indio_dev->dev, "Failed to allocate iio trigger\n");
> - return ret;
> - }
> + st->trig = devm_iio_trigger_alloc(&spi->dev, "%s-trigger",
> +   indio_dev->name);
> + if (st->trig == NULL) {
> + ret = -ENOMEM;
> + dev_err(&indio_dev->dev,
> + "Failed to allocate iio trigger\n");
> + return ret;
> + }
>  
> - st->trig->ops = &max1027_trigger_ops;
> - st->trig->dev.parent = &spi->dev;
> - iio_trigger_set_drvdata(st->trig, indio_dev);
> - iio_trigger_register(st->trig);
> + st->trig->ops = &max1027_trigger_ops;
> + st->trig->dev.parent = &spi->dev;
> + iio_trigger_set_drvdata(st->trig, indio_dev);
> + iio_trigger_register(st->trig);
>  
> - ret = devm_request_threaded_irq(&spi->dev, spi->irq,
> - iio_trigger_generic_data_rdy_poll,
> - NULL,
> - IRQF_TRIGGER_FALLING,
> - spi->dev.driver->name, st->trig);
> - if (ret < 0) {
> - dev_err(&indio_dev->dev, "Failed to allocate IRQ.\n");
> - return ret;
> + ret = devm_request_threaded_irq(&spi->dev, spi->irq,
> + 
> iio_trigger_generic_data_rdy_poll,
> + NULL,
> + IRQF_TRIGGER_FALLING,
> + spi->dev.driver->name,
> + st->trig);
> + if (ret < 0) {
> + dev_err(&indio_dev->dev, "Failed to allocate IRQ.\n");
> + return ret;
> + }
>   }
>  
>   /* Disable averaging */



Re: [PATCH v2 4/7] iio: adc: max1027: Prepare the introduction of different resolutions

2019-10-06 Thread Jonathan Cameron
On Thu,  3 Oct 2019 19:33:58 +0200
Miquel Raynal  wrote:

> Maxim's max1027/29/31 series returns the measured voltages with a
> resolution of 10 bits. There is a very similar series, max1227/29/31
> which works identically but uses a resolution of 12 bits. Prepare the
> support for these chips by turning the 'depth' into a macro parameter
> instead of hardcoding it everywhere. Also reorganize just a bit the
> macros at the top to avoid repeating tens of lines when adding support
> for a new chip.
> 
> Signed-off-by: Miquel Raynal 
Minor comments inline.

Jonathan

> ---
>  drivers/iio/adc/max1027.c | 78 ++-
>  1 file changed, 36 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> index f9b473ee6711..5d5d223dd42a 100644
> --- a/drivers/iio/adc/max1027.c
> +++ b/drivers/iio/adc/max1027.c
> @@ -83,7 +83,7 @@ static const struct of_device_id max1027_adc_dt_ids[] = {
>  MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids);
>  #endif
>  
> -#define MAX1027_V_CHAN(index)
> \
> +#define MAX1027_V_CHAN(index, depth) \
>   {   \
>   .type = IIO_VOLTAGE,\
>   .indexed = 1,   \
> @@ -93,7 +93,7 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids);
>   .scan_index = index + 1,\
>   .scan_type = {  \
>   .sign = 'u',\
> - .realbits = 10, \
> + .realbits = depth,  \
>   .storagebits = 16,  \
>   .shift = 2, \
>   .endianness = IIO_BE,   \
> @@ -115,52 +115,42 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids);
>   },  \
>   }
>  
> +#define MAX1X27_CHANNELS(depth)  \
> + MAX1027_T_CHAN, \
> + MAX1027_V_CHAN(0, depth),   \
> + MAX1027_V_CHAN(1, depth),   \
> + MAX1027_V_CHAN(2, depth),   \
> + MAX1027_V_CHAN(3, depth),   \
> + MAX1027_V_CHAN(4, depth),   \
> + MAX1027_V_CHAN(5, depth),   \
> + MAX1027_V_CHAN(6, depth),   \
> + MAX1027_V_CHAN(7, depth)
> +
> +#define MAX1X29_CHANNELS(depth)  \
> + MAX1027_V_CHAN(8, depth),   \
> + MAX1027_V_CHAN(9, depth),   \
> + MAX1027_V_CHAN(10, depth),  \
> + MAX1027_V_CHAN(11, depth)
> +

Modify this a touch so the macro for MAX1X29_CHANNELS includes
MAX1X27_CHANNELS.  That way each macro's name matches what it
does rather than the 'additional channels' for that device.

> +#define MAX1X31_CHANNELS(depth)  \
> + MAX1027_V_CHAN(12, depth),  \
> + MAX1027_V_CHAN(13, depth),  \
> + MAX1027_V_CHAN(14, depth),  \
> + MAX1027_V_CHAN(15, depth)
> +
>  static const struct iio_chan_spec max1027_channels[] = {
> - MAX1027_T_CHAN,
> - MAX1027_V_CHAN(0),
> - MAX1027_V_CHAN(1),
> - MAX1027_V_CHAN(2),
> - MAX1027_V_CHAN(3),
> - MAX1027_V_CHAN(4),
> - MAX1027_V_CHAN(5),
> - MAX1027_V_CHAN(6),
> - MAX1027_V_CHAN(7)
> + MAX1X27_CHANNELS(10)
>  };
>  
>  static const struct iio_chan_spec max1029_channels[] = {
> - MAX1027_T_CHAN,
> - MAX1027_V_CHAN(0),
> - MAX1027_V_CHAN(1),
> - MAX1027_V_CHAN(2),
> - MAX1027_V_CHAN(3),
> - MAX1027_V_CHAN(4),
> - MAX1027_V_CHAN(5),
> - MAX1027_V_CHAN(6),
> - MAX1027_V_CHAN(7),
> - MAX1027_V_CHAN(8),
> - MAX1027_V_CHAN(9),
> - MAX1027_V_CHAN(10),
> - MAX1027_V_CHAN(11)
> + MAX1X27_CHANNELS(10),
> + MAX1X29_CHANNELS(10)
>  };
>  
>  static const struct iio_chan_spec max1031_channels[] = {
> - MAX1027_T_CHAN,
> - MAX1027_V_CHAN(0),
> - MAX1027_V_CHAN(1),
> - MAX1027_V_CHAN(2),
> - MAX1027_V_CHAN(3),
> - MAX1027_V_CHAN(4),
> - MAX1027_V_CHAN(5),
> - MAX1027_V_CHAN(6),
> - MAX1027_V_CHAN(7),
> - MAX1027_V_CHAN(8),
> - MAX1027_V_CHAN(9),
> - MAX1027_V_CHAN(10),
> - MAX1027_V_CHAN(11),
> - MAX1027_V_CHAN(12),
> - MAX1027_V_CHAN(13),
> - MAX1027_V_CHAN(14),
> - MAX1027_V_CHAN(15)
> + MAX1X27_CHANNELS(10),
> + MAX1X29_CHANNELS(10),
> + MAX1X31_CHANNELS(10)
>  };
>  
>  static const unsigned long max1027_available_scan_masks[] = {
> @@ -181,6 +171,7 @@ static const unsigned long max1031_available_scan_masks[] 
> = {
>  struct max102

Re: [PATCH v2 5/7] iio: adc: max1027: Introduce 12-bit devices support

2019-10-06 Thread Jonathan Cameron
On Thu,  3 Oct 2019 19:33:59 +0200
Miquel Raynal  wrote:

> Maxim's max12xx series is very similar to the max10xx series, with the
> difference of the measurements depth which is upgraded from 10 to 12
> bits per channel. Everything else looks the same.
> 
> Signed-off-by: Miquel Raynal 
Looks good.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/Kconfig   |  4 ++--
>  drivers/iio/adc/max1027.c | 44 ++-
>  2 files changed, 45 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index f0af3a42f53c..6ac16d738822 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -508,8 +508,8 @@ config MAX1027
>   select IIO_BUFFER
>   select IIO_TRIGGERED_BUFFER
>   help
> -   Say yes here to build support for Maxim SPI ADC models
> -   max1027, max1029 and max1031.
> +   Say yes here to build support for Maxim SPI {10,12}-bit ADC models:
> +   max1027, max1029, max1031, max1227, max1229 and max1231.
>  
> To compile this driver as a module, choose M here: the module will be
> called max1027.
> diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> index 5d5d223dd42a..0d7116e9a63b 100644
> --- a/drivers/iio/adc/max1027.c
> +++ b/drivers/iio/adc/max1027.c
> @@ -63,12 +63,18 @@ enum max1027_id {
>   max1027,
>   max1029,
>   max1031,
> + max1227,
> + max1229,
> + max1231,
>  };
>  
>  static const struct spi_device_id max1027_id[] = {
>   {"max1027", max1027},
>   {"max1029", max1029},
>   {"max1031", max1031},
> + {"max1227", max1227},
> + {"max1229", max1229},
> + {"max1231", max1231},
>   {}
>  };
>  MODULE_DEVICE_TABLE(spi, max1027_id);
> @@ -78,6 +84,9 @@ static const struct of_device_id max1027_adc_dt_ids[] = {
>   { .compatible = "maxim,max1027" },
>   { .compatible = "maxim,max1029" },
>   { .compatible = "maxim,max1031" },
> + { .compatible = "maxim,max1227" },
> + { .compatible = "maxim,max1229" },
> + { .compatible = "maxim,max1231" },
>   {},
>  };
>  MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids);
> @@ -153,6 +162,21 @@ static const struct iio_chan_spec max1031_channels[] = {
>   MAX1X31_CHANNELS(10)
>  };
>  
> +static const struct iio_chan_spec max1227_channels[] = {
> + MAX1X27_CHANNELS(12)
> +};
> +
> +static const struct iio_chan_spec max1229_channels[] = {
> + MAX1X27_CHANNELS(12),
> + MAX1X29_CHANNELS(12)
> +};
> +
> +static const struct iio_chan_spec max1231_channels[] = {
> + MAX1X27_CHANNELS(12),
> + MAX1X29_CHANNELS(12),
> + MAX1X31_CHANNELS(12)
> +};
> +
>  static const unsigned long max1027_available_scan_masks[] = {
>   0x01ff,
>   0x,
> @@ -194,6 +218,24 @@ static const struct max1027_chip_info 
> max1027_chip_info_tbl[] = {
>   .depth = 10,
>   .available_scan_masks = max1031_available_scan_masks,
>   },
> + [max1227] = {
> + .channels = max1227_channels,
> + .num_channels = ARRAY_SIZE(max1227_channels),
> + .depth = 12,
> + .available_scan_masks = max1027_available_scan_masks,
> + },
> + [max1229] = {
> + .channels = max1229_channels,
> + .num_channels = ARRAY_SIZE(max1229_channels),
> + .depth = 12,
> + .available_scan_masks = max1029_available_scan_masks,
> + },
> + [max1231] = {
> + .channels = max1231_channels,
> + .num_channels = ARRAY_SIZE(max1231_channels),
> + .depth = 12,
> + .available_scan_masks = max1031_available_scan_masks,
> + },
>  };
>  
>  struct max1027_state {
> @@ -490,5 +532,5 @@ static struct spi_driver max1027_driver = {
>  module_spi_driver(max1027_driver);
>  
>  MODULE_AUTHOR("Philippe Reynes ");
> -MODULE_DESCRIPTION("MAX1027/MAX1029/MAX1031 ADC");
> +MODULE_DESCRIPTION("MAX1X27/MAX1X29/MAX1X31 ADC");
>  MODULE_LICENSE("GPL v2");



Re: [PATCH v2 7/7] dt-bindings: iio: adc: max1027: Document max12xx series compatibles

2019-10-06 Thread Jonathan Cameron
On Thu,  3 Oct 2019 19:34:01 +0200
Miquel Raynal  wrote:

> Update the bindings documentation with new Maxim ADCs compatibles.
> 
> Signed-off-by: Miquel Raynal 

Both DT patches look fine to me... 

If you happened to fancy doing the yaml conversion it would be
appreciated... :) 

If not we'll get to this one one day.

Anyhow, a few trivial bits in the earlier patches so v3 should be
good to go.

Thanks,

Jonathan

> ---
>  .../devicetree/bindings/iio/adc/max1027-adc.txt| 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt 
> b/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt
> index 7b23d68f655c..1b703a01d882 100644
> --- a/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt
> +++ b/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt
> @@ -1,7 +1,13 @@
> -* Maxim 1027/1029/1031 Analog to Digital Converter (ADC)
> +* Maxim 1027/1029/1031/1227/1229/1231 Analog to Digital Converter (ADC)
>  
>  Required properties:
> -  - compatible: Should be "maxim,max1027" or "maxim,max1029" or 
> "maxim,max1031"
> +  - compatible: Should be one of:
> +* "maxim,max1027"
> +* "maxim,max1029"
> +* "maxim,max1031"
> +* "maxim,max1227"
> +* "maxim,max1229"
> +* "maxim,max1231"
>- reg: SPI chip select number for the device
>  
>  Optional properties:



[PATCH -next 03/34] rtc: brcmstb-waketimer: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-brcmstb-waketimer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c 
b/drivers/rtc/rtc-brcmstb-waketimer.c
index 3e9800f..cb7af87 100644
--- a/drivers/rtc/rtc-brcmstb-waketimer.c
+++ b/drivers/rtc/rtc-brcmstb-waketimer.c
@@ -200,7 +200,6 @@ static int brcmstb_waketmr_probe(struct platform_device 
*pdev)
 {
struct device *dev = &pdev->dev;
struct brcmstb_waketmr *timer;
-   struct resource *res;
int ret;
 
timer = devm_kzalloc(dev, sizeof(*timer), GFP_KERNEL);
@@ -210,8 +209,7 @@ static int brcmstb_waketmr_probe(struct platform_device 
*pdev)
platform_set_drvdata(pdev, timer);
timer->dev = dev;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   timer->base = devm_ioremap_resource(dev, res);
+   timer->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(timer->base))
return PTR_ERR(timer->base);
 
-- 
2.7.4




[PATCH -next 01/34] rtc: asm9260: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-asm9260.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-asm9260.c b/drivers/rtc/rtc-asm9260.c
index 10413d8..10064bd 100644
--- a/drivers/rtc/rtc-asm9260.c
+++ b/drivers/rtc/rtc-asm9260.c
@@ -245,7 +245,6 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
 {
struct asm9260_rtc_priv *priv;
struct device *dev = &pdev->dev;
-   struct resource *res;
int irq_alarm, ret;
u32 ccr;
 
@@ -260,8 +259,7 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
if (irq_alarm < 0)
return irq_alarm;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   priv->iobase = devm_ioremap_resource(dev, res);
+   priv->iobase = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->iobase))
return PTR_ERR(priv->iobase);
 
-- 
2.7.4




[PATCH -next 10/34] rtc: ds1511: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-ds1511.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index b6a4775..a63872c 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -414,7 +414,6 @@ static int ds1511_nvram_write(void *priv, unsigned int pos, 
void *buf,
 
 static int ds1511_rtc_probe(struct platform_device *pdev)
 {
-   struct resource *res;
struct rtc_plat_data *pdata;
int ret = 0;
struct nvmem_config ds1511_nvmem_cfg = {
@@ -431,8 +430,7 @@ static int ds1511_rtc_probe(struct platform_device *pdev)
if (!pdata)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   ds1511_base = devm_ioremap_resource(&pdev->dev, res);
+   ds1511_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(ds1511_base))
return PTR_ERR(ds1511_base);
pdata->ioaddr = ds1511_base;
-- 
2.7.4




[PATCH -next 17/34] rtc: mt7622: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-mt7622.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-mt7622.c b/drivers/rtc/rtc-mt7622.c
index 16bd26b..f1e3563 100644
--- a/drivers/rtc/rtc-mt7622.c
+++ b/drivers/rtc/rtc-mt7622.c
@@ -303,7 +303,6 @@ MODULE_DEVICE_TABLE(of, mtk_rtc_match);
 static int mtk_rtc_probe(struct platform_device *pdev)
 {
struct mtk_rtc *hw;
-   struct resource *res;
int ret;
 
hw = devm_kzalloc(&pdev->dev, sizeof(*hw), GFP_KERNEL);
@@ -312,8 +311,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, hw);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   hw->base = devm_ioremap_resource(&pdev->dev, res);
+   hw->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(hw->base))
return PTR_ERR(hw->base);
 
-- 
2.7.4




[PATCH -next 08/34] rtc: digicolor: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-digicolor.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-digicolor.c b/drivers/rtc/rtc-digicolor.c
index 0aecc3f..200d85b 100644
--- a/drivers/rtc/rtc-digicolor.c
+++ b/drivers/rtc/rtc-digicolor.c
@@ -175,7 +175,6 @@ static irqreturn_t dc_rtc_irq(int irq, void *dev_id)
 
 static int __init dc_rtc_probe(struct platform_device *pdev)
 {
-   struct resource *res;
struct dc_rtc *rtc;
int irq, ret;
 
@@ -183,8 +182,7 @@ static int __init dc_rtc_probe(struct platform_device *pdev)
if (!rtc)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   rtc->regs = devm_ioremap_resource(&pdev->dev, res);
+   rtc->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rtc->regs))
return PTR_ERR(rtc->regs);
 
-- 
2.7.4




[PATCH -next 04/34] rtc: at91sam9: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-at91sam9.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index bb3ba7b..e39e898 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -334,7 +334,6 @@ static const struct rtc_class_ops at91_rtc_ops = {
  */
 static int at91_rtc_probe(struct platform_device *pdev)
 {
-   struct resource *r;
struct sam9_rtc *rtc;
int ret, irq;
u32 mr;
@@ -358,8 +357,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, rtc);
 
-   r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   rtc->rtt = devm_ioremap_resource(&pdev->dev, r);
+   rtc->rtt = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rtc->rtt))
return PTR_ERR(rtc->rtt);
 
-- 
2.7.4




[PATCH -next 12/34] rtc: ep93xx: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-ep93xx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index 1766496..8ec9ea1 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -122,15 +122,13 @@ static const struct attribute_group 
ep93xx_rtc_sysfs_files = {
 static int ep93xx_rtc_probe(struct platform_device *pdev)
 {
struct ep93xx_rtc *ep93xx_rtc;
-   struct resource *res;
int err;
 
ep93xx_rtc = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_rtc), GFP_KERNEL);
if (!ep93xx_rtc)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   ep93xx_rtc->mmio_base = devm_ioremap_resource(&pdev->dev, res);
+   ep93xx_rtc->mmio_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(ep93xx_rtc->mmio_base))
return PTR_ERR(ep93xx_rtc->mmio_base);
 
-- 
2.7.4




[PATCH -next 15/34] rtc: lpc32xx: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-lpc32xx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-lpc32xx.c b/drivers/rtc/rtc-lpc32xx.c
index ac39323..b6a0d4a 100644
--- a/drivers/rtc/rtc-lpc32xx.c
+++ b/drivers/rtc/rtc-lpc32xx.c
@@ -185,7 +185,6 @@ static const struct rtc_class_ops lpc32xx_rtc_ops = {
 
 static int lpc32xx_rtc_probe(struct platform_device *pdev)
 {
-   struct resource *res;
struct lpc32xx_rtc *rtc;
int err;
u32 tmp;
@@ -194,8 +193,7 @@ static int lpc32xx_rtc_probe(struct platform_device *pdev)
if (unlikely(!rtc))
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   rtc->rtc_base = devm_ioremap_resource(&pdev->dev, res);
+   rtc->rtc_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rtc->rtc_base))
return PTR_ERR(rtc->rtc_base);
 
-- 
2.7.4




[PATCH -next 16/34] rtc: meson: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-meson.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-meson.c b/drivers/rtc/rtc-meson.c
index e08b981..9bd8478 100644
--- a/drivers/rtc/rtc-meson.c
+++ b/drivers/rtc/rtc-meson.c
@@ -292,7 +292,6 @@ static int meson_rtc_probe(struct platform_device *pdev)
};
struct device *dev = &pdev->dev;
struct meson_rtc *rtc;
-   struct resource *res;
void __iomem *base;
int ret;
u32 tm;
@@ -312,8 +311,7 @@ static int meson_rtc_probe(struct platform_device *pdev)
rtc->rtc->ops = &meson_rtc_ops;
rtc->rtc->range_max = U32_MAX;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   base = devm_ioremap_resource(dev, res);
+   base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
 
-- 
2.7.4




[PATCH -next 06/34] rtc: coh901331: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-coh901331.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c
index 4ac8508..da59917 100644
--- a/drivers/rtc/rtc-coh901331.c
+++ b/drivers/rtc/rtc-coh901331.c
@@ -164,15 +164,13 @@ static int __init coh901331_probe(struct platform_device 
*pdev)
 {
int ret;
struct coh901331_port *rtap;
-   struct resource *res;
 
rtap = devm_kzalloc(&pdev->dev,
sizeof(struct coh901331_port), GFP_KERNEL);
if (!rtap)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   rtap->virtbase  = devm_ioremap_resource(&pdev->dev, res);
+   rtap->virtbase  = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rtap->virtbase))
return PTR_ERR(rtap->virtbase);
 
-- 
2.7.4




[PATCH -next 13/34] rtc: jz4740: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-jz4740.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
index 3089645..18023e4 100644
--- a/drivers/rtc/rtc-jz4740.c
+++ b/drivers/rtc/rtc-jz4740.c
@@ -307,7 +307,6 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
 {
int ret;
struct jz4740_rtc *rtc;
-   struct resource *mem;
const struct platform_device_id *id = platform_get_device_id(pdev);
const struct of_device_id *of_id = of_match_device(
jz4740_rtc_of_match, &pdev->dev);
@@ -326,8 +325,7 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
if (rtc->irq < 0)
return -ENOENT;
 
-   mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   rtc->base = devm_ioremap_resource(&pdev->dev, mem);
+   rtc->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rtc->base))
return PTR_ERR(rtc->base);
 
-- 
2.7.4




[PATCH -next 14/34] rtc: lpc24xx: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-lpc24xx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-lpc24xx.c b/drivers/rtc/rtc-lpc24xx.c
index a8bb156..00ef16b 100644
--- a/drivers/rtc/rtc-lpc24xx.c
+++ b/drivers/rtc/rtc-lpc24xx.c
@@ -194,15 +194,13 @@ static const struct rtc_class_ops lpc24xx_rtc_ops = {
 static int lpc24xx_rtc_probe(struct platform_device *pdev)
 {
struct lpc24xx_rtc *rtc;
-   struct resource *res;
int irq, ret;
 
rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
if (!rtc)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   rtc->rtc_base = devm_ioremap_resource(&pdev->dev, res);
+   rtc->rtc_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rtc->rtc_base))
return PTR_ERR(rtc->rtc_base);
 
-- 
2.7.4




[PATCH -next 18/34] rtc: mv: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-mv.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index ab9db57..d5f190e5 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -212,7 +212,6 @@ static const struct rtc_class_ops mv_rtc_alarm_ops = {
 
 static int __init mv_rtc_probe(struct platform_device *pdev)
 {
-   struct resource *res;
struct rtc_plat_data *pdata;
u32 rtc_time;
int ret = 0;
@@ -221,8 +220,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
if (!pdata)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   pdata->ioaddr = devm_ioremap_resource(&pdev->dev, res);
+   pdata->ioaddr = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(pdata->ioaddr))
return PTR_ERR(pdata->ioaddr);
 
-- 
2.7.4




[PATCH -next 07/34] rtc: davinci: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-davinci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c
index d8e0db2..390b735 100644
--- a/drivers/rtc/rtc-davinci.c
+++ b/drivers/rtc/rtc-davinci.c
@@ -469,7 +469,6 @@ static int __init davinci_rtc_probe(struct platform_device 
*pdev)
 {
struct device *dev = &pdev->dev;
struct davinci_rtc *davinci_rtc;
-   struct resource *res;
int ret = 0;
 
davinci_rtc = devm_kzalloc(&pdev->dev, sizeof(struct davinci_rtc), 
GFP_KERNEL);
@@ -480,8 +479,7 @@ static int __init davinci_rtc_probe(struct platform_device 
*pdev)
if (davinci_rtc->irq < 0)
return davinci_rtc->irq;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   davinci_rtc->base = devm_ioremap_resource(dev, res);
+   davinci_rtc->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(davinci_rtc->base))
return PTR_ERR(davinci_rtc->base);
 
-- 
2.7.4




[PATCH -next 09/34] rtc: ds1216: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-ds1216.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1216.c b/drivers/rtc/rtc-ds1216.c
index b225bcf..7eeb3f3 100644
--- a/drivers/rtc/rtc-ds1216.c
+++ b/drivers/rtc/rtc-ds1216.c
@@ -137,7 +137,6 @@ static const struct rtc_class_ops ds1216_rtc_ops = {
 
 static int __init ds1216_rtc_probe(struct platform_device *pdev)
 {
-   struct resource *res;
struct ds1216_priv *priv;
u8 dummy[8];
 
@@ -147,8 +146,7 @@ static int __init ds1216_rtc_probe(struct platform_device 
*pdev)
 
platform_set_drvdata(pdev, priv);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   priv->ioaddr = devm_ioremap_resource(&pdev->dev, res);
+   priv->ioaddr = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->ioaddr))
return PTR_ERR(priv->ioaddr);
 
-- 
2.7.4




[PATCH -next 11/34] rtc: ds1553: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-ds1553.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c
index 219d6b5..cdf5e05 100644
--- a/drivers/rtc/rtc-ds1553.c
+++ b/drivers/rtc/rtc-ds1553.c
@@ -249,7 +249,6 @@ static int ds1553_nvram_write(void *priv, unsigned int pos, 
void *val,
 
 static int ds1553_rtc_probe(struct platform_device *pdev)
 {
-   struct resource *res;
unsigned int cen, sec;
struct rtc_plat_data *pdata;
void __iomem *ioaddr;
@@ -268,8 +267,7 @@ static int ds1553_rtc_probe(struct platform_device *pdev)
if (!pdata)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   ioaddr = devm_ioremap_resource(&pdev->dev, res);
+   ioaddr = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(ioaddr))
return PTR_ERR(ioaddr);
pdata->ioaddr = ioaddr;
-- 
2.7.4




[PATCH -next 25/34] rtc: stk17ta8: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-stk17ta8.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c
index a833ebc..01a4504 100644
--- a/drivers/rtc/rtc-stk17ta8.c
+++ b/drivers/rtc/rtc-stk17ta8.c
@@ -256,7 +256,6 @@ static int stk17ta8_nvram_write(void *priv, unsigned int 
pos, void *val,
 
 static int stk17ta8_rtc_probe(struct platform_device *pdev)
 {
-   struct resource *res;
unsigned int cal;
unsigned int flags;
struct rtc_plat_data *pdata;
@@ -275,8 +274,7 @@ static int stk17ta8_rtc_probe(struct platform_device *pdev)
if (!pdata)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   ioaddr = devm_ioremap_resource(&pdev->dev, res);
+   ioaddr = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(ioaddr))
return PTR_ERR(ioaddr);
pdata->ioaddr = ioaddr;
-- 
2.7.4




[PATCH -next 19/34] rtc: omap: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-omap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index a2941c8..988a4df 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -727,7 +727,6 @@ static struct nvmem_config omap_rtc_nvmem_config = {
 static int omap_rtc_probe(struct platform_device *pdev)
 {
struct omap_rtc *rtc;
-   struct resource *res;
u8 reg, mask, new_ctrl;
const struct platform_device_id *id_entry;
const struct of_device_id *of_id;
@@ -764,8 +763,7 @@ static int omap_rtc_probe(struct platform_device *pdev)
if (!IS_ERR(rtc->clk))
clk_prepare_enable(rtc->clk);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   rtc->base = devm_ioremap_resource(&pdev->dev, res);
+   rtc->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rtc->base)) {
clk_disable_unprepare(rtc->clk);
return PTR_ERR(rtc->base);
-- 
2.7.4




[PATCH -next 20/34] rtc: pic32: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-pic32.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-pic32.c b/drivers/rtc/rtc-pic32.c
index 17653ed..2b69467 100644
--- a/drivers/rtc/rtc-pic32.c
+++ b/drivers/rtc/rtc-pic32.c
@@ -298,7 +298,6 @@ static int pic32_rtc_remove(struct platform_device *pdev)
 static int pic32_rtc_probe(struct platform_device *pdev)
 {
struct pic32_rtc_dev *pdata;
-   struct resource *res;
int ret;
 
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
@@ -311,8 +310,7 @@ static int pic32_rtc_probe(struct platform_device *pdev)
if (pdata->alarm_irq < 0)
return pdata->alarm_irq;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   pdata->reg_base = devm_ioremap_resource(&pdev->dev, res);
+   pdata->reg_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(pdata->reg_base))
return PTR_ERR(pdata->reg_base);
 
-- 
2.7.4




[PATCH -next 29/34] rtc: sunxi: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-sunxi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-sunxi.c b/drivers/rtc/rtc-sunxi.c
index 9b6f248..f5d7f44 100644
--- a/drivers/rtc/rtc-sunxi.c
+++ b/drivers/rtc/rtc-sunxi.c
@@ -422,7 +422,6 @@ MODULE_DEVICE_TABLE(of, sunxi_rtc_dt_ids);
 static int sunxi_rtc_probe(struct platform_device *pdev)
 {
struct sunxi_rtc_dev *chip;
-   struct resource *res;
int ret;
 
chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
@@ -436,8 +435,7 @@ static int sunxi_rtc_probe(struct platform_device *pdev)
if (IS_ERR(chip->rtc))
return PTR_ERR(chip->rtc);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   chip->base = devm_ioremap_resource(&pdev->dev, res);
+   chip->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(chip->base))
return PTR_ERR(chip->base);
 
-- 
2.7.4




[PATCH -next 21/34] rtc: rtd119x: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-rtd119x.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-rtd119x.c b/drivers/rtc/rtc-rtd119x.c
index b233559..bb98f2d 100644
--- a/drivers/rtc/rtc-rtd119x.c
+++ b/drivers/rtc/rtc-rtd119x.c
@@ -167,7 +167,6 @@ static const struct of_device_id rtd119x_rtc_dt_ids[] = {
 static int rtd119x_rtc_probe(struct platform_device *pdev)
 {
struct rtd119x_rtc *data;
-   struct resource *res;
u32 val;
int ret;
 
@@ -178,8 +177,7 @@ static int rtd119x_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, data);
data->base_year = 2014;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   data->base = devm_ioremap_resource(&pdev->dev, res);
+   data->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(data->base))
return PTR_ERR(data->base);
 
-- 
2.7.4




[PATCH -next 00/34] rtc: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
devm_platform_ioremap_resource() internally have platform_get_resource()
and devm_ioremap_resource() in it. So instead of calling them separately
use devm_platform_ioremap_resource() directly.

YueHaibing (34):
  rtc: asm9260: use devm_platform_ioremap_resource() to simplify code
  rtc: rtc-aspeed: use devm_platform_ioremap_resource() to simplify code
  rtc: brcmstb-waketimer: use devm_platform_ioremap_resource() to
simplify code
  rtc: at91sam9: use devm_platform_ioremap_resource() to simplify code
  rtc: cadence: use devm_platform_ioremap_resource() to simplify code
  rtc: coh901331: use devm_platform_ioremap_resource() to simplify code
  rtc: davinci: use devm_platform_ioremap_resource() to simplify code
  rtc: digicolor: use devm_platform_ioremap_resource() to simplify code
  rtc: ds1216: use devm_platform_ioremap_resource() to simplify code
  rtc: ds1511: use devm_platform_ioremap_resource() to simplify code
  rtc: ds1553: use devm_platform_ioremap_resource() to simplify code
  rtc: ep93xx: use devm_platform_ioremap_resource() to simplify code
  rtc: jz4740: use devm_platform_ioremap_resource() to simplify code
  rtc: lpc24xx: use devm_platform_ioremap_resource() to simplify code
  rtc: lpc32xx: use devm_platform_ioremap_resource() to simplify code
  rtc: meson: use devm_platform_ioremap_resource() to simplify code
  rtc: mt7622: use devm_platform_ioremap_resource() to simplify code
  rtc: mv: use devm_platform_ioremap_resource() to simplify code
  rtc: omap: use devm_platform_ioremap_resource() to simplify code
  rtc: pic32: use devm_platform_ioremap_resource() to simplify code
  rtc: rtd119x: use devm_platform_ioremap_resource() to simplify code
  rtc: s3c: use devm_platform_ioremap_resource() to simplify code
  rtc: sa1100: use devm_platform_ioremap_resource() to simplify code
  rtc: spear: use devm_platform_ioremap_resource() to simplify code
  rtc: stk17ta8: use devm_platform_ioremap_resource() to simplify code
  rtc: ds1286: use devm_platform_ioremap_resource() to simplify code
  rtc: st-lpc: use devm_platform_ioremap_resource() to simplify code
  rtc: stm32: use devm_platform_ioremap_resource() to simplify code
  rtc: sunxi: use devm_platform_ioremap_resource() to simplify code
  rtc: tegra: use devm_platform_ioremap_resource() to simplify code
  rtc: tx4939: use devm_platform_ioremap_resource() to simplify code
  rtc: vt8500: use devm_platform_ioremap_resource() to simplify code
  rtc: xgene: use devm_platform_ioremap_resource() to simplify code
  rtc: zynqmp: use devm_platform_ioremap_resource() to simplify code

 drivers/rtc/rtc-asm9260.c   | 4 +---
 drivers/rtc/rtc-aspeed.c| 4 +---
 drivers/rtc/rtc-at91sam9.c  | 4 +---
 drivers/rtc/rtc-brcmstb-waketimer.c | 4 +---
 drivers/rtc/rtc-cadence.c   | 4 +---
 drivers/rtc/rtc-coh901331.c | 4 +---
 drivers/rtc/rtc-davinci.c   | 4 +---
 drivers/rtc/rtc-digicolor.c | 4 +---
 drivers/rtc/rtc-ds1216.c| 4 +---
 drivers/rtc/rtc-ds1286.c| 4 +---
 drivers/rtc/rtc-ds1511.c| 4 +---
 drivers/rtc/rtc-ds1553.c| 4 +---
 drivers/rtc/rtc-ep93xx.c| 4 +---
 drivers/rtc/rtc-jz4740.c| 4 +---
 drivers/rtc/rtc-lpc24xx.c   | 4 +---
 drivers/rtc/rtc-lpc32xx.c   | 4 +---
 drivers/rtc/rtc-meson.c | 4 +---
 drivers/rtc/rtc-mt7622.c| 4 +---
 drivers/rtc/rtc-mv.c| 4 +---
 drivers/rtc/rtc-omap.c  | 4 +---
 drivers/rtc/rtc-pic32.c | 4 +---
 drivers/rtc/rtc-rtd119x.c   | 4 +---
 drivers/rtc/rtc-s3c.c   | 4 +---
 drivers/rtc/rtc-sa1100.c| 4 +---
 drivers/rtc/rtc-spear.c | 4 +---
 drivers/rtc/rtc-st-lpc.c| 4 +---
 drivers/rtc/rtc-stk17ta8.c  | 4 +---
 drivers/rtc/rtc-stm32.c | 4 +---
 drivers/rtc/rtc-sunxi.c | 4 +---
 drivers/rtc/rtc-tegra.c | 4 +---
 drivers/rtc/rtc-tx4939.c| 4 +---
 drivers/rtc/rtc-vt8500.c| 4 +---
 drivers/rtc/rtc-xgene.c | 4 +---
 drivers/rtc/rtc-zynqmp.c| 5 +
 34 files changed, 34 insertions(+), 103 deletions(-)

-- 
2.7.4




[PATCH -next 30/34] rtc: tegra: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-tegra.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
index 69d695b..0159069 100644
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@ -277,15 +277,13 @@ MODULE_DEVICE_TABLE(of, tegra_rtc_dt_match);
 static int tegra_rtc_probe(struct platform_device *pdev)
 {
struct tegra_rtc_info *info;
-   struct resource *res;
int ret;
 
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   info->base = devm_ioremap_resource(&pdev->dev, res);
+   info->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(info->base))
return PTR_ERR(info->base);
 
-- 
2.7.4




[PATCH -next 31/34] rtc: tx4939: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-tx4939.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-tx4939.c b/drivers/rtc/rtc-tx4939.c
index 5a29915..715b829 100644
--- a/drivers/rtc/rtc-tx4939.c
+++ b/drivers/rtc/rtc-tx4939.c
@@ -236,7 +236,6 @@ static int __init tx4939_rtc_probe(struct platform_device 
*pdev)
 {
struct rtc_device *rtc;
struct tx4939rtc_plat_data *pdata;
-   struct resource *res;
int irq, ret;
struct nvmem_config nvmem_cfg = {
.name = "tx4939_nvram",
@@ -253,8 +252,7 @@ static int __init tx4939_rtc_probe(struct platform_device 
*pdev)
return -ENOMEM;
platform_set_drvdata(pdev, pdata);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   pdata->rtcreg = devm_ioremap_resource(&pdev->dev, res);
+   pdata->rtcreg = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(pdata->rtcreg))
return PTR_ERR(pdata->rtcreg);
 
-- 
2.7.4




[PATCH -next 02/34] rtc: rtc-aspeed: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-aspeed.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-aspeed.c b/drivers/rtc/rtc-aspeed.c
index e351d35..eacdd06 100644
--- a/drivers/rtc/rtc-aspeed.c
+++ b/drivers/rtc/rtc-aspeed.c
@@ -85,14 +85,12 @@ static const struct rtc_class_ops aspeed_rtc_ops = {
 static int aspeed_rtc_probe(struct platform_device *pdev)
 {
struct aspeed_rtc *rtc;
-   struct resource *res;
 
rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
if (!rtc)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   rtc->base = devm_ioremap_resource(&pdev->dev, res);
+   rtc->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rtc->base))
return PTR_ERR(rtc->base);
 
-- 
2.7.4




[PATCH -next 22/34] rtc: s3c: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-s3c.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 7801249..e1b50e6 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -444,7 +444,6 @@ static int s3c_rtc_probe(struct platform_device *pdev)
 {
struct s3c_rtc *info = NULL;
struct rtc_time rtc_tm;
-   struct resource *res;
int ret;
 
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
@@ -475,8 +474,7 @@ static int s3c_rtc_probe(struct platform_device *pdev)
info->irq_tick, info->irq_alarm);
 
/* get the memory region */
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   info->base = devm_ioremap_resource(&pdev->dev, res);
+   info->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(info->base))
return PTR_ERR(info->base);
 
-- 
2.7.4




[PATCH -next 26/34] rtc: ds1286: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-ds1286.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c
index a06508b..7acf849 100644
--- a/drivers/rtc/rtc-ds1286.c
+++ b/drivers/rtc/rtc-ds1286.c
@@ -323,15 +323,13 @@ static const struct rtc_class_ops ds1286_ops = {
 static int ds1286_probe(struct platform_device *pdev)
 {
struct rtc_device *rtc;
-   struct resource *res;
struct ds1286_priv *priv;
 
priv = devm_kzalloc(&pdev->dev, sizeof(struct ds1286_priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   priv->rtcregs = devm_ioremap_resource(&pdev->dev, res);
+   priv->rtcregs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->rtcregs))
return PTR_ERR(priv->rtcregs);
 
-- 
2.7.4




[PATCH -next 05/34] rtc: cadence: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-cadence.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-cadence.c b/drivers/rtc/rtc-cadence.c
index 592aae2..595d5d2 100644
--- a/drivers/rtc/rtc-cadence.c
+++ b/drivers/rtc/rtc-cadence.c
@@ -255,7 +255,6 @@ static const struct rtc_class_ops cdns_rtc_ops = {
 static int cdns_rtc_probe(struct platform_device *pdev)
 {
struct cdns_rtc *crtc;
-   struct resource *res;
int ret;
unsigned long ref_clk_freq;
 
@@ -263,8 +262,7 @@ static int cdns_rtc_probe(struct platform_device *pdev)
if (!crtc)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   crtc->regs = devm_ioremap_resource(&pdev->dev, res);
+   crtc->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(crtc->regs))
return PTR_ERR(crtc->regs);
 
-- 
2.7.4




[PATCH -next 24/34] rtc: spear: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-spear.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index 9f23b24..833daeb 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -347,7 +347,6 @@ static const struct rtc_class_ops spear_rtc_ops = {
 
 static int spear_rtc_probe(struct platform_device *pdev)
 {
-   struct resource *res;
struct spear_rtc_config *config;
int status = 0;
int irq;
@@ -369,8 +368,7 @@ static int spear_rtc_probe(struct platform_device *pdev)
return status;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   config->ioaddr = devm_ioremap_resource(&pdev->dev, res);
+   config->ioaddr = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(config->ioaddr))
return PTR_ERR(config->ioaddr);
 
-- 
2.7.4




[PATCH -next 28/34] rtc: stm32: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-stm32.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index 2999e33..781cabb 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -693,15 +693,13 @@ static int stm32_rtc_probe(struct platform_device *pdev)
 {
struct stm32_rtc *rtc;
const struct stm32_rtc_registers *regs;
-   struct resource *res;
int ret;
 
rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
if (!rtc)
return -ENOMEM;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   rtc->base = devm_ioremap_resource(&pdev->dev, res);
+   rtc->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rtc->base))
return PTR_ERR(rtc->base);
 
-- 
2.7.4




[PATCH -next 23/34] rtc: sa1100: use devm_platform_ioremap_resource() to simplify code

2019-10-06 Thread YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing 
---
 drivers/rtc/rtc-sa1100.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index 86fa723..d37893f 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -252,7 +252,6 @@ EXPORT_SYMBOL_GPL(sa1100_rtc_init);
 static int sa1100_rtc_probe(struct platform_device *pdev)
 {
struct sa1100_rtc *info;
-   struct resource *iores;
void __iomem *base;
int irq_1hz, irq_alarm;
int ret;
@@ -281,8 +280,7 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
return ret;
}
 
-   iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   base = devm_ioremap_resource(&pdev->dev, iores);
+   base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
 
-- 
2.7.4




  1   2   3   4   5   6   7   8   9   10   >