Re: [PATCH 3/3] mm/page_owner: track page free call chain

2016-07-02 Thread Sergey Senozhatsky
On (07/03/16 01:16), Sergey Senozhatsky wrote:
[..]
> +#ifdef CONFIG_PAGE_OWNER_TRACK_FREE
> +void __page_owner_free_pages(struct page *page, unsigned int order)
> +{
> + int i;
> + depot_stack_handle_t handle;
> + struct page_ext *page_ext = lookup_page_ext(page);
> +
> + if (unlikely(!page_ext))
> + return;
> +
> + handle = save_stack(0);
> + page_ext->handles[PAGE_OWNER_HANDLE_FREE] = handle;
> + __set_bit(PAGE_EXT_OWNER_FREE, _ext->flags);
> +
> + for (i = 1; i < (1 << order); i++) {
> + struct page_ext *ext = lookup_page_ext(page + 1);
> +
> + if (unlikely(!ext))
> + continue;
> + ext->handles[PAGE_OWNER_HANDLE_FREE] = handle;
> + __set_bit(PAGE_EXT_OWNER_FREE, >flags);
> + }
> +}

I think this one is missing __clear_bit(PAGE_EXT_OWNER_ALLOC).

---
 mm/page_owner.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/page_owner.c b/mm/page_owner.c
index 5a108d6..699922c 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -154,6 +154,7 @@ void __page_owner_free_pages(struct page *page, unsigned 
int order)
handle = save_stack(0);
page_ext->handles[PAGE_OWNER_HANDLE_FREE] = handle;
__set_bit(PAGE_EXT_OWNER_FREE, _ext->flags);
+   __clear_bit(PAGE_EXT_OWNER_ALLOC, _ext->flags);
 
for (i = 1; i < (1 << order); i++) {
struct page_ext *ext = lookup_page_ext(page + 1);
@@ -162,6 +163,7 @@ void __page_owner_free_pages(struct page *page, unsigned 
int order)
continue;
ext->handles[PAGE_OWNER_HANDLE_FREE] = handle;
__set_bit(PAGE_EXT_OWNER_FREE, >flags);
+   __clear_bit(PAGE_EXT_OWNER_ALLOC, >flags);
}
 }
 #else
-- 
2.9.0.rc1



[PATCH] phy: fix error handling

2016-07-02 Thread Christophe JAILLET
This is likely that checking 'phy->hsic_clk' instead of 'phy->clk' is
expected here.

Signed-off-by: Christophe JAILLET 
---
 drivers/phy/phy-sun9i-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-sun9i-usb.c b/drivers/phy/phy-sun9i-usb.c
index ac4f31a..ff99eba 100644
--- a/drivers/phy/phy-sun9i-usb.c
+++ b/drivers/phy/phy-sun9i-usb.c
@@ -141,7 +141,7 @@ static int sun9i_usb_phy_probe(struct platform_device *pdev)
}
 
phy->hsic_clk = devm_clk_get(dev, "hsic_12M");
-   if (IS_ERR(phy->clk)) {
+   if (IS_ERR(phy->hsic_clk)) {
dev_err(dev, "failed to get hsic_12M clock\n");
return PTR_ERR(phy->clk);
}
-- 
2.7.4



Re: [PATCH 3/3] mm/page_owner: track page free call chain

2016-07-02 Thread Sergey Senozhatsky
On (07/03/16 01:16), Sergey Senozhatsky wrote:
[..]
> +#ifdef CONFIG_PAGE_OWNER_TRACK_FREE
> +void __page_owner_free_pages(struct page *page, unsigned int order)
> +{
> + int i;
> + depot_stack_handle_t handle;
> + struct page_ext *page_ext = lookup_page_ext(page);
> +
> + if (unlikely(!page_ext))
> + return;
> +
> + handle = save_stack(0);
> + page_ext->handles[PAGE_OWNER_HANDLE_FREE] = handle;
> + __set_bit(PAGE_EXT_OWNER_FREE, _ext->flags);
> +
> + for (i = 1; i < (1 << order); i++) {
> + struct page_ext *ext = lookup_page_ext(page + 1);
> +
> + if (unlikely(!ext))
> + continue;
> + ext->handles[PAGE_OWNER_HANDLE_FREE] = handle;
> + __set_bit(PAGE_EXT_OWNER_FREE, >flags);
> + }
> +}

I think this one is missing __clear_bit(PAGE_EXT_OWNER_ALLOC).

---
 mm/page_owner.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/page_owner.c b/mm/page_owner.c
index 5a108d6..699922c 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -154,6 +154,7 @@ void __page_owner_free_pages(struct page *page, unsigned 
int order)
handle = save_stack(0);
page_ext->handles[PAGE_OWNER_HANDLE_FREE] = handle;
__set_bit(PAGE_EXT_OWNER_FREE, _ext->flags);
+   __clear_bit(PAGE_EXT_OWNER_ALLOC, _ext->flags);
 
for (i = 1; i < (1 << order); i++) {
struct page_ext *ext = lookup_page_ext(page + 1);
@@ -162,6 +163,7 @@ void __page_owner_free_pages(struct page *page, unsigned 
int order)
continue;
ext->handles[PAGE_OWNER_HANDLE_FREE] = handle;
__set_bit(PAGE_EXT_OWNER_FREE, >flags);
+   __clear_bit(PAGE_EXT_OWNER_ALLOC, >flags);
}
 }
 #else
-- 
2.9.0.rc1



[PATCH] phy: fix error handling

2016-07-02 Thread Christophe JAILLET
This is likely that checking 'phy->hsic_clk' instead of 'phy->clk' is
expected here.

Signed-off-by: Christophe JAILLET 
---
 drivers/phy/phy-sun9i-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-sun9i-usb.c b/drivers/phy/phy-sun9i-usb.c
index ac4f31a..ff99eba 100644
--- a/drivers/phy/phy-sun9i-usb.c
+++ b/drivers/phy/phy-sun9i-usb.c
@@ -141,7 +141,7 @@ static int sun9i_usb_phy_probe(struct platform_device *pdev)
}
 
phy->hsic_clk = devm_clk_get(dev, "hsic_12M");
-   if (IS_ERR(phy->clk)) {
+   if (IS_ERR(phy->hsic_clk)) {
dev_err(dev, "failed to get hsic_12M clock\n");
return PTR_ERR(phy->clk);
}
-- 
2.7.4



Re: [PATCH] drm/mediatek: fix error handling

2016-07-02 Thread Matthias Brugger



On 07/03/2016 07:37 AM, Christophe JAILLET wrote:

This is likely that checking 'phy_provider' instead of 'phy' is
expected here.

Signed-off-by: Christophe JAILLET 
---
 drivers/gpu/drm/mediatek/mtk_mipi_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c 
b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
index cf8f38d..1c366f8 100644
--- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
+++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
@@ -431,7 +431,7 @@ static int mtk_mipi_tx_probe(struct platform_device *pdev)
phy_set_drvdata(phy, mipi_tx);

phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
-   if (IS_ERR(phy)) {
+   if (IS_ERR(phy_provider)) {


Dan already send a patch for that:
http://www.spinics.net/lists/dri-devel/msg112031.html

Regards,
Matthias


ret = PTR_ERR(phy_provider);
return ret;
}



Re: [PATCH] drm/mediatek: fix error handling

2016-07-02 Thread Matthias Brugger



On 07/03/2016 07:37 AM, Christophe JAILLET wrote:

This is likely that checking 'phy_provider' instead of 'phy' is
expected here.

Signed-off-by: Christophe JAILLET 
---
 drivers/gpu/drm/mediatek/mtk_mipi_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c 
b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
index cf8f38d..1c366f8 100644
--- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
+++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
@@ -431,7 +431,7 @@ static int mtk_mipi_tx_probe(struct platform_device *pdev)
phy_set_drvdata(phy, mipi_tx);

phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
-   if (IS_ERR(phy)) {
+   if (IS_ERR(phy_provider)) {


Dan already send a patch for that:
http://www.spinics.net/lists/dri-devel/msg112031.html

Regards,
Matthias


ret = PTR_ERR(phy_provider);
return ret;
}



[PATCH] drm/mediatek: fix error handling

2016-07-02 Thread Christophe JAILLET
This is likely that checking 'phy_provider' instead of 'phy' is
expected here.

Signed-off-by: Christophe JAILLET 
---
 drivers/gpu/drm/mediatek/mtk_mipi_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c 
b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
index cf8f38d..1c366f8 100644
--- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
+++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
@@ -431,7 +431,7 @@ static int mtk_mipi_tx_probe(struct platform_device *pdev)
phy_set_drvdata(phy, mipi_tx);
 
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
-   if (IS_ERR(phy)) {
+   if (IS_ERR(phy_provider)) {
ret = PTR_ERR(phy_provider);
return ret;
}
-- 
2.7.4



[PATCH] drm/mediatek: fix error handling

2016-07-02 Thread Christophe JAILLET
This is likely that checking 'phy_provider' instead of 'phy' is
expected here.

Signed-off-by: Christophe JAILLET 
---
 drivers/gpu/drm/mediatek/mtk_mipi_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c 
b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
index cf8f38d..1c366f8 100644
--- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
+++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
@@ -431,7 +431,7 @@ static int mtk_mipi_tx_probe(struct platform_device *pdev)
phy_set_drvdata(phy, mipi_tx);
 
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
-   if (IS_ERR(phy)) {
+   if (IS_ERR(phy_provider)) {
ret = PTR_ERR(phy_provider);
return ret;
}
-- 
2.7.4



Re: [PATCH v2 1/2] arm64: implement FTRACE_WITH_REGS

2016-07-02 Thread kbuild test robot
Hi,

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on v4.7-rc5 next-20160701]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Torsten-Duwe/arm64-live-patching/20160627-232728
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 
for-next/core
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   Makefile:687: Cannot use CONFIG_KCOV: -fsanitize-coverage=trace-pc is not 
supported by compiler
>> aarch64-linux-gnu-gcc: error: unrecognized command line option 
>> '-fprolog-pad=2'
   make[2]: *** [kernel/bounds.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH v2 1/2] arm64: implement FTRACE_WITH_REGS

2016-07-02 Thread kbuild test robot
Hi,

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on v4.7-rc5 next-20160701]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Torsten-Duwe/arm64-live-patching/20160627-232728
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 
for-next/core
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   Makefile:687: Cannot use CONFIG_KCOV: -fsanitize-coverage=trace-pc is not 
supported by compiler
>> aarch64-linux-gnu-gcc: error: unrecognized command line option 
>> '-fprolog-pad=2'
   make[2]: *** [kernel/bounds.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


0192688ec6: BUG: unable to handle kernel NULL pointer dereference at (null)

2016-07-02 Thread kernel test robot


FYI, we noticed the following commit:

https://github.com/0day-ci/linux 
frowand-list-gmail-com/Portable-Device-Tree-Connector-conceptual/20160703-081931
commit 0192688ec6f2161c0f2b99d38cc459f39285398f ("device tree connectors, using 
plugs and sockets.")

in testcase: boot

on test machine: 2 threads qemu-system-x86_64 -enable-kvm with 360M memory

caused below changes:


+--+--++
|  | v4.7-rc5 | 
0192688ec6 |
+--+--++
| boot_successes   | 25   | 
0  |
| boot_failures| 2| 
36 |
| BUG:kernel_test_crashed  | 1| 
   |
| backtrace:acpi_get_cpuid | 2| 
36 |
| backtrace:early_init_pdc | 2| 
36 |
| backtrace:acpi_early_processor_set_pdc   | 2| 
36 |
| backtrace:acpi_init  | 2| 
36 |
| backtrace:kernel_init_freeable   | 2| 
36 |
| backtrace:platform_device_add| 1| 
36 |
| backtrace:test_init  | 1| 
36 |
| backtrace:SYSC_setsockopt| 1| 
   |
| backtrace:SyS_setsockopt | 1| 
   |
| backtrace:do_msgrcv  | 1| 
   |
| backtrace:SyS_msgrcv | 1| 
   |
| invoked_oom-killer:gfp_mask=0x   | 1| 
   |
| Mem-Info | 1| 
   |
| Kernel_panic-not_syncing:Out_of_memory_and_no_killable_processes | 1| 
   |
| backtrace:vfs_write  | 1| 
   |
| backtrace:SyS_write  | 1| 
   |
| backtrace:populate_rootfs| 1| 
   |
| BUG:unable_to_handle_kernel  | 0| 
36 |
| Oops | 0| 
36 |
| RIP:of_free_overlay_info | 0| 
36 |
| Kernel_panic-not_syncing:Fatal_exception | 0| 
36 |
| backtrace:of_unittest| 0| 
36 |
+--+--++



[1.642416] CPU: 0 PID: 1 Comm: swapper Not tainted 4.7.0-rc5-1-g0192688 
#2
[1.642416] CPU: 0 PID: 1 Comm: swapper Not tainted 4.7.0-rc5-1-g0192688 
#2
[1.644871]  01ff
[1.644871]  01ff 8800136db978 8800136db978 
818c9b81 818c9b81 8800136db990 8800136db990

[1.647392]  8192be07
[1.647392]  8192be07 8305af40 8305af40 
8800136db9e0 8800136db9e0 8192c6e8 8192c6e8

[1.649899]  0203
[1.649899]  0203 312d 312d 
0036 0036  

[1.665240] Call Trace:
[1.665240] Call Trace:
[1.666067]  [] dump_stack+0x1e/0x20
[1.666067]  [] dump_stack+0x1e/0x20
[1.667785]  [] ubsan_epilogue+0x12/0x3e
[1.667785]  [] ubsan_epilogue+0x12/0x3e
[1.669590]  [] __ubsan_handle_out_of_bounds+0x64/0x79
[1.669590]  [] __ubsan_handle_out_of_bounds+0x64/0x79
[1.671857]  [] acpi_ds_create_operand+0x2f1/0x3b7
[1.671857]  [] acpi_ds_create_operand+0x2f1/0x3b7
[1.673948]  [] acpi_ds_create_operands+0x181/0x1e3
[1.673948]  [] acpi_ds_create_operands+0x181/0x1e3
[1.689106]  [] ? acpi_ps_pop_scope+0x149/0x155
[1.689106]  [] ? acpi_ps_pop_scope+0x149/0x155
[1.691133]  [] acpi_ds_exec_end_op+0x12d/0x6af
[1.691133]  [] acpi_ds_exec_end_op+0x12d/0x6af
[1.693154]  [] ? acpi_ds_exec_begin_op+0x245/0x245
[1.693154]  [] ? acpi_ds_exec_begin_op+0x245/0x245
[1.695287]  [] acpi_ps_parse_loop+0x8e2/0x963
[1.695287]  [] acpi_ps_parse_loop+0x8e2/0x963
[1.697279]  [] acpi_ps_parse_aml+0xf7/0x3f9
[1.697279]  [] acpi_ps_parse_aml+0xf7/0x3f9
[1.699223]  [] acpi_ps_execute_method+0x247/0x294
[1.699223]  [] acpi_ps_execute_method+0x247/0x294
[1.701319]  [] 

0192688ec6: BUG: unable to handle kernel NULL pointer dereference at (null)

2016-07-02 Thread kernel test robot


FYI, we noticed the following commit:

https://github.com/0day-ci/linux 
frowand-list-gmail-com/Portable-Device-Tree-Connector-conceptual/20160703-081931
commit 0192688ec6f2161c0f2b99d38cc459f39285398f ("device tree connectors, using 
plugs and sockets.")

in testcase: boot

on test machine: 2 threads qemu-system-x86_64 -enable-kvm with 360M memory

caused below changes:


+--+--++
|  | v4.7-rc5 | 
0192688ec6 |
+--+--++
| boot_successes   | 25   | 
0  |
| boot_failures| 2| 
36 |
| BUG:kernel_test_crashed  | 1| 
   |
| backtrace:acpi_get_cpuid | 2| 
36 |
| backtrace:early_init_pdc | 2| 
36 |
| backtrace:acpi_early_processor_set_pdc   | 2| 
36 |
| backtrace:acpi_init  | 2| 
36 |
| backtrace:kernel_init_freeable   | 2| 
36 |
| backtrace:platform_device_add| 1| 
36 |
| backtrace:test_init  | 1| 
36 |
| backtrace:SYSC_setsockopt| 1| 
   |
| backtrace:SyS_setsockopt | 1| 
   |
| backtrace:do_msgrcv  | 1| 
   |
| backtrace:SyS_msgrcv | 1| 
   |
| invoked_oom-killer:gfp_mask=0x   | 1| 
   |
| Mem-Info | 1| 
   |
| Kernel_panic-not_syncing:Out_of_memory_and_no_killable_processes | 1| 
   |
| backtrace:vfs_write  | 1| 
   |
| backtrace:SyS_write  | 1| 
   |
| backtrace:populate_rootfs| 1| 
   |
| BUG:unable_to_handle_kernel  | 0| 
36 |
| Oops | 0| 
36 |
| RIP:of_free_overlay_info | 0| 
36 |
| Kernel_panic-not_syncing:Fatal_exception | 0| 
36 |
| backtrace:of_unittest| 0| 
36 |
+--+--++



[1.642416] CPU: 0 PID: 1 Comm: swapper Not tainted 4.7.0-rc5-1-g0192688 
#2
[1.642416] CPU: 0 PID: 1 Comm: swapper Not tainted 4.7.0-rc5-1-g0192688 
#2
[1.644871]  01ff
[1.644871]  01ff 8800136db978 8800136db978 
818c9b81 818c9b81 8800136db990 8800136db990

[1.647392]  8192be07
[1.647392]  8192be07 8305af40 8305af40 
8800136db9e0 8800136db9e0 8192c6e8 8192c6e8

[1.649899]  0203
[1.649899]  0203 312d 312d 
0036 0036  

[1.665240] Call Trace:
[1.665240] Call Trace:
[1.666067]  [] dump_stack+0x1e/0x20
[1.666067]  [] dump_stack+0x1e/0x20
[1.667785]  [] ubsan_epilogue+0x12/0x3e
[1.667785]  [] ubsan_epilogue+0x12/0x3e
[1.669590]  [] __ubsan_handle_out_of_bounds+0x64/0x79
[1.669590]  [] __ubsan_handle_out_of_bounds+0x64/0x79
[1.671857]  [] acpi_ds_create_operand+0x2f1/0x3b7
[1.671857]  [] acpi_ds_create_operand+0x2f1/0x3b7
[1.673948]  [] acpi_ds_create_operands+0x181/0x1e3
[1.673948]  [] acpi_ds_create_operands+0x181/0x1e3
[1.689106]  [] ? acpi_ps_pop_scope+0x149/0x155
[1.689106]  [] ? acpi_ps_pop_scope+0x149/0x155
[1.691133]  [] acpi_ds_exec_end_op+0x12d/0x6af
[1.691133]  [] acpi_ds_exec_end_op+0x12d/0x6af
[1.693154]  [] ? acpi_ds_exec_begin_op+0x245/0x245
[1.693154]  [] ? acpi_ds_exec_begin_op+0x245/0x245
[1.695287]  [] acpi_ps_parse_loop+0x8e2/0x963
[1.695287]  [] acpi_ps_parse_loop+0x8e2/0x963
[1.697279]  [] acpi_ps_parse_aml+0xf7/0x3f9
[1.697279]  [] acpi_ps_parse_aml+0xf7/0x3f9
[1.699223]  [] acpi_ps_execute_method+0x247/0x294
[1.699223]  [] acpi_ps_execute_method+0x247/0x294
[1.701319]  [] 

[PATCH] fs: btrfs: Replace -ENOENT by -ERANGE in btrfs_get_acl()

2016-07-02 Thread Salah Triki
size contains the value returned by posix_acl_from_xattr(), which
returns -ERANGE, -ENODATA, zero, or an integer greater than zero. So
replace -ENOENT by -ERANGE.

Signed-off-by: Salah Triki 
---
 fs/btrfs/acl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 67a6077..53bb7af 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -55,8 +55,7 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
}
if (size > 0) {
acl = posix_acl_from_xattr(_user_ns, value, size);
-   } else if (size == -ENOENT || size == -ENODATA || size == 0) {
-   /* FIXME, who returns -ENOENT?  I think nobody */
+   } else if (size == -ERANGE || size == -ENODATA || size == 0) {
acl = NULL;
} else {
acl = ERR_PTR(-EIO);
-- 
1.9.1



[PATCH] fs: btrfs: Replace -ENOENT by -ERANGE in btrfs_get_acl()

2016-07-02 Thread Salah Triki
size contains the value returned by posix_acl_from_xattr(), which
returns -ERANGE, -ENODATA, zero, or an integer greater than zero. So
replace -ENOENT by -ERANGE.

Signed-off-by: Salah Triki 
---
 fs/btrfs/acl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 67a6077..53bb7af 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -55,8 +55,7 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
}
if (size > 0) {
acl = posix_acl_from_xattr(_user_ns, value, size);
-   } else if (size == -ENOENT || size == -ENODATA || size == 0) {
-   /* FIXME, who returns -ENOENT?  I think nobody */
+   } else if (size == -ERANGE || size == -ENODATA || size == 0) {
acl = NULL;
} else {
acl = ERR_PTR(-EIO);
-- 
1.9.1



[PATCH] Staging: rtl8712: Fixed brace and comment style issue

2016-07-02 Thread Anuradha Weeraman
Fixed issues with coding style.

Signed-off-by: Anuradha Weeraman 
---
 drivers/staging/rtl8712/xmit_linux.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8712/xmit_linux.c 
b/drivers/staging/rtl8712/xmit_linux.c
index 695f9b9..1e86133 100644
--- a/drivers/staging/rtl8712/xmit_linux.c
+++ b/drivers/staging/rtl8712/xmit_linux.c
@@ -91,7 +91,8 @@ void r8712_set_qos(struct pkt_file *ppktfile, struct 
pkt_attrib *pattrib)
} else {
/* "When priority processing of data frames is supported,
 * a STA's SME should send EAPOL-Key frames at the highest
-* priority." */
+* priority."
+*/
 
if (pattrib->ether_type == 0x888e)
UserPriority = 7;
@@ -162,16 +163,16 @@ int r8712_xmit_entry(_pkt *pkt, struct  net_device 
*pnetdev)
struct _adapter *padapter = netdev_priv(pnetdev);
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
 
-   if (!r8712_if_up(padapter)) {
+   if (!r8712_if_up(padapter))
goto _xmit_entry_drop;
-   }
+
pxmitframe = r8712_alloc_xmitframe(pxmitpriv);
-   if (!pxmitframe) {
+   if (!pxmitframe)
goto _xmit_entry_drop;
-   }
-   if ((!r8712_update_attrib(padapter, pkt, >attrib))) {
+
+   if ((!r8712_update_attrib(padapter, pkt, >attrib)))
goto _xmit_entry_drop;
-   }
+
padapter->ledpriv.LedControlHandler(padapter, LED_CTL_TX);
pxmitframe->pkt = pkt;
if (r8712_pre_xmit(padapter, pxmitframe)) {
-- 
2.9.0



[PATCH] Staging: rtl8712: Fixed brace and comment style issue

2016-07-02 Thread Anuradha Weeraman
Fixed issues with coding style.

Signed-off-by: Anuradha Weeraman 
---
 drivers/staging/rtl8712/xmit_linux.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8712/xmit_linux.c 
b/drivers/staging/rtl8712/xmit_linux.c
index 695f9b9..1e86133 100644
--- a/drivers/staging/rtl8712/xmit_linux.c
+++ b/drivers/staging/rtl8712/xmit_linux.c
@@ -91,7 +91,8 @@ void r8712_set_qos(struct pkt_file *ppktfile, struct 
pkt_attrib *pattrib)
} else {
/* "When priority processing of data frames is supported,
 * a STA's SME should send EAPOL-Key frames at the highest
-* priority." */
+* priority."
+*/
 
if (pattrib->ether_type == 0x888e)
UserPriority = 7;
@@ -162,16 +163,16 @@ int r8712_xmit_entry(_pkt *pkt, struct  net_device 
*pnetdev)
struct _adapter *padapter = netdev_priv(pnetdev);
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
 
-   if (!r8712_if_up(padapter)) {
+   if (!r8712_if_up(padapter))
goto _xmit_entry_drop;
-   }
+
pxmitframe = r8712_alloc_xmitframe(pxmitpriv);
-   if (!pxmitframe) {
+   if (!pxmitframe)
goto _xmit_entry_drop;
-   }
-   if ((!r8712_update_attrib(padapter, pkt, >attrib))) {
+
+   if ((!r8712_update_attrib(padapter, pkt, >attrib)))
goto _xmit_entry_drop;
-   }
+
padapter->ledpriv.LedControlHandler(padapter, LED_CTL_TX);
pxmitframe->pkt = pkt;
if (r8712_pre_xmit(padapter, pxmitframe)) {
-- 
2.9.0



fs/xfs/xfs_ondisk.h:86:2: error: call to '__compiletime_assert_86' declared with attribute error: XFS: sizeof(xfs_dir2_data_unused_t) is wrong, expected 6

2016-07-02 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   99b0f54e6a3a4012aacfaada5644a8e520447d80
commit: ab9d1e4f7b0217948a3b35a64178602ab30ff45d Merge branch 
'xfs-misc-fixes-4.6-3' into for-next
date:   4 months ago
config: openrisc-allmodconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout ab9d1e4f7b0217948a3b35a64178602ab30ff45d
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All errors (new ones prefixed by >>):

   In file included from fs/xfs/xfs_super.c:48:0:
   In function 'xfs_check_ondisk_structs',
   inlined from 'init_xfs_fs' at fs/xfs/xfs_super.c:1862:26:
>> fs/xfs/xfs_ondisk.h:86:2: error: call to '__compiletime_assert_86' declared 
>> with attribute error: XFS: sizeof(xfs_dir2_data_unused_t) is wrong, expected 
>> 6
>> fs/xfs/xfs_ondisk.h:96:2: error: call to '__compiletime_assert_96' declared 
>> with attribute error: XFS: sizeof(xfs_dir2_sf_entry_t) is wrong, expected 3
>> fs/xfs/xfs_ondisk.h:97:2: error: call to '__compiletime_assert_97' declared 
>> with attribute error: XFS: sizeof(xfs_dir2_sf_hdr_t) is wrong, expected 10

vim +/__compiletime_assert_86 +86 fs/xfs/xfs_ondisk.h

30cbc591 Darrick J. Wong 2016-03-09   80
XFS_CHECK_STRUCT_SIZE(xfs_da_blkinfo_t, 12);
30cbc591 Darrick J. Wong 2016-03-09   81
XFS_CHECK_STRUCT_SIZE(xfs_da_intnode_t, 16);
30cbc591 Darrick J. Wong 2016-03-09   82
XFS_CHECK_STRUCT_SIZE(xfs_da_node_entry_t,  8);
30cbc591 Darrick J. Wong 2016-03-09   83
XFS_CHECK_STRUCT_SIZE(xfs_da_node_hdr_t,16);
30cbc591 Darrick J. Wong 2016-03-09   84
XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_free_t, 4);
30cbc591 Darrick J. Wong 2016-03-09   85
XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_hdr_t,  16);
30cbc591 Darrick J. Wong 2016-03-09  @86
XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_unused_t,   6);
30cbc591 Darrick J. Wong 2016-03-09   87
XFS_CHECK_STRUCT_SIZE(xfs_dir2_free_hdr_t,  16);
30cbc591 Darrick J. Wong 2016-03-09   88
XFS_CHECK_STRUCT_SIZE(xfs_dir2_free_t,  16);
30cbc591 Darrick J. Wong 2016-03-09   89
XFS_CHECK_STRUCT_SIZE(xfs_dir2_ino4_t,  4);
30cbc591 Darrick J. Wong 2016-03-09   90
XFS_CHECK_STRUCT_SIZE(xfs_dir2_ino8_t,  8);
30cbc591 Darrick J. Wong 2016-03-09   91
XFS_CHECK_STRUCT_SIZE(xfs_dir2_inou_t,  8);
30cbc591 Darrick J. Wong 2016-03-09   92
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_entry_t,8);
30cbc591 Darrick J. Wong 2016-03-09   93
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_hdr_t,  16);
30cbc591 Darrick J. Wong 2016-03-09   94
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_t,  16);
30cbc591 Darrick J. Wong 2016-03-09   95
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_tail_t, 4);
30cbc591 Darrick J. Wong 2016-03-09  @96
XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_entry_t,  3);
30cbc591 Darrick J. Wong 2016-03-09  @97
XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_hdr_t,10);
30cbc591 Darrick J. Wong 2016-03-09   98
XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_off_t,2);
30cbc591 Darrick J. Wong 2016-03-09   99  
30cbc591 Darrick J. Wong 2016-03-09  100/* log structures */

:: The code at line 86 was first introduced by commit
:: 30cbc591c34e680e8b5d6d675ea49effe42a0570 xfs: check sizes of XFS on-disk 
structures at compile time

:: TO: Darrick J. Wong 
:: CC: Dave Chinner 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


fs/xfs/xfs_ondisk.h:86:2: error: call to '__compiletime_assert_86' declared with attribute error: XFS: sizeof(xfs_dir2_data_unused_t) is wrong, expected 6

2016-07-02 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   99b0f54e6a3a4012aacfaada5644a8e520447d80
commit: ab9d1e4f7b0217948a3b35a64178602ab30ff45d Merge branch 
'xfs-misc-fixes-4.6-3' into for-next
date:   4 months ago
config: openrisc-allmodconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout ab9d1e4f7b0217948a3b35a64178602ab30ff45d
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All errors (new ones prefixed by >>):

   In file included from fs/xfs/xfs_super.c:48:0:
   In function 'xfs_check_ondisk_structs',
   inlined from 'init_xfs_fs' at fs/xfs/xfs_super.c:1862:26:
>> fs/xfs/xfs_ondisk.h:86:2: error: call to '__compiletime_assert_86' declared 
>> with attribute error: XFS: sizeof(xfs_dir2_data_unused_t) is wrong, expected 
>> 6
>> fs/xfs/xfs_ondisk.h:96:2: error: call to '__compiletime_assert_96' declared 
>> with attribute error: XFS: sizeof(xfs_dir2_sf_entry_t) is wrong, expected 3
>> fs/xfs/xfs_ondisk.h:97:2: error: call to '__compiletime_assert_97' declared 
>> with attribute error: XFS: sizeof(xfs_dir2_sf_hdr_t) is wrong, expected 10

vim +/__compiletime_assert_86 +86 fs/xfs/xfs_ondisk.h

30cbc591 Darrick J. Wong 2016-03-09   80
XFS_CHECK_STRUCT_SIZE(xfs_da_blkinfo_t, 12);
30cbc591 Darrick J. Wong 2016-03-09   81
XFS_CHECK_STRUCT_SIZE(xfs_da_intnode_t, 16);
30cbc591 Darrick J. Wong 2016-03-09   82
XFS_CHECK_STRUCT_SIZE(xfs_da_node_entry_t,  8);
30cbc591 Darrick J. Wong 2016-03-09   83
XFS_CHECK_STRUCT_SIZE(xfs_da_node_hdr_t,16);
30cbc591 Darrick J. Wong 2016-03-09   84
XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_free_t, 4);
30cbc591 Darrick J. Wong 2016-03-09   85
XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_hdr_t,  16);
30cbc591 Darrick J. Wong 2016-03-09  @86
XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_unused_t,   6);
30cbc591 Darrick J. Wong 2016-03-09   87
XFS_CHECK_STRUCT_SIZE(xfs_dir2_free_hdr_t,  16);
30cbc591 Darrick J. Wong 2016-03-09   88
XFS_CHECK_STRUCT_SIZE(xfs_dir2_free_t,  16);
30cbc591 Darrick J. Wong 2016-03-09   89
XFS_CHECK_STRUCT_SIZE(xfs_dir2_ino4_t,  4);
30cbc591 Darrick J. Wong 2016-03-09   90
XFS_CHECK_STRUCT_SIZE(xfs_dir2_ino8_t,  8);
30cbc591 Darrick J. Wong 2016-03-09   91
XFS_CHECK_STRUCT_SIZE(xfs_dir2_inou_t,  8);
30cbc591 Darrick J. Wong 2016-03-09   92
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_entry_t,8);
30cbc591 Darrick J. Wong 2016-03-09   93
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_hdr_t,  16);
30cbc591 Darrick J. Wong 2016-03-09   94
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_t,  16);
30cbc591 Darrick J. Wong 2016-03-09   95
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_tail_t, 4);
30cbc591 Darrick J. Wong 2016-03-09  @96
XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_entry_t,  3);
30cbc591 Darrick J. Wong 2016-03-09  @97
XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_hdr_t,10);
30cbc591 Darrick J. Wong 2016-03-09   98
XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_off_t,2);
30cbc591 Darrick J. Wong 2016-03-09   99  
30cbc591 Darrick J. Wong 2016-03-09  100/* log structures */

:: The code at line 86 was first introduced by commit
:: 30cbc591c34e680e8b5d6d675ea49effe42a0570 xfs: check sizes of XFS on-disk 
structures at compile time

:: TO: Darrick J. Wong 
:: CC: Dave Chinner 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH] thermal: rcar-thermal: enable hwmon when thermal_zone

2016-07-02 Thread kbuild test robot
Hi,

[auto build test ERROR on thermal/next]
[also build test ERROR on v4.7-rc5 next-20160701]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Kuninori-Morimoto/thermal-rcar-thermal-enable-hwmon-when-thermal_zone/20160622-083954
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next
config: s390-allmodconfig (attached as .config)
compiler: s390x-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=s390 

All errors (new ones prefixed by >>):

>> ERROR: "thermal_remove_hwmon_sysfs" [drivers/thermal/rcar_thermal.ko] 
>> undefined!
>> ERROR: "thermal_add_hwmon_sysfs" [drivers/thermal/rcar_thermal.ko] undefined!

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH] thermal: rcar-thermal: enable hwmon when thermal_zone

2016-07-02 Thread kbuild test robot
Hi,

[auto build test ERROR on thermal/next]
[also build test ERROR on v4.7-rc5 next-20160701]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Kuninori-Morimoto/thermal-rcar-thermal-enable-hwmon-when-thermal_zone/20160622-083954
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next
config: s390-allmodconfig (attached as .config)
compiler: s390x-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=s390 

All errors (new ones prefixed by >>):

>> ERROR: "thermal_remove_hwmon_sysfs" [drivers/thermal/rcar_thermal.ko] 
>> undefined!
>> ERROR: "thermal_add_hwmon_sysfs" [drivers/thermal/rcar_thermal.ko] undefined!

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH] Crypto:Add HMAC-SHA3 test modes and test vectors

2016-07-02 Thread Herbert Xu
On Fri, Jul 01, 2016 at 11:16:54AM +0530, Raveendra Padasalagi wrote:
> This patch adds HMAC-SHA3 test modes in tcrypt module
> and related test vectors.
> 
> Signed-off-by: Raveendra Padasalagi 

Patch applied.  Thanks.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Re: [PATCH] Crypto:Add HMAC-SHA3 test modes and test vectors

2016-07-02 Thread Herbert Xu
On Fri, Jul 01, 2016 at 11:16:54AM +0530, Raveendra Padasalagi wrote:
> This patch adds HMAC-SHA3 test modes in tcrypt module
> and related test vectors.
> 
> Signed-off-by: Raveendra Padasalagi 

Patch applied.  Thanks.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Re: [PATCH] crypto: omap-sham - increase cra_proirity to 400

2016-07-02 Thread Herbert Xu
On Wed, Jun 29, 2016 at 11:11:36AM -0500, Bin Liu wrote:
> Some software alg has cra_priority as higher as 300, so increase
> omap-sham priority to 400 to ensure it is on top of any software alg.
> 
> Signed-off-by: Bin Liu 

Patch applied.  Thanks.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Re: [PATCH] crypto: omap-sham - increase cra_proirity to 400

2016-07-02 Thread Herbert Xu
On Wed, Jun 29, 2016 at 11:11:36AM -0500, Bin Liu wrote:
> Some software alg has cra_priority as higher as 300, so increase
> omap-sham priority to 400 to ensure it is on top of any software alg.
> 
> Signed-off-by: Bin Liu 

Patch applied.  Thanks.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


include/linux/kprobes.h:332:2: error: invalid use of undefined type 'struct kprobe_ctlblk'

2016-07-02 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   99b0f54e6a3a4012aacfaada5644a8e520447d80
commit: abec1a806e0c3cf168999667d5fb6218398ef12a percpu: Make __verify_pcu_ptr 
handle per cpu pointers to arrays
date:   2 years, 10 months ago
config: mn10300-allyesconfig (attached as .config)
compiler: am33_2.0-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout abec1a806e0c3cf168999667d5fb6218398ef12a
# save the attached .config to linux build tree
make.cross ARCH=mn10300 

All errors (new ones prefixed by >>):

   In file included from net/dccp/probe.c:26:0:
   include/linux/kprobes.h: In function 'get_kprobe_ctlblk':
>> include/linux/kprobes.h:332:2: error: invalid use of undefined type 'struct 
>> kprobe_ctlblk'
 return (&__get_cpu_var(kprobe_ctlblk));
 ^
   In file included from arch/mn10300/include/asm/percpu.h:1:0,
from include/linux/percpu.h:10,
from include/linux/kprobes.h:38,
from net/dccp/probe.c:26:
   include/asm-generic/percpu.h:83:29: error: dereferencing pointer to 
incomplete type
#define __get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var)))
^
   include/linux/kprobes.h:332:11: note: in expansion of macro '__get_cpu_var'
 return (&__get_cpu_var(kprobe_ctlblk));
  ^

vim +332 include/linux/kprobes.h

ef53d9c5 Srinivasa D S  2008-07-25  316  void 
kretprobe_hash_unlock(struct task_struct *tsk, unsigned long *flags);
b94cce92 Hien Nguyen2005-06-23  317  struct hlist_head * 
kretprobe_inst_table_head(struct task_struct *tsk);
^1da177e Linus Torvalds 2005-04-16  318  
e6584523 Ananth N Mavinakayanahalli 2005-11-07  319  /* kprobe_running() will 
just return the current_kprobe on this CPU */
e6584523 Ananth N Mavinakayanahalli 2005-11-07  320  static inline struct 
kprobe *kprobe_running(void)
e6584523 Ananth N Mavinakayanahalli 2005-11-07  321  {
b76834bc Christoph Lameter  2010-12-06  322 return 
(__this_cpu_read(current_kprobe));
e6584523 Ananth N Mavinakayanahalli 2005-11-07  323  }
e6584523 Ananth N Mavinakayanahalli 2005-11-07  324  
e6584523 Ananth N Mavinakayanahalli 2005-11-07  325  static inline void 
reset_current_kprobe(void)
e6584523 Ananth N Mavinakayanahalli 2005-11-07  326  {
b76834bc Christoph Lameter  2010-12-06  327 
__this_cpu_write(current_kprobe, NULL);
e6584523 Ananth N Mavinakayanahalli 2005-11-07  328  }
e6584523 Ananth N Mavinakayanahalli 2005-11-07  329  
e6584523 Ananth N Mavinakayanahalli 2005-11-07  330  static inline struct 
kprobe_ctlblk *get_kprobe_ctlblk(void)
e6584523 Ananth N Mavinakayanahalli 2005-11-07  331  {
e6584523 Ananth N Mavinakayanahalli 2005-11-07 @332 return 
(&__get_cpu_var(kprobe_ctlblk));
e6584523 Ananth N Mavinakayanahalli 2005-11-07  333  }
e6584523 Ananth N Mavinakayanahalli 2005-11-07  334  
^1da177e Linus Torvalds 2005-04-16  335  int register_kprobe(struct 
kprobe *p);
^1da177e Linus Torvalds 2005-04-16  336  void 
unregister_kprobe(struct kprobe *p);
9861668f Masami Hiramatsu   2008-04-28  337  int 
register_kprobes(struct kprobe **kps, int num);
9861668f Masami Hiramatsu   2008-04-28  338  void 
unregister_kprobes(struct kprobe **kps, int num);
^1da177e Linus Torvalds 2005-04-16  339  int 
setjmp_pre_handler(struct kprobe *, struct pt_regs *);
^1da177e Linus Torvalds 2005-04-16  340  int 
longjmp_break_handler(struct kprobe *, struct pt_regs *);

:: The code at line 332 was first introduced by commit
:: e65845235c8120be63001fc1a4ac00c819194bbe [PATCH] Kprobes: Track kprobe 
on a per_cpu basis - base changes

:: TO: Ananth N Mavinakayanahalli 
:: CC: Linus Torvalds 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


include/linux/kprobes.h:332:2: error: invalid use of undefined type 'struct kprobe_ctlblk'

2016-07-02 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   99b0f54e6a3a4012aacfaada5644a8e520447d80
commit: abec1a806e0c3cf168999667d5fb6218398ef12a percpu: Make __verify_pcu_ptr 
handle per cpu pointers to arrays
date:   2 years, 10 months ago
config: mn10300-allyesconfig (attached as .config)
compiler: am33_2.0-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout abec1a806e0c3cf168999667d5fb6218398ef12a
# save the attached .config to linux build tree
make.cross ARCH=mn10300 

All errors (new ones prefixed by >>):

   In file included from net/dccp/probe.c:26:0:
   include/linux/kprobes.h: In function 'get_kprobe_ctlblk':
>> include/linux/kprobes.h:332:2: error: invalid use of undefined type 'struct 
>> kprobe_ctlblk'
 return (&__get_cpu_var(kprobe_ctlblk));
 ^
   In file included from arch/mn10300/include/asm/percpu.h:1:0,
from include/linux/percpu.h:10,
from include/linux/kprobes.h:38,
from net/dccp/probe.c:26:
   include/asm-generic/percpu.h:83:29: error: dereferencing pointer to 
incomplete type
#define __get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var)))
^
   include/linux/kprobes.h:332:11: note: in expansion of macro '__get_cpu_var'
 return (&__get_cpu_var(kprobe_ctlblk));
  ^

vim +332 include/linux/kprobes.h

ef53d9c5 Srinivasa D S  2008-07-25  316  void 
kretprobe_hash_unlock(struct task_struct *tsk, unsigned long *flags);
b94cce92 Hien Nguyen2005-06-23  317  struct hlist_head * 
kretprobe_inst_table_head(struct task_struct *tsk);
^1da177e Linus Torvalds 2005-04-16  318  
e6584523 Ananth N Mavinakayanahalli 2005-11-07  319  /* kprobe_running() will 
just return the current_kprobe on this CPU */
e6584523 Ananth N Mavinakayanahalli 2005-11-07  320  static inline struct 
kprobe *kprobe_running(void)
e6584523 Ananth N Mavinakayanahalli 2005-11-07  321  {
b76834bc Christoph Lameter  2010-12-06  322 return 
(__this_cpu_read(current_kprobe));
e6584523 Ananth N Mavinakayanahalli 2005-11-07  323  }
e6584523 Ananth N Mavinakayanahalli 2005-11-07  324  
e6584523 Ananth N Mavinakayanahalli 2005-11-07  325  static inline void 
reset_current_kprobe(void)
e6584523 Ananth N Mavinakayanahalli 2005-11-07  326  {
b76834bc Christoph Lameter  2010-12-06  327 
__this_cpu_write(current_kprobe, NULL);
e6584523 Ananth N Mavinakayanahalli 2005-11-07  328  }
e6584523 Ananth N Mavinakayanahalli 2005-11-07  329  
e6584523 Ananth N Mavinakayanahalli 2005-11-07  330  static inline struct 
kprobe_ctlblk *get_kprobe_ctlblk(void)
e6584523 Ananth N Mavinakayanahalli 2005-11-07  331  {
e6584523 Ananth N Mavinakayanahalli 2005-11-07 @332 return 
(&__get_cpu_var(kprobe_ctlblk));
e6584523 Ananth N Mavinakayanahalli 2005-11-07  333  }
e6584523 Ananth N Mavinakayanahalli 2005-11-07  334  
^1da177e Linus Torvalds 2005-04-16  335  int register_kprobe(struct 
kprobe *p);
^1da177e Linus Torvalds 2005-04-16  336  void 
unregister_kprobe(struct kprobe *p);
9861668f Masami Hiramatsu   2008-04-28  337  int 
register_kprobes(struct kprobe **kps, int num);
9861668f Masami Hiramatsu   2008-04-28  338  void 
unregister_kprobes(struct kprobe **kps, int num);
^1da177e Linus Torvalds 2005-04-16  339  int 
setjmp_pre_handler(struct kprobe *, struct pt_regs *);
^1da177e Linus Torvalds 2005-04-16  340  int 
longjmp_break_handler(struct kprobe *, struct pt_regs *);

:: The code at line 332 was first introduced by commit
:: e65845235c8120be63001fc1a4ac00c819194bbe [PATCH] Kprobes: Track kprobe 
on a per_cpu basis - base changes

:: TO: Ananth N Mavinakayanahalli 
:: CC: Linus Torvalds 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


(.init.text+0x2b8): multiple definition of `plat_irq_setup'

2016-07-02 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   99b0f54e6a3a4012aacfaada5644a8e520447d80
commit: 7480e0aabd5f9e6c3e3b72ed206e89284e90f11f sh: add device tree support 
and generic board using device tree
date:   4 months ago
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 7480e0aabd5f9e6c3e3b72ed206e89284e90f11f
# save the attached .config to linux build tree
make.cross ARCH=sh 

All errors (new ones prefixed by >>):

   arch/sh/boards/built-in.o: In function `plat_irq_setup':
>> (.init.text+0x2b8): multiple definition of `plat_irq_setup'
   arch/sh/kernel/built-in.o:(.init.text+0x1224): first defined here
   arch/sh/boards/built-in.o: In function `arch_init_clk_ops':
>> (.init.text+0x294): multiple definition of `arch_init_clk_ops'
   arch/sh/kernel/built-in.o:(.init.text+0x12d4): first defined here

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


(.init.text+0x2b8): multiple definition of `plat_irq_setup'

2016-07-02 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   99b0f54e6a3a4012aacfaada5644a8e520447d80
commit: 7480e0aabd5f9e6c3e3b72ed206e89284e90f11f sh: add device tree support 
and generic board using device tree
date:   4 months ago
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 7480e0aabd5f9e6c3e3b72ed206e89284e90f11f
# save the attached .config to linux build tree
make.cross ARCH=sh 

All errors (new ones prefixed by >>):

   arch/sh/boards/built-in.o: In function `plat_irq_setup':
>> (.init.text+0x2b8): multiple definition of `plat_irq_setup'
   arch/sh/kernel/built-in.o:(.init.text+0x1224): first defined here
   arch/sh/boards/built-in.o: In function `arch_init_clk_ops':
>> (.init.text+0x294): multiple definition of `arch_init_clk_ops'
   arch/sh/kernel/built-in.o:(.init.text+0x12d4): first defined here

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH 1/1] irqdomain: Fix irq_domain_alloc_irqs_recursive() error handling

2016-07-02 Thread Alexander Popov
If an irq_domain is auto-recursive and irq_domain_alloc_irqs_recursive()
for its parent has returned an error, then do return and avoid calling
irq_domain_free_irqs_recursive() uselessly, because:
- if domain->ops->alloc() had failed for an auto-recursive irq_domain,
   then irq_domain_free_irqs_recursive() had already been called;
- if domain->ops->alloc() had failed for a not auto-recursive irq_domain,
   then there is nothing to free at all.

Signed-off-by: Alexander Popov 
---
 kernel/irq/irqdomain.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 8798b6c..6458e34 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -1144,8 +1144,10 @@ int irq_domain_alloc_irqs_recursive(struct irq_domain 
*domain,
if (recursive)
ret = irq_domain_alloc_irqs_recursive(parent, irq_base,
  nr_irqs, arg);
-   if (ret >= 0)
-   ret = domain->ops->alloc(domain, irq_base, nr_irqs, arg);
+   if (ret < 0)
+   return ret;
+
+   ret = domain->ops->alloc(domain, irq_base, nr_irqs, arg);
if (ret < 0 && recursive)
irq_domain_free_irqs_recursive(parent, irq_base, nr_irqs);
 
-- 
1.9.1



[PATCH 1/1] irqdomain: Fix irq_domain_alloc_irqs_recursive() error handling

2016-07-02 Thread Alexander Popov
If an irq_domain is auto-recursive and irq_domain_alloc_irqs_recursive()
for its parent has returned an error, then do return and avoid calling
irq_domain_free_irqs_recursive() uselessly, because:
- if domain->ops->alloc() had failed for an auto-recursive irq_domain,
   then irq_domain_free_irqs_recursive() had already been called;
- if domain->ops->alloc() had failed for a not auto-recursive irq_domain,
   then there is nothing to free at all.

Signed-off-by: Alexander Popov 
---
 kernel/irq/irqdomain.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 8798b6c..6458e34 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -1144,8 +1144,10 @@ int irq_domain_alloc_irqs_recursive(struct irq_domain 
*domain,
if (recursive)
ret = irq_domain_alloc_irqs_recursive(parent, irq_base,
  nr_irqs, arg);
-   if (ret >= 0)
-   ret = domain->ops->alloc(domain, irq_base, nr_irqs, arg);
+   if (ret < 0)
+   return ret;
+
+   ret = domain->ops->alloc(domain, irq_base, nr_irqs, arg);
if (ret < 0 && recursive)
irq_domain_free_irqs_recursive(parent, irq_base, nr_irqs);
 
-- 
1.9.1



Re: [RFC 0/1] ARM: print MHz in /proc/cpuinfo

2016-07-02 Thread Jon Masters
Hi Russell, Jon,

On 06/07/2016 06:18 PM, Russell King - ARM Linux wrote:
> On Tue, Jun 07, 2016 at 05:08:32PM -0400, Jon Mason wrote:
>> Many users (and some applications) are expecting the CPU clock speed to
>> be output in /proc/cpuinfo (as is done in x86, avr32, c6x, tile, parisc,
>> ia64, and xtensa).
> 
> Such as what applications?  This is just another meaningless number,
> which is just as meaningless as the bogomips number.  It tells you
> nothing really about the CPU which should remotely be used for
> anything other than user display.  It certainly can't be used for
> algorithmic selection.

Agreed. HOWEVER...

We'll be coming back to add this for servers soon enough. It's on the
todo, we just need a nice way to extract this information (as has been
discussed). That's likely to be through DMI data or an ACPI addition
that will be required and mandatory at some future point.


> We have resisted publishing this information for years because not
> every ARM CPU is capable of providing this information - for many, we
> don't know what the CPU clock rate even is.  I believe it is a mistake
> to publish this information.

There are two specific problems on ARM servers:

1). Idiots. I've seen many situations in which benchmarks were run on
pre-production machines (often explicitly against legal agreements, but
those never happened within my organization so that's their problem -
this is carefully prohibited activity within our own walls and I make
sure our guys never run any numbers on pre-production stuff just so it
could never get into the "wrong" hands by accident...). What these
idiots do is then spread rumors that ARM server X "sucks" because they
ran a prohibited benchmark against a downclocked core and forgot how to
multiply numbers together. It gets worse. But usually it's because they
ran "cat /proc/cpuinfo" and it didn't tell them anything useful, so they
used whatever they thought the frequency was supposed to be.

These idiots include journalists. If you read the press, you'll see the
Gandhi sequence is playing out already between one of the established
vendors and an ARM vendor in which said established vendor is at the
laughing/fighting stage of things. And in a couple of cases recently,
the press included "we didn't know how fast it ran because /proc/cpuinfo
didn't tell us anything, so we guessed".

2). Users. Those who use and admin servers get the "speed" from
/proc/cpuinfo. It's a marketing number. It's useless. It absolutely must
be provided to the user or administrator exactly like on x86.

> If userspace wants to select an algorithm,
> that needs to be done according to much more information than just the
> CPU speed - it needs knowledge of the instruction timings as well, cache
> behaviour, etc, and you might as well benchmark an implementation and
> select at run time, caching the result.
> 
> Since we've never exported this information, it's not a regression
> and it's not part of the kernels standard API.

Agreed. But we'll still be coming back to ensure this information is
presented to users. I pointed out to ARM about 3-4 years ago that this
was going to bite us. It is now biting us, and we will ensure that
useless data is provided where it is on x86 for identical experience by
users. That is unless or until x86 users do something else always. Our
(separate) case will use DMI or ACPI for the same kind of data.

Jon.



Re: [RFC 0/1] ARM: print MHz in /proc/cpuinfo

2016-07-02 Thread Jon Masters
Hi Russell, Jon,

On 06/07/2016 06:18 PM, Russell King - ARM Linux wrote:
> On Tue, Jun 07, 2016 at 05:08:32PM -0400, Jon Mason wrote:
>> Many users (and some applications) are expecting the CPU clock speed to
>> be output in /proc/cpuinfo (as is done in x86, avr32, c6x, tile, parisc,
>> ia64, and xtensa).
> 
> Such as what applications?  This is just another meaningless number,
> which is just as meaningless as the bogomips number.  It tells you
> nothing really about the CPU which should remotely be used for
> anything other than user display.  It certainly can't be used for
> algorithmic selection.

Agreed. HOWEVER...

We'll be coming back to add this for servers soon enough. It's on the
todo, we just need a nice way to extract this information (as has been
discussed). That's likely to be through DMI data or an ACPI addition
that will be required and mandatory at some future point.


> We have resisted publishing this information for years because not
> every ARM CPU is capable of providing this information - for many, we
> don't know what the CPU clock rate even is.  I believe it is a mistake
> to publish this information.

There are two specific problems on ARM servers:

1). Idiots. I've seen many situations in which benchmarks were run on
pre-production machines (often explicitly against legal agreements, but
those never happened within my organization so that's their problem -
this is carefully prohibited activity within our own walls and I make
sure our guys never run any numbers on pre-production stuff just so it
could never get into the "wrong" hands by accident...). What these
idiots do is then spread rumors that ARM server X "sucks" because they
ran a prohibited benchmark against a downclocked core and forgot how to
multiply numbers together. It gets worse. But usually it's because they
ran "cat /proc/cpuinfo" and it didn't tell them anything useful, so they
used whatever they thought the frequency was supposed to be.

These idiots include journalists. If you read the press, you'll see the
Gandhi sequence is playing out already between one of the established
vendors and an ARM vendor in which said established vendor is at the
laughing/fighting stage of things. And in a couple of cases recently,
the press included "we didn't know how fast it ran because /proc/cpuinfo
didn't tell us anything, so we guessed".

2). Users. Those who use and admin servers get the "speed" from
/proc/cpuinfo. It's a marketing number. It's useless. It absolutely must
be provided to the user or administrator exactly like on x86.

> If userspace wants to select an algorithm,
> that needs to be done according to much more information than just the
> CPU speed - it needs knowledge of the instruction timings as well, cache
> behaviour, etc, and you might as well benchmark an implementation and
> select at run time, caching the result.
> 
> Since we've never exported this information, it's not a regression
> and it's not part of the kernels standard API.

Agreed. But we'll still be coming back to ensure this information is
presented to users. I pointed out to ARM about 3-4 years ago that this
was going to bite us. It is now biting us, and we will ensure that
useless data is provided where it is on x86 for identical experience by
users. That is unless or until x86 users do something else always. Our
(separate) case will use DMI or ACPI for the same kind of data.

Jon.



[RFC PATCH 1/1] device tree connectors, using plugs and sockets.

2016-07-02 Thread frowand . list
From: Frank Rowand 

This patch has been compiled but has not been booted.  It is likely
to contain bugs.

Problem: mother boards may contain multiple connectors that daughter
boards may be attached to.  If two of the daughter boards can be
described by the same .dtsi file, then it should be possible to
apply the same .dtbo overlay file for each of the boards, specifying
a different target connector for each board.

This patch provides the foundation to allow that to occur, by
creating the two halves of a connector, the socket on the mother
board and the plug on the daughter board.

The one remaining piece that this patch does not provide is how
the overlay manager (which does not yet exist in the mainline
tree) can apply an overlay to two different targets.  That
final step should be a trivial change to of_overlay_create(),
adding a parameter that is a mapping of the target (or maybe
even targets) in the overlay to different targets in the
active device tree.

Signed-off-by: Frank Rowand 
---
 drivers/of/overlay.c | 141 ++-
 1 file changed, 118 insertions(+), 23 deletions(-)

diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 82250815e9a5..df9b0097a1e1 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -25,8 +25,9 @@
 
 /**
  * struct of_overlay_info - Holds a single overlay info
- * @target:target of the overlay operation
- * @overlay:   pointer to the overlay contents node
+ * @target:target of the overlay operation
+ * @overlay:   pointer to the overlay contents node
+ * @plug_targets:  pointer to array of plug target pointers
  *
  * Holds a single overlay state, including all the overlay logs &
  * records.
@@ -34,6 +35,7 @@
 struct of_overlay_info {
struct device_node *target;
struct device_node *overlay;
+   struct device_node **plug_targets;
 };
 
 /**
@@ -54,7 +56,8 @@ struct of_overlay {
 };
 
 static int of_overlay_apply_one(struct of_overlay *ov,
-   struct device_node *target, const struct device_node *overlay);
+   struct device_node *target, const struct device_node *overlay,
+   bool plug_node, struct of_overlay_info *ovinfo);
 
 static int of_overlay_apply_single_property(struct of_overlay *ov,
struct device_node *target, struct property *prop)
@@ -97,7 +100,7 @@ static int of_overlay_apply_single_device_node(struct 
of_overlay *ov,
tchild = of_get_child_by_name(target, cname);
if (tchild != NULL) {
/* apply overlay recursively */
-   ret = of_overlay_apply_one(ov, tchild, child);
+   ret = of_overlay_apply_one(ov, tchild, child, false, NULL);
of_node_put(tchild);
} else {
/* create empty tree as a target */
@@ -112,7 +115,7 @@ static int of_overlay_apply_single_device_node(struct 
of_overlay *ov,
if (ret)
return ret;
 
-   ret = of_overlay_apply_one(ov, tchild, child);
+   ret = of_overlay_apply_one(ov, tchild, child, false, NULL);
if (ret)
return ret;
}
@@ -128,33 +131,108 @@ static int of_overlay_apply_single_device_node(struct 
of_overlay *ov,
  * by using the changeset.
  */
 static int of_overlay_apply_one(struct of_overlay *ov,
-   struct device_node *target, const struct device_node *overlay)
+   struct device_node *target, const struct device_node *overlay,
+   bool plug_node, struct of_overlay_info *ovinfo)
 {
-   struct device_node *child;
+   struct device_node *overlay_child;
+   struct device_node *plug_target;
struct property *prop;
int ret;
+   u32 val;
 
-   for_each_property_of_node(overlay, prop) {
-   ret = of_overlay_apply_single_property(ov, target, prop);
-   if (ret) {
-   pr_err("%s: Failed to apply prop @%s/%s\n",
-   __func__, target->full_name, prop->name);
-   return ret;
+   if (!plug_node) {
+   for_each_property_of_node(overlay, prop) {
+   ret = of_overlay_apply_single_property(ov, target, 
prop);
+   if (ret) {
+   pr_err("%s: Failed to apply prop @%s/%s\n",
+   __func__, target->full_name, 
prop->name);
+   return ret;
+   }
}
}
 
-   for_each_child_of_node(overlay, child) {
-   ret = of_overlay_apply_single_device_node(ov, target, child);
-   if (ret != 0) {
-   pr_err("%s: Failed to apply single node @%s/%s\n",
-   __func__, target->full_name,
-   

[RFC PATCH 1/1] device tree connectors, using plugs and sockets.

2016-07-02 Thread frowand . list
From: Frank Rowand 

This patch has been compiled but has not been booted.  It is likely
to contain bugs.

Problem: mother boards may contain multiple connectors that daughter
boards may be attached to.  If two of the daughter boards can be
described by the same .dtsi file, then it should be possible to
apply the same .dtbo overlay file for each of the boards, specifying
a different target connector for each board.

This patch provides the foundation to allow that to occur, by
creating the two halves of a connector, the socket on the mother
board and the plug on the daughter board.

The one remaining piece that this patch does not provide is how
the overlay manager (which does not yet exist in the mainline
tree) can apply an overlay to two different targets.  That
final step should be a trivial change to of_overlay_create(),
adding a parameter that is a mapping of the target (or maybe
even targets) in the overlay to different targets in the
active device tree.

Signed-off-by: Frank Rowand 
---
 drivers/of/overlay.c | 141 ++-
 1 file changed, 118 insertions(+), 23 deletions(-)

diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 82250815e9a5..df9b0097a1e1 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -25,8 +25,9 @@
 
 /**
  * struct of_overlay_info - Holds a single overlay info
- * @target:target of the overlay operation
- * @overlay:   pointer to the overlay contents node
+ * @target:target of the overlay operation
+ * @overlay:   pointer to the overlay contents node
+ * @plug_targets:  pointer to array of plug target pointers
  *
  * Holds a single overlay state, including all the overlay logs &
  * records.
@@ -34,6 +35,7 @@
 struct of_overlay_info {
struct device_node *target;
struct device_node *overlay;
+   struct device_node **plug_targets;
 };
 
 /**
@@ -54,7 +56,8 @@ struct of_overlay {
 };
 
 static int of_overlay_apply_one(struct of_overlay *ov,
-   struct device_node *target, const struct device_node *overlay);
+   struct device_node *target, const struct device_node *overlay,
+   bool plug_node, struct of_overlay_info *ovinfo);
 
 static int of_overlay_apply_single_property(struct of_overlay *ov,
struct device_node *target, struct property *prop)
@@ -97,7 +100,7 @@ static int of_overlay_apply_single_device_node(struct 
of_overlay *ov,
tchild = of_get_child_by_name(target, cname);
if (tchild != NULL) {
/* apply overlay recursively */
-   ret = of_overlay_apply_one(ov, tchild, child);
+   ret = of_overlay_apply_one(ov, tchild, child, false, NULL);
of_node_put(tchild);
} else {
/* create empty tree as a target */
@@ -112,7 +115,7 @@ static int of_overlay_apply_single_device_node(struct 
of_overlay *ov,
if (ret)
return ret;
 
-   ret = of_overlay_apply_one(ov, tchild, child);
+   ret = of_overlay_apply_one(ov, tchild, child, false, NULL);
if (ret)
return ret;
}
@@ -128,33 +131,108 @@ static int of_overlay_apply_single_device_node(struct 
of_overlay *ov,
  * by using the changeset.
  */
 static int of_overlay_apply_one(struct of_overlay *ov,
-   struct device_node *target, const struct device_node *overlay)
+   struct device_node *target, const struct device_node *overlay,
+   bool plug_node, struct of_overlay_info *ovinfo)
 {
-   struct device_node *child;
+   struct device_node *overlay_child;
+   struct device_node *plug_target;
struct property *prop;
int ret;
+   u32 val;
 
-   for_each_property_of_node(overlay, prop) {
-   ret = of_overlay_apply_single_property(ov, target, prop);
-   if (ret) {
-   pr_err("%s: Failed to apply prop @%s/%s\n",
-   __func__, target->full_name, prop->name);
-   return ret;
+   if (!plug_node) {
+   for_each_property_of_node(overlay, prop) {
+   ret = of_overlay_apply_single_property(ov, target, 
prop);
+   if (ret) {
+   pr_err("%s: Failed to apply prop @%s/%s\n",
+   __func__, target->full_name, 
prop->name);
+   return ret;
+   }
}
}
 
-   for_each_child_of_node(overlay, child) {
-   ret = of_overlay_apply_single_device_node(ov, target, child);
-   if (ret != 0) {
-   pr_err("%s: Failed to apply single node @%s/%s\n",
-   __func__, target->full_name,
-   child->name);
-   of_node_put(child);
-  

[RFC PATCH 0/1] Portable Device Tree Connector -- conceptual

2016-07-02 Thread frowand . list
From: Frank Rowand 

Hi All,

This is version 2 of this email.

Changes from version 1:

  - some rewording of the text
  - removed new (theoretical) dtc directive "/connector/"
  - added compatibility between mother board and daughter board
  - added info on applying a single .dtbo to different connectors
  - attached an RFC patch showing the required kernel changes
  - changes to mother board .dts connector node:
 - removed target_path property
 - added connector-socket property
  - changes to daughter board .dts connector node:
 - added connector-plug property


I've been trying to wrap my head around what Pantelis and Rob have written
on the subject of a device tree representation of a connector for a
daughter board to connect to (eg a cape or a shield) and the representation
of the daughter board.  (Or any other physically pluggable object.)

After trying to make sense of what had been written (or presented via slides
at a conference - thanks Pantelis!), I decided to go back to first principals
of what we are trying to accomplish.  I came up with some really simple bogus
examples to try to explain what my thought process is.

This is an extremely simple example to illustrate the concepts.  It is not
meant to represent the complexity of a real board.

To start with, assume that the device that will eventually be on a daughter
board is first soldered onto the mother board.  The mother board contains
two devices connected via bus spi_1.  One device is described in the .dts
file, the other is described in an included .dtsi file.
Then the device tree files will look like:

$ cat board.dts
/dts-v1/;

/ {
#address-cells = < 1 >;
#size-cells = < 1 >;

tree_1: soc@0 {
reg = <0x0 0x0>;

spi_1: spi1 {
};
};

};

_1 {
ethernet-switch@0 {
compatible = "micrel,ks8995m";
};
};

#include "spi_codec.dtsi"


$ cat spi_codec.dtsi
_1 {
codec@1 {
compatible = "ti,tlv320aic26";
};
};


#- codec chip on cape

Then suppose I move the codec chip to a cape.  Then I will have the same
exact .dts and .dtsi and everything still works.


@- codec chip on cape, overlay

If I want to use overlays, I only have to add the version and "/plugin/",
then use the '-@' flag for dtc (both for the previous board.dts and
this spi_codec_overlay.dts):

$ cat spi_codec_overlay.dts
/dts-v1/;

/plugin/;

_1 {
codec@1 {
compatible = "ti,tlv320aic26";
};
};


Pantelis pointed out that the syntax has changed to be:
   /dts-v1/ /plugin/;


#- codec chip on cape, overlay, connector

Now we move into the realm of connectors.  My mental model of what the
hardware and driver look like has not changed.  The only thing that has
changed is that I want to be able to specify that the connector that
the cape is plugged into has some pins that are the spi bus /soc/spi1.

The following _almost_ but not quite gets me what I want.  Note that
the only thing the connector node does is provide some kind of
pointer or reference to what node(s) are physically routed through
the connector.  The connector node does not need to describe the pins;
it only has to point to the node that describes the pins.

This example will turn out to be not sufficient.  It is a stepping
stone in building my mental model.

$ cat board_with_connector.dts
/dts-v1/;

/ {
#address-cells = < 1 >;
#size-cells = < 1 >;

tree_1: soc@0 {
reg = <0x0 0x0>;

spi_1: spi1 {
};
};

connector_1: connector_1 {
spi1 {
target_phandle = <_1>;
};
};

};

_1 {
ethernet-switch@0 {
compatible = "micrel,ks8995m";
};
};


$ cat spi_codec_overlay_with_connector.dts
/dts-v1/;

/plugin/;

_1 {
spi1 {
codec@1 {
compatible = "ti,tlv320aic26";
};
};
};


The result is that the overlay fixup for spi1 on the cape will
relocate the spi1 node to /connector_1 in the host tree, so
this does not solve the connector linkage yet:

-- chunk from the decompiled board_with_connector.dtb:

__symbols__ {
connector_1 = "/connector_1";
};

-- chunk from the decompiled spi_codec_overlay_with_connector.dtb:

fragment@0 {
target = <0x>;
__overlay__ {
spi1 {
codec@1 {
compatible = "ti,tlv320aic26";
};
};
};
};
__fixups__ {
connector_1 = "/fragment@0:target:0";
};


After applying the overlay, the codec@1 node will be at
/connector_1/spi1/codec@1.  What I want is for that node
to be at 

[RFC PATCH 0/1] Portable Device Tree Connector -- conceptual

2016-07-02 Thread frowand . list
From: Frank Rowand 

Hi All,

This is version 2 of this email.

Changes from version 1:

  - some rewording of the text
  - removed new (theoretical) dtc directive "/connector/"
  - added compatibility between mother board and daughter board
  - added info on applying a single .dtbo to different connectors
  - attached an RFC patch showing the required kernel changes
  - changes to mother board .dts connector node:
 - removed target_path property
 - added connector-socket property
  - changes to daughter board .dts connector node:
 - added connector-plug property


I've been trying to wrap my head around what Pantelis and Rob have written
on the subject of a device tree representation of a connector for a
daughter board to connect to (eg a cape or a shield) and the representation
of the daughter board.  (Or any other physically pluggable object.)

After trying to make sense of what had been written (or presented via slides
at a conference - thanks Pantelis!), I decided to go back to first principals
of what we are trying to accomplish.  I came up with some really simple bogus
examples to try to explain what my thought process is.

This is an extremely simple example to illustrate the concepts.  It is not
meant to represent the complexity of a real board.

To start with, assume that the device that will eventually be on a daughter
board is first soldered onto the mother board.  The mother board contains
two devices connected via bus spi_1.  One device is described in the .dts
file, the other is described in an included .dtsi file.
Then the device tree files will look like:

$ cat board.dts
/dts-v1/;

/ {
#address-cells = < 1 >;
#size-cells = < 1 >;

tree_1: soc@0 {
reg = <0x0 0x0>;

spi_1: spi1 {
};
};

};

_1 {
ethernet-switch@0 {
compatible = "micrel,ks8995m";
};
};

#include "spi_codec.dtsi"


$ cat spi_codec.dtsi
_1 {
codec@1 {
compatible = "ti,tlv320aic26";
};
};


#- codec chip on cape

Then suppose I move the codec chip to a cape.  Then I will have the same
exact .dts and .dtsi and everything still works.


@- codec chip on cape, overlay

If I want to use overlays, I only have to add the version and "/plugin/",
then use the '-@' flag for dtc (both for the previous board.dts and
this spi_codec_overlay.dts):

$ cat spi_codec_overlay.dts
/dts-v1/;

/plugin/;

_1 {
codec@1 {
compatible = "ti,tlv320aic26";
};
};


Pantelis pointed out that the syntax has changed to be:
   /dts-v1/ /plugin/;


#- codec chip on cape, overlay, connector

Now we move into the realm of connectors.  My mental model of what the
hardware and driver look like has not changed.  The only thing that has
changed is that I want to be able to specify that the connector that
the cape is plugged into has some pins that are the spi bus /soc/spi1.

The following _almost_ but not quite gets me what I want.  Note that
the only thing the connector node does is provide some kind of
pointer or reference to what node(s) are physically routed through
the connector.  The connector node does not need to describe the pins;
it only has to point to the node that describes the pins.

This example will turn out to be not sufficient.  It is a stepping
stone in building my mental model.

$ cat board_with_connector.dts
/dts-v1/;

/ {
#address-cells = < 1 >;
#size-cells = < 1 >;

tree_1: soc@0 {
reg = <0x0 0x0>;

spi_1: spi1 {
};
};

connector_1: connector_1 {
spi1 {
target_phandle = <_1>;
};
};

};

_1 {
ethernet-switch@0 {
compatible = "micrel,ks8995m";
};
};


$ cat spi_codec_overlay_with_connector.dts
/dts-v1/;

/plugin/;

_1 {
spi1 {
codec@1 {
compatible = "ti,tlv320aic26";
};
};
};


The result is that the overlay fixup for spi1 on the cape will
relocate the spi1 node to /connector_1 in the host tree, so
this does not solve the connector linkage yet:

-- chunk from the decompiled board_with_connector.dtb:

__symbols__ {
connector_1 = "/connector_1";
};

-- chunk from the decompiled spi_codec_overlay_with_connector.dtb:

fragment@0 {
target = <0x>;
__overlay__ {
spi1 {
codec@1 {
compatible = "ti,tlv320aic26";
};
};
};
};
__fixups__ {
connector_1 = "/fragment@0:target:0";
};


After applying the overlay, the codec@1 node will be at
/connector_1/spi1/codec@1.  What I want is for that node
to be at /spi1/codec@1.



#- 

{standard input}:122: Error: number (0x9000000080000000) larger than 32 bits

2016-07-02 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   99b0f54e6a3a4012aacfaada5644a8e520447d80
commit: 71458cfc782eafe4b27656e078d379a34e472adf kernel: add support for gcc 5
date:   1 year, 9 months ago
config: mips-tb0226_defconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 71458cfc782eafe4b27656e078d379a34e472adf
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   {standard input}: Assembler messages:
>> {standard input}:122: Error: number (0x90008000) larger than 32 bits
   {standard input}:156: Error: number (0x90008000) larger than 32 bits
   {standard input}:178: Error: number (0x90008000) larger than 32 bits

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


{standard input}:122: Error: number (0x9000000080000000) larger than 32 bits

2016-07-02 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   99b0f54e6a3a4012aacfaada5644a8e520447d80
commit: 71458cfc782eafe4b27656e078d379a34e472adf kernel: add support for gcc 5
date:   1 year, 9 months ago
config: mips-tb0226_defconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 71458cfc782eafe4b27656e078d379a34e472adf
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   {standard input}: Assembler messages:
>> {standard input}:122: Error: number (0x90008000) larger than 32 bits
   {standard input}:156: Error: number (0x90008000) larger than 32 bits
   {standard input}:178: Error: number (0x90008000) larger than 32 bits

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH] staging: fsl-mc: make bus/mc-bus explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

config FSL_MC_BUS
bool "Freescale Management Complex (MC) bus driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since the code was already not using module_init, we don't have to change
the initcall and the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We don't replace module.h with init.h since the file does make some
references to "struct *module" for processing other modules.

Cc: "J. German Rivera" 
Cc: Greg Kroah-Hartman 
Cc: de...@driverdev.osuosl.org
Signed-off-by: Paul Gortmaker 
---
 drivers/staging/fsl-mc/bus/mc-bus.c | 21 -
 1 file changed, 21 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c 
b/drivers/staging/fsl-mc/bus/mc-bus.c
index b59455661f4d..f9255a0abb16 100644
--- a/drivers/staging/fsl-mc/bus/mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/mc-bus.c
@@ -858,25 +858,4 @@ error_cleanup_cache:
kmem_cache_destroy(mc_dev_cache);
return error;
 }
-
 postcore_initcall(fsl_mc_bus_driver_init);
-
-static void __exit fsl_mc_bus_driver_exit(void)
-{
-   if (WARN_ON(!mc_dev_cache))
-   return;
-
-   its_fsl_mc_msi_cleanup();
-   fsl_mc_allocator_driver_exit();
-   dprc_driver_exit();
-   platform_driver_unregister(_mc_bus_driver);
-   bus_unregister(_mc_bus_type);
-   kmem_cache_destroy(mc_dev_cache);
-   pr_info("MC bus unregistered\n");
-}
-
-module_exit(fsl_mc_bus_driver_exit);
-
-MODULE_AUTHOR("Freescale Semiconductor Inc.");
-MODULE_DESCRIPTION("Freescale Management Complex (MC) bus driver");
-MODULE_LICENSE("GPL");
-- 
2.6.1



[PATCH] staging: fsl-mc: make bus/mc-bus explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

config FSL_MC_BUS
bool "Freescale Management Complex (MC) bus driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since the code was already not using module_init, we don't have to change
the initcall and the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We don't replace module.h with init.h since the file does make some
references to "struct *module" for processing other modules.

Cc: "J. German Rivera" 
Cc: Greg Kroah-Hartman 
Cc: de...@driverdev.osuosl.org
Signed-off-by: Paul Gortmaker 
---
 drivers/staging/fsl-mc/bus/mc-bus.c | 21 -
 1 file changed, 21 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c 
b/drivers/staging/fsl-mc/bus/mc-bus.c
index b59455661f4d..f9255a0abb16 100644
--- a/drivers/staging/fsl-mc/bus/mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/mc-bus.c
@@ -858,25 +858,4 @@ error_cleanup_cache:
kmem_cache_destroy(mc_dev_cache);
return error;
 }
-
 postcore_initcall(fsl_mc_bus_driver_init);
-
-static void __exit fsl_mc_bus_driver_exit(void)
-{
-   if (WARN_ON(!mc_dev_cache))
-   return;
-
-   its_fsl_mc_msi_cleanup();
-   fsl_mc_allocator_driver_exit();
-   dprc_driver_exit();
-   platform_driver_unregister(_mc_bus_driver);
-   bus_unregister(_mc_bus_type);
-   kmem_cache_destroy(mc_dev_cache);
-   pr_info("MC bus unregistered\n");
-}
-
-module_exit(fsl_mc_bus_driver_exit);
-
-MODULE_AUTHOR("Freescale Semiconductor Inc.");
-MODULE_DESCRIPTION("Freescale Management Complex (MC) bus driver");
-MODULE_LICENSE("GPL");
-- 
2.6.1



Re: [PATCH 0/4] sh: fix up modular use in non-modular code

2016-07-02 Thread Paul Gortmaker
[Re: [PATCH 0/4] sh: fix up modular use in non-modular code] On 02/06/2016 (Thu 
15:54) Yoshinori Sato wrote:

> On Fri, 27 May 2016 01:53:34 +0900,
> Rich Felker wrote:
> > 
> > On Thu, May 26, 2016 at 12:45:57PM -0400, Paul Gortmaker wrote:
> > > [[PATCH 0/4] sh: fix up modular use in non-modular code] On 22/04/2016 
> > > (Fri 14:07) Paul Gortmaker wrote:
> > > 
> > > > For anyone new to the underlying goal of this cleanup, we are trying to
> > > > make kernel code consistent with the Makefiles/Kconfigs that control 
> > > > them.
> > > 
> > > Ping -- wondering if there are any issues here, or if I can expect these
> > > to be merged upstream in the merge window.  I didn't see them loop
> > > around via the linux-next tree but I wasn't sure if arch/sh has a repo
> > > for linux-next.
> > 
> > I don't have experience with the affected code, but it looks ok unless
> > any of these "should" be modular and Kconfig was just wrong to
> > disallow it.
> > 
> > Sato-san, do you have an opinion on these? Should I go ahead and just
> > merge them?
> 
> It looks no problem.
> I think can merge it.

Just checking in a month later; my queue that I test regularly against
the linux-next tree still has these:

sh-make-heartbeat-driver-explicitly-non-modular.patch
sh-make-board-secureedge5410.c-explicitly-non-m.patch
sh-make-mm-asids-debugfs-explicitly-non-modular.patch
sh-make-time.c-explicitly-non-modular.patch

Apologies in advance if you have a sh queue that is pending but for some
reason is not fed into the nightly linux-next tree generation.  If so,
let me know and I won't worry about looking for these until merge window.

Thanks,
Paul.
--

> 
> > Rich
> > 
> > > > This means not using modular functions/macros for code that can never
> > > > be built as a module.  Some of the other downfalls this leads to are:
> > > > 
> > > >  (1) it is easy to accidentally write unused module_exit and remove code
> > > >  (2) it can be misleading when reading the source, thinking it can be
> > > >  modular when the Makefile and/or Kconfig prohibit it
> > > >  (3) it requires the include of the module.h header file which in turn
> > > >  includes nearly everything else, thus adding to CPP overhead.
> > > >  (4) it gets copied/replicated into other drivers and spreads like 
> > > > weeds.
> > > > 
> > > > Three of the four commits here are completely trivial with zero runtime
> > > > impact whatsoever.  The fourth has a deletion of a ".remove" function
> > > > and as we've done elsewhere, we block the sysfs ability to reach in and
> > > > manually execute that function, since there isn't a sane use case for
> > > > which doing that makes sense.
> > > > 
> > > > Build tested on today's linux-next ; full build fails on duplicate syms
> > > > from OF generic board, but that is a known and reported issue elsewhere;
> > > > it has nothing to do with the changes here.
> > > > 
> > > > Paul
> > > > --
> > > > 
> > > > Cc: linux...@vger.kernel.org
> > > > Cc: Paul Gortmaker 
> > > > Cc: Rich Felker 
> > > > Cc: Yoshinori Sato 
> > > > 
> > > > 
> > > > Paul Gortmaker (4):
> > > >   sh: make time.c explicitly non-modular
> > > >   sh: make mm/asids-debugfs explicitly non-modular
> > > >   sh: make board-secureedge5410 explicitly non-modular
> > > >   sh: make heartbeat driver explicitly non-modular
> > > > 
> > > >  arch/sh/boards/board-secureedge5410.c |  3 +--
> > > >  arch/sh/drivers/heartbeat.c   | 32 
> > > > +++-
> > > >  arch/sh/kernel/time.c |  3 +--
> > > >  arch/sh/mm/asids-debugfs.c|  5 +
> > > >  4 files changed, 6 insertions(+), 37 deletions(-)
> > > > 
> > > > -- 
> > > > 2.8.0
> > > > 
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> > > the body of a message to majord...@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> -- 
> Yoshinori Sato
> 


Re: [PATCH 0/4] sh: fix up modular use in non-modular code

2016-07-02 Thread Paul Gortmaker
[Re: [PATCH 0/4] sh: fix up modular use in non-modular code] On 02/06/2016 (Thu 
15:54) Yoshinori Sato wrote:

> On Fri, 27 May 2016 01:53:34 +0900,
> Rich Felker wrote:
> > 
> > On Thu, May 26, 2016 at 12:45:57PM -0400, Paul Gortmaker wrote:
> > > [[PATCH 0/4] sh: fix up modular use in non-modular code] On 22/04/2016 
> > > (Fri 14:07) Paul Gortmaker wrote:
> > > 
> > > > For anyone new to the underlying goal of this cleanup, we are trying to
> > > > make kernel code consistent with the Makefiles/Kconfigs that control 
> > > > them.
> > > 
> > > Ping -- wondering if there are any issues here, or if I can expect these
> > > to be merged upstream in the merge window.  I didn't see them loop
> > > around via the linux-next tree but I wasn't sure if arch/sh has a repo
> > > for linux-next.
> > 
> > I don't have experience with the affected code, but it looks ok unless
> > any of these "should" be modular and Kconfig was just wrong to
> > disallow it.
> > 
> > Sato-san, do you have an opinion on these? Should I go ahead and just
> > merge them?
> 
> It looks no problem.
> I think can merge it.

Just checking in a month later; my queue that I test regularly against
the linux-next tree still has these:

sh-make-heartbeat-driver-explicitly-non-modular.patch
sh-make-board-secureedge5410.c-explicitly-non-m.patch
sh-make-mm-asids-debugfs-explicitly-non-modular.patch
sh-make-time.c-explicitly-non-modular.patch

Apologies in advance if you have a sh queue that is pending but for some
reason is not fed into the nightly linux-next tree generation.  If so,
let me know and I won't worry about looking for these until merge window.

Thanks,
Paul.
--

> 
> > Rich
> > 
> > > > This means not using modular functions/macros for code that can never
> > > > be built as a module.  Some of the other downfalls this leads to are:
> > > > 
> > > >  (1) it is easy to accidentally write unused module_exit and remove code
> > > >  (2) it can be misleading when reading the source, thinking it can be
> > > >  modular when the Makefile and/or Kconfig prohibit it
> > > >  (3) it requires the include of the module.h header file which in turn
> > > >  includes nearly everything else, thus adding to CPP overhead.
> > > >  (4) it gets copied/replicated into other drivers and spreads like 
> > > > weeds.
> > > > 
> > > > Three of the four commits here are completely trivial with zero runtime
> > > > impact whatsoever.  The fourth has a deletion of a ".remove" function
> > > > and as we've done elsewhere, we block the sysfs ability to reach in and
> > > > manually execute that function, since there isn't a sane use case for
> > > > which doing that makes sense.
> > > > 
> > > > Build tested on today's linux-next ; full build fails on duplicate syms
> > > > from OF generic board, but that is a known and reported issue elsewhere;
> > > > it has nothing to do with the changes here.
> > > > 
> > > > Paul
> > > > --
> > > > 
> > > > Cc: linux...@vger.kernel.org
> > > > Cc: Paul Gortmaker 
> > > > Cc: Rich Felker 
> > > > Cc: Yoshinori Sato 
> > > > 
> > > > 
> > > > Paul Gortmaker (4):
> > > >   sh: make time.c explicitly non-modular
> > > >   sh: make mm/asids-debugfs explicitly non-modular
> > > >   sh: make board-secureedge5410 explicitly non-modular
> > > >   sh: make heartbeat driver explicitly non-modular
> > > > 
> > > >  arch/sh/boards/board-secureedge5410.c |  3 +--
> > > >  arch/sh/drivers/heartbeat.c   | 32 
> > > > +++-
> > > >  arch/sh/kernel/time.c |  3 +--
> > > >  arch/sh/mm/asids-debugfs.c|  5 +
> > > >  4 files changed, 6 insertions(+), 37 deletions(-)
> > > > 
> > > > -- 
> > > > 2.8.0
> > > > 
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> > > the body of a message to majord...@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> -- 
> Yoshinori Sato
> 


[GIT PULL] Please pull powerpc/linux.git powerpc-4.7-5 tag

2016-07-02 Thread Michael Ellerman
Hi Linus,

Please pull some more powerpc fixes for 4.7:

The following changes since commit 844e3be47693f92a108cb1fb3b0606bf25e9c7a6:

  powerpc/bpf/jit: Disable classic BPF JIT on ppc64le (2016-06-23 10:35:31 
+1000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git 
tags/powerpc-4.7-5

for you to fetch changes up to bfa37087aa04e45f56c41142dfceecb79b8e6ef9:

  powerpc: Initialise pci_io_base as early as possible (2016-06-30 16:52:29 
+1000)


powerpc fixes for 4.7 #5

 - tm: Always reclaim in start_thread() for exec() class syscalls from Cyril Bur
 - tm: Avoid SLB faults in treclaim/trecheckpoint when RI=0 from Michael Neuling
 - eeh: Fix wrong argument passed to eeh_rmv_device() from Gavin Shan
 - Initialise pci_io_base as early as possible from Darren Stevens


Cyril Bur (1):
  powerpc/tm: Always reclaim in start_thread() for exec() class syscalls

Darren Stevens (1):
  powerpc: Initialise pci_io_base as early as possible

Gavin Shan (1):
  powerpc/eeh: Fix wrong argument passed to eeh_rmv_device()

Michael Neuling (1):
  powerpc/tm: Avoid SLB faults in treclaim/trecheckpoint when RI=0

 arch/powerpc/include/asm/book3s/64/pgtable.h |  1 +
 arch/powerpc/kernel/eeh_driver.c |  2 +-
 arch/powerpc/kernel/pci_64.c |  1 -
 arch/powerpc/kernel/process.c| 10 +
 arch/powerpc/kernel/tm.S | 61 
 arch/powerpc/mm/hash_utils_64.c  |  4 ++
 arch/powerpc/mm/pgtable-radix.c  |  5 +++
 7 files changed, 65 insertions(+), 19 deletions(-)



signature.asc
Description: This is a digitally signed message part


[GIT PULL] Please pull powerpc/linux.git powerpc-4.7-5 tag

2016-07-02 Thread Michael Ellerman
Hi Linus,

Please pull some more powerpc fixes for 4.7:

The following changes since commit 844e3be47693f92a108cb1fb3b0606bf25e9c7a6:

  powerpc/bpf/jit: Disable classic BPF JIT on ppc64le (2016-06-23 10:35:31 
+1000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git 
tags/powerpc-4.7-5

for you to fetch changes up to bfa37087aa04e45f56c41142dfceecb79b8e6ef9:

  powerpc: Initialise pci_io_base as early as possible (2016-06-30 16:52:29 
+1000)


powerpc fixes for 4.7 #5

 - tm: Always reclaim in start_thread() for exec() class syscalls from Cyril Bur
 - tm: Avoid SLB faults in treclaim/trecheckpoint when RI=0 from Michael Neuling
 - eeh: Fix wrong argument passed to eeh_rmv_device() from Gavin Shan
 - Initialise pci_io_base as early as possible from Darren Stevens


Cyril Bur (1):
  powerpc/tm: Always reclaim in start_thread() for exec() class syscalls

Darren Stevens (1):
  powerpc: Initialise pci_io_base as early as possible

Gavin Shan (1):
  powerpc/eeh: Fix wrong argument passed to eeh_rmv_device()

Michael Neuling (1):
  powerpc/tm: Avoid SLB faults in treclaim/trecheckpoint when RI=0

 arch/powerpc/include/asm/book3s/64/pgtable.h |  1 +
 arch/powerpc/kernel/eeh_driver.c |  2 +-
 arch/powerpc/kernel/pci_64.c |  1 -
 arch/powerpc/kernel/process.c| 10 +
 arch/powerpc/kernel/tm.S | 61 
 arch/powerpc/mm/hash_utils_64.c  |  4 ++
 arch/powerpc/mm/pgtable-radix.c  |  5 +++
 7 files changed, 65 insertions(+), 19 deletions(-)



signature.asc
Description: This is a digitally signed message part


[PATCH][media] saa7134: fix warm Medion 7134 EEPROM read

2016-07-02 Thread Maciej S. Szmigiero
When saa7134 module driving a Medion 7134 card is reloaded reads of this
card EEPROM (required for automatic detection of tuner model) will be
corrupted due to I2C gate in DVB-T demod being left closed.
This sometimes also happens on first saa7134 module load after a warm
reboot.

Fix this by opening this I2C gate before doing EEPROM read during i2c
initialization.

Signed-off-by: Maciej S. Szmigiero 
---
This is a modified version of patch submitted a few years ago:
http://www.spinics.net/lists/linux-media/msg24455.html .

That patch was fixing two problems: with TDA9887 detection on cold
board and EEPROM read on warm.

TDA9887 detection issue have been solved since by commit
4aed283c0f7c2 ("switch tuner FMD1216ME_MK3 to analog"),
however EEPROM read issue remained.

This submission fixes this a little bit earlier in the code than previous
attempt (during i2c initialization instead of later board init) so
informational EEPROM read shown in kernel log will also be correct.

 drivers/media/pci/saa7134/saa7134-i2c.c | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/drivers/media/pci/saa7134/saa7134-i2c.c 
b/drivers/media/pci/saa7134/saa7134-i2c.c
index 8ef6399d794f..bc957528f69f 100644
--- a/drivers/media/pci/saa7134/saa7134-i2c.c
+++ b/drivers/media/pci/saa7134/saa7134-i2c.c
@@ -355,12 +355,43 @@ static struct i2c_client saa7134_client_template = {
 
 /* --- */
 
+/* On Medion 7134 reading EEPROM needs DVB-T demod i2c gate open */
+static void saa7134_i2c_eeprom_md7134_gate(struct saa7134_dev *dev)
+{
+   u8 subaddr = 0x7, dmdregval;
+   u8 data[2];
+   int ret;
+   struct i2c_msg i2cgatemsg_r[] = { {.addr = 0x08, .flags = 0,
+  .buf = , .len = 1},
+ {.addr = 0x08,
+  .flags = I2C_M_RD,
+  .buf = , .len = 1}
+   };
+   struct i2c_msg i2cgatemsg_w[] = { {.addr = 0x08, .flags = 0,
+  .buf = data, .len = 2} };
+
+   ret = i2c_transfer(>i2c_adap, i2cgatemsg_r, 2);
+   if ((ret == 2) && (dmdregval & 0x2)) {
+   pr_debug("%s: DVB-T demod i2c gate was left closed\n",
+dev->name);
+
+   data[0] = subaddr;
+   data[1] = (dmdregval & ~0x2);
+   if (i2c_transfer(>i2c_adap, i2cgatemsg_w, 1) != 1)
+   pr_err("%s: EEPROM i2c gate open failure\n",
+ dev->name);
+   }
+}
+
 static int
 saa7134_i2c_eeprom(struct saa7134_dev *dev, unsigned char *eedata, int len)
 {
unsigned char buf;
int i,err;
 
+   if (dev->board == SAA7134_BOARD_MD7134)
+   saa7134_i2c_eeprom_md7134_gate(dev);
+
dev->i2c_client.addr = 0xa0 >> 1;
buf = 0;
if (1 != (err = i2c_master_send(>i2c_client,,1))) {


[PATCH][media] saa7134: fix warm Medion 7134 EEPROM read

2016-07-02 Thread Maciej S. Szmigiero
When saa7134 module driving a Medion 7134 card is reloaded reads of this
card EEPROM (required for automatic detection of tuner model) will be
corrupted due to I2C gate in DVB-T demod being left closed.
This sometimes also happens on first saa7134 module load after a warm
reboot.

Fix this by opening this I2C gate before doing EEPROM read during i2c
initialization.

Signed-off-by: Maciej S. Szmigiero 
---
This is a modified version of patch submitted a few years ago:
http://www.spinics.net/lists/linux-media/msg24455.html .

That patch was fixing two problems: with TDA9887 detection on cold
board and EEPROM read on warm.

TDA9887 detection issue have been solved since by commit
4aed283c0f7c2 ("switch tuner FMD1216ME_MK3 to analog"),
however EEPROM read issue remained.

This submission fixes this a little bit earlier in the code than previous
attempt (during i2c initialization instead of later board init) so
informational EEPROM read shown in kernel log will also be correct.

 drivers/media/pci/saa7134/saa7134-i2c.c | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/drivers/media/pci/saa7134/saa7134-i2c.c 
b/drivers/media/pci/saa7134/saa7134-i2c.c
index 8ef6399d794f..bc957528f69f 100644
--- a/drivers/media/pci/saa7134/saa7134-i2c.c
+++ b/drivers/media/pci/saa7134/saa7134-i2c.c
@@ -355,12 +355,43 @@ static struct i2c_client saa7134_client_template = {
 
 /* --- */
 
+/* On Medion 7134 reading EEPROM needs DVB-T demod i2c gate open */
+static void saa7134_i2c_eeprom_md7134_gate(struct saa7134_dev *dev)
+{
+   u8 subaddr = 0x7, dmdregval;
+   u8 data[2];
+   int ret;
+   struct i2c_msg i2cgatemsg_r[] = { {.addr = 0x08, .flags = 0,
+  .buf = , .len = 1},
+ {.addr = 0x08,
+  .flags = I2C_M_RD,
+  .buf = , .len = 1}
+   };
+   struct i2c_msg i2cgatemsg_w[] = { {.addr = 0x08, .flags = 0,
+  .buf = data, .len = 2} };
+
+   ret = i2c_transfer(>i2c_adap, i2cgatemsg_r, 2);
+   if ((ret == 2) && (dmdregval & 0x2)) {
+   pr_debug("%s: DVB-T demod i2c gate was left closed\n",
+dev->name);
+
+   data[0] = subaddr;
+   data[1] = (dmdregval & ~0x2);
+   if (i2c_transfer(>i2c_adap, i2cgatemsg_w, 1) != 1)
+   pr_err("%s: EEPROM i2c gate open failure\n",
+ dev->name);
+   }
+}
+
 static int
 saa7134_i2c_eeprom(struct saa7134_dev *dev, unsigned char *eedata, int len)
 {
unsigned char buf;
int i,err;
 
+   if (dev->board == SAA7134_BOARD_MD7134)
+   saa7134_i2c_eeprom_md7134_gate(dev);
+
dev->i2c_client.addr = 0xa0 >> 1;
buf = 0;
if (1 != (err = i2c_master_send(>i2c_client,,1))) {


Re: [PATCH v2] tracing: Fix oops caused by graph notrace filter

2016-07-02 Thread kbuild test robot
Hi,

[auto build test ERROR on tip/perf/core]
[also build test ERROR on v4.7-rc5 next-20160701]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Chunyu-Hu/tracing-Fix-oops-caused-by-graph-notrace-filter/20160622-195615
config: x86_64-randconfig-s0-07030621 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   kernel/built-in.o: In function `__irqsoff_tracer_init':
>> trace_irqsoff.c:(.text+0xd8a5f): undefined reference to 
>> `ftrace_graph_ignore_notrace'
   kernel/built-in.o: In function `irqsoff_tracer_reset':
   trace_irqsoff.c:(.text+0xd8b62): undefined reference to 
`ftrace_graph_ignore_notrace'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH v2] tracing: Fix oops caused by graph notrace filter

2016-07-02 Thread kbuild test robot
Hi,

[auto build test ERROR on tip/perf/core]
[also build test ERROR on v4.7-rc5 next-20160701]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Chunyu-Hu/tracing-Fix-oops-caused-by-graph-notrace-filter/20160622-195615
config: x86_64-randconfig-s0-07030621 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   kernel/built-in.o: In function `__irqsoff_tracer_init':
>> trace_irqsoff.c:(.text+0xd8a5f): undefined reference to 
>> `ftrace_graph_ignore_notrace'
   kernel/built-in.o: In function `irqsoff_tracer_reset':
   trace_irqsoff.c:(.text+0xd8b62): undefined reference to 
`ftrace_graph_ignore_notrace'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH v2] tracing: Fix oops caused by graph notrace filter

2016-07-02 Thread kbuild test robot
Hi,

[auto build test ERROR on tip/perf/core]
[also build test ERROR on v4.7-rc5 next-20160701]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Chunyu-Hu/tracing-Fix-oops-caused-by-graph-notrace-filter/20160622-195615
config: x86_64-randconfig-s4-07030618 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   kernel/built-in.o: In function `__irqsoff_tracer_init':
   trace_irqsoff.c:(.text+0x85cbc): undefined reference to 
`ftrace_graph_ignore_notrace'
   kernel/built-in.o: In function `irqsoff_tracer_reset':
   trace_irqsoff.c:(.text+0x85daa): undefined reference to 
`ftrace_graph_ignore_notrace'
   kernel/built-in.o: In function `__wakeup_tracer_init':
>> trace_sched_wakeup.c:(.text+0x866fe): undefined reference to 
>> `ftrace_graph_ignore_notrace'
   kernel/built-in.o: In function `wakeup_tracer_reset':
   trace_sched_wakeup.c:(.text+0x86bf2): undefined reference to 
`ftrace_graph_ignore_notrace'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH v2] tracing: Fix oops caused by graph notrace filter

2016-07-02 Thread kbuild test robot
Hi,

[auto build test ERROR on tip/perf/core]
[also build test ERROR on v4.7-rc5 next-20160701]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Chunyu-Hu/tracing-Fix-oops-caused-by-graph-notrace-filter/20160622-195615
config: x86_64-randconfig-s4-07030618 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   kernel/built-in.o: In function `__irqsoff_tracer_init':
   trace_irqsoff.c:(.text+0x85cbc): undefined reference to 
`ftrace_graph_ignore_notrace'
   kernel/built-in.o: In function `irqsoff_tracer_reset':
   trace_irqsoff.c:(.text+0x85daa): undefined reference to 
`ftrace_graph_ignore_notrace'
   kernel/built-in.o: In function `__wakeup_tracer_init':
>> trace_sched_wakeup.c:(.text+0x866fe): undefined reference to 
>> `ftrace_graph_ignore_notrace'
   kernel/built-in.o: In function `wakeup_tracer_reset':
   trace_sched_wakeup.c:(.text+0x86bf2): undefined reference to 
`ftrace_graph_ignore_notrace'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH 00/14] PCI: trivial demodularization of builtin code

2016-07-02 Thread Paul Gortmaker
Firstly, this group of commits was chosen for the fact that they don't
change anything even at a binary object file level ; they just replace
module_platform_driver with builtin_platform_driver, and remove some
MODULE_ tags that are no-ops in code.  So the regression risk
is zero here.

More specifically, we are doing the following to pci/host files that
currently can only be built-in:

 -- remove the include of module.h ; replace it with init.h as req'd

 -- drop instances of MODULE_DEVICE_TABLE which is a no-op built-in.

 -- replace module_platform_driver with builtin_platform_driver, which
is functionally identical once CPP has processed the source.

 -- drop instances of MODULE_LICENSE, MODULE_AUTHOR, MODULE_DESCRIPTION
while ensuring the contained info is present in the file comments.

After considering the inital version of demodularization PCI host
commits[1], we did consider striving for tristate[2] on another
subset of PCI host files in order to keep bzImage sizes lower on
multi-platform builds, but that proved to have technical challenges
well outside the scope of what we are trying to achieve here, given
PCI is infrastructure code and not a case of simple endpoint
drivers.

In the meantime more new code copies the existing examples of bool
Kconfig using modular references; further expanding the problem
space.  So we are just going to proceed with the demodularization
as originally planned.  Nothing removed here is rocket science, and
can easily be restored if someone has the hardware to test on and
the desire to expand functionality into the tristate realm.

A more complete description of why we are doing this can be found
in the original posting[1] for those that haven't seen it yet.

This represents just over 1/2 the PCI drivers that have their Kconfig
as bool but needlessly use modular references.  The remainder do not
deliver exact binary equivalence, since they delete unused __exit
functions and/or unused ".remove" functions.  So they are more
appropriate for submission earlier in the next development window.

Build tested for allmodconfig on several arch, including ARM and
ARM-64 on the most recent linux-next baseline.

Paul.

[1] 
https://lkml.kernel.org/r/1449970917-12633-1-git-send-email-paul.gortma...@windriver.com
[2] 
https://lkml.kernel.org/r/1454889644-27830-1-git-send-email-paul.gortma...@windriver.com

---

[vs v1 in [1] above, I tweaked the subjects slightly to match the
 format used by most PCI commits, i.e drop the "driver/" prefix. ]

Cc: Alexandre Courbot 
Cc: Bjorn Helgaas 
Cc: David Daney 
Cc: Gabriele Paoloni 
Cc: Jason Cooper 
Cc: Jesper Nilsson 
Cc: Jingoo Han 
Cc: Joao Pinto 
Cc: Minghuan Lian 
Cc: Mingkai Hu 
Cc: Murali Karicheri 
Cc: Niklas Cassel 
Cc: Phil Edworthy 
Cc: Pratyush Anand 
Cc: Roy Zang 
Cc: Simon Horman 
Cc: Stephen Warren 
Cc: Tanmay Inamdar 
Cc: Thierry Reding 
Cc: Thomas Petazzoni 
Cc: Valentine Barshak 
Cc: Will Deacon 
Cc: Zhou Wang 
Cc: linux-...@vger.kernel.org
Cc: linux-te...@vger.kernel.org

Paul Gortmaker (14):
  PCI: armada8k: make it explicitly non-modular
  PCI: artpec6: make it explicitly non-modular
  PCI: designware-plat: make it explicitly non-modular
  PCI: generic: make it explicitly non-modular
  PCI: hisi: make it explicitly non-modular
  PCI: keystone: make it explicitly non-modular
  PCI: layerscape: make it explicitly non-modular
  PCI: mvebu: make it explicitly non-modular
  PCI: rcar: make it explicitly non-modular
  PCI: rcar-gen2: make it explicitly non-modular
  PCI: tegra: make it explicitly non-modular
  PCI: thunder-ecam: make it explicitly non-modular
  PCI: thunder-pem: make it explicitly non-modular
  PCI: xgene: make it explicitly non-modular

 drivers/pci/host/pci-host-generic.c | 10 ++
 drivers/pci/host/pci-keystone.c | 10 ++
 drivers/pci/host/pci-layerscape.c   | 10 ++
 drivers/pci/host/pci-mvebu.c| 11 ---
 drivers/pci/host/pci-rcar-gen2.c| 12 +++-
 drivers/pci/host/pci-tegra.c| 11 ---
 drivers/pci/host/pci-thunder-ecam.c |  8 ++--
 drivers/pci/host/pci-thunder-pem.c  |  8 ++--
 drivers/pci/host/pci-xgene.c|  8 ++--
 drivers/pci/host/pcie-armada8k.c| 14 +-
 drivers/pci/host/pcie-artpec6.c | 10 ++
 drivers/pci/host/pcie-designware-plat.c | 10 ++
 drivers/pci/host/pcie-hisi.c

[PATCH 04/14] PCI: generic: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_HOST_GENERIC
drivers/pci/host/Kconfig:   bool "Generic PCI host controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Will Deacon 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-host-generic.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pci-host-generic.c 
b/drivers/pci/host/pci-host-generic.c
index f0ca6de0d87e..c05ea9d72f69 100644
--- a/drivers/pci/host/pci-host-generic.c
+++ b/drivers/pci/host/pci-host-generic.c
@@ -20,7 +20,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -45,8 +45,6 @@ static const struct of_device_id gen_pci_of_match[] = {
{ },
 };
 
-MODULE_DEVICE_TABLE(of, gen_pci_of_match);
-
 static int gen_pci_probe(struct platform_device *pdev)
 {
const struct of_device_id *of_id;
@@ -65,8 +63,4 @@ static struct platform_driver gen_pci_driver = {
},
.probe = gen_pci_probe,
 };
-module_platform_driver(gen_pci_driver);
-
-MODULE_DESCRIPTION("Generic PCI host driver");
-MODULE_AUTHOR("Will Deacon ");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(gen_pci_driver);
-- 
2.8.4



[PATCH 00/14] PCI: trivial demodularization of builtin code

2016-07-02 Thread Paul Gortmaker
Firstly, this group of commits was chosen for the fact that they don't
change anything even at a binary object file level ; they just replace
module_platform_driver with builtin_platform_driver, and remove some
MODULE_ tags that are no-ops in code.  So the regression risk
is zero here.

More specifically, we are doing the following to pci/host files that
currently can only be built-in:

 -- remove the include of module.h ; replace it with init.h as req'd

 -- drop instances of MODULE_DEVICE_TABLE which is a no-op built-in.

 -- replace module_platform_driver with builtin_platform_driver, which
is functionally identical once CPP has processed the source.

 -- drop instances of MODULE_LICENSE, MODULE_AUTHOR, MODULE_DESCRIPTION
while ensuring the contained info is present in the file comments.

After considering the inital version of demodularization PCI host
commits[1], we did consider striving for tristate[2] on another
subset of PCI host files in order to keep bzImage sizes lower on
multi-platform builds, but that proved to have technical challenges
well outside the scope of what we are trying to achieve here, given
PCI is infrastructure code and not a case of simple endpoint
drivers.

In the meantime more new code copies the existing examples of bool
Kconfig using modular references; further expanding the problem
space.  So we are just going to proceed with the demodularization
as originally planned.  Nothing removed here is rocket science, and
can easily be restored if someone has the hardware to test on and
the desire to expand functionality into the tristate realm.

A more complete description of why we are doing this can be found
in the original posting[1] for those that haven't seen it yet.

This represents just over 1/2 the PCI drivers that have their Kconfig
as bool but needlessly use modular references.  The remainder do not
deliver exact binary equivalence, since they delete unused __exit
functions and/or unused ".remove" functions.  So they are more
appropriate for submission earlier in the next development window.

Build tested for allmodconfig on several arch, including ARM and
ARM-64 on the most recent linux-next baseline.

Paul.

[1] 
https://lkml.kernel.org/r/1449970917-12633-1-git-send-email-paul.gortma...@windriver.com
[2] 
https://lkml.kernel.org/r/1454889644-27830-1-git-send-email-paul.gortma...@windriver.com

---

[vs v1 in [1] above, I tweaked the subjects slightly to match the
 format used by most PCI commits, i.e drop the "driver/" prefix. ]

Cc: Alexandre Courbot 
Cc: Bjorn Helgaas 
Cc: David Daney 
Cc: Gabriele Paoloni 
Cc: Jason Cooper 
Cc: Jesper Nilsson 
Cc: Jingoo Han 
Cc: Joao Pinto 
Cc: Minghuan Lian 
Cc: Mingkai Hu 
Cc: Murali Karicheri 
Cc: Niklas Cassel 
Cc: Phil Edworthy 
Cc: Pratyush Anand 
Cc: Roy Zang 
Cc: Simon Horman 
Cc: Stephen Warren 
Cc: Tanmay Inamdar 
Cc: Thierry Reding 
Cc: Thomas Petazzoni 
Cc: Valentine Barshak 
Cc: Will Deacon 
Cc: Zhou Wang 
Cc: linux-...@vger.kernel.org
Cc: linux-te...@vger.kernel.org

Paul Gortmaker (14):
  PCI: armada8k: make it explicitly non-modular
  PCI: artpec6: make it explicitly non-modular
  PCI: designware-plat: make it explicitly non-modular
  PCI: generic: make it explicitly non-modular
  PCI: hisi: make it explicitly non-modular
  PCI: keystone: make it explicitly non-modular
  PCI: layerscape: make it explicitly non-modular
  PCI: mvebu: make it explicitly non-modular
  PCI: rcar: make it explicitly non-modular
  PCI: rcar-gen2: make it explicitly non-modular
  PCI: tegra: make it explicitly non-modular
  PCI: thunder-ecam: make it explicitly non-modular
  PCI: thunder-pem: make it explicitly non-modular
  PCI: xgene: make it explicitly non-modular

 drivers/pci/host/pci-host-generic.c | 10 ++
 drivers/pci/host/pci-keystone.c | 10 ++
 drivers/pci/host/pci-layerscape.c   | 10 ++
 drivers/pci/host/pci-mvebu.c| 11 ---
 drivers/pci/host/pci-rcar-gen2.c| 12 +++-
 drivers/pci/host/pci-tegra.c| 11 ---
 drivers/pci/host/pci-thunder-ecam.c |  8 ++--
 drivers/pci/host/pci-thunder-pem.c  |  8 ++--
 drivers/pci/host/pci-xgene.c|  8 ++--
 drivers/pci/host/pcie-armada8k.c| 14 +-
 drivers/pci/host/pcie-artpec6.c | 10 ++
 drivers/pci/host/pcie-designware-plat.c | 10 ++
 drivers/pci/host/pcie-hisi.c| 13 ++---
 drivers/pci/host/pcie-rcar.c| 11 ---
 14 files changed, 38 insertions(+), 108 deletions(-)

-- 
2.8.4



[PATCH 04/14] PCI: generic: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_HOST_GENERIC
drivers/pci/host/Kconfig:   bool "Generic PCI host controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Will Deacon 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-host-generic.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pci-host-generic.c 
b/drivers/pci/host/pci-host-generic.c
index f0ca6de0d87e..c05ea9d72f69 100644
--- a/drivers/pci/host/pci-host-generic.c
+++ b/drivers/pci/host/pci-host-generic.c
@@ -20,7 +20,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -45,8 +45,6 @@ static const struct of_device_id gen_pci_of_match[] = {
{ },
 };
 
-MODULE_DEVICE_TABLE(of, gen_pci_of_match);
-
 static int gen_pci_probe(struct platform_device *pdev)
 {
const struct of_device_id *of_id;
@@ -65,8 +63,4 @@ static struct platform_driver gen_pci_driver = {
},
.probe = gen_pci_probe,
 };
-module_platform_driver(gen_pci_driver);
-
-MODULE_DESCRIPTION("Generic PCI host driver");
-MODULE_AUTHOR("Will Deacon ");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(gen_pci_driver);
-- 
2.8.4



[PATCH 05/14] PCI: hisi: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

host/Kconfig:config PCI_HISI
host/Kconfig:bool "HiSilicon Hip05 and Hip06 SoCs PCIe controllers"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Zhou Wang 
Cc: Dacai Zhu 
Cc: Gabriele Paoloni 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-hisi.c | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/pci/host/pcie-hisi.c b/drivers/pci/host/pcie-hisi.c
index 3e98d4edae2d..7ee9dfcc45fb 100644
--- a/drivers/pci/host/pcie-hisi.c
+++ b/drivers/pci/host/pcie-hisi.c
@@ -12,7 +12,7 @@
  * published by the Free Software Foundation.
  */
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -235,9 +235,6 @@ static const struct of_device_id hisi_pcie_of_match[] = {
{},
 };
 
-
-MODULE_DEVICE_TABLE(of, hisi_pcie_of_match);
-
 static struct platform_driver hisi_pcie_driver = {
.probe  = hisi_pcie_probe,
.driver = {
@@ -245,10 +242,4 @@ static struct platform_driver hisi_pcie_driver = {
   .of_match_table = hisi_pcie_of_match,
},
 };
-
-module_platform_driver(hisi_pcie_driver);
-
-MODULE_AUTHOR("Zhou Wang ");
-MODULE_AUTHOR("Dacai Zhu ");
-MODULE_AUTHOR("Gabriele Paoloni ");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(hisi_pcie_driver);
-- 
2.8.4



[PATCH 07/14] PCI: layerscape: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_LAYERSCAPE
drivers/pci/host/Kconfig:   bool "Freescale Layerscape PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple instances of modular code usage, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Minghuan Lian 
Cc: Mingkai Hu 
Cc: Roy Zang 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-layerscape.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pci-layerscape.c 
b/drivers/pci/host/pci-layerscape.c
index a21e229d95e0..114ba819277a 100644
--- a/drivers/pci/host/pci-layerscape.c
+++ b/drivers/pci/host/pci-layerscape.c
@@ -12,7 +12,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -211,7 +211,6 @@ static const struct of_device_id ls_pcie_of_match[] = {
{ .compatible = "fsl,ls2085a-pcie", .data = _drvdata },
{ },
 };
-MODULE_DEVICE_TABLE(of, ls_pcie_of_match);
 
 static int __init ls_add_pcie_port(struct pcie_port *pp,
   struct platform_device *pdev)
@@ -275,9 +274,4 @@ static struct platform_driver ls_pcie_driver = {
.of_match_table = ls_pcie_of_match,
},
 };
-
-module_platform_driver_probe(ls_pcie_driver, ls_pcie_probe);
-
-MODULE_AUTHOR("Minghuan Lian ");
-MODULE_DESCRIPTION("Freescale Layerscape PCIe host controller driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver_probe(ls_pcie_driver, ls_pcie_probe);
-- 
2.8.4



[PATCH 05/14] PCI: hisi: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

host/Kconfig:config PCI_HISI
host/Kconfig:bool "HiSilicon Hip05 and Hip06 SoCs PCIe controllers"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Zhou Wang 
Cc: Dacai Zhu 
Cc: Gabriele Paoloni 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-hisi.c | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/pci/host/pcie-hisi.c b/drivers/pci/host/pcie-hisi.c
index 3e98d4edae2d..7ee9dfcc45fb 100644
--- a/drivers/pci/host/pcie-hisi.c
+++ b/drivers/pci/host/pcie-hisi.c
@@ -12,7 +12,7 @@
  * published by the Free Software Foundation.
  */
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -235,9 +235,6 @@ static const struct of_device_id hisi_pcie_of_match[] = {
{},
 };
 
-
-MODULE_DEVICE_TABLE(of, hisi_pcie_of_match);
-
 static struct platform_driver hisi_pcie_driver = {
.probe  = hisi_pcie_probe,
.driver = {
@@ -245,10 +242,4 @@ static struct platform_driver hisi_pcie_driver = {
   .of_match_table = hisi_pcie_of_match,
},
 };
-
-module_platform_driver(hisi_pcie_driver);
-
-MODULE_AUTHOR("Zhou Wang ");
-MODULE_AUTHOR("Dacai Zhu ");
-MODULE_AUTHOR("Gabriele Paoloni ");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(hisi_pcie_driver);
-- 
2.8.4



[PATCH 07/14] PCI: layerscape: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_LAYERSCAPE
drivers/pci/host/Kconfig:   bool "Freescale Layerscape PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple instances of modular code usage, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Minghuan Lian 
Cc: Mingkai Hu 
Cc: Roy Zang 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-layerscape.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pci-layerscape.c 
b/drivers/pci/host/pci-layerscape.c
index a21e229d95e0..114ba819277a 100644
--- a/drivers/pci/host/pci-layerscape.c
+++ b/drivers/pci/host/pci-layerscape.c
@@ -12,7 +12,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -211,7 +211,6 @@ static const struct of_device_id ls_pcie_of_match[] = {
{ .compatible = "fsl,ls2085a-pcie", .data = _drvdata },
{ },
 };
-MODULE_DEVICE_TABLE(of, ls_pcie_of_match);
 
 static int __init ls_add_pcie_port(struct pcie_port *pp,
   struct platform_device *pdev)
@@ -275,9 +274,4 @@ static struct platform_driver ls_pcie_driver = {
.of_match_table = ls_pcie_of_match,
},
 };
-
-module_platform_driver_probe(ls_pcie_driver, ls_pcie_probe);
-
-MODULE_AUTHOR("Minghuan Lian ");
-MODULE_DESCRIPTION("Freescale Layerscape PCIe host controller driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver_probe(ls_pcie_driver, ls_pcie_probe);
-- 
2.8.4



[PATCH 06/14] PCI: keystone: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_KEYSTONE
drivers/pci/host/Kconfig:   bool "TI Keystone PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple instances of modular code usage, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Murali Karicheri 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-keystone.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c
index 6b8301ef21ca..8ba28834d470 100644
--- a/drivers/pci/host/pci-keystone.c
+++ b/drivers/pci/host/pci-keystone.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -360,7 +360,6 @@ static const struct of_device_id ks_pcie_of_match[] = {
},
{ },
 };
-MODULE_DEVICE_TABLE(of, ks_pcie_of_match);
 
 static int __exit ks_pcie_remove(struct platform_device *pdev)
 {
@@ -439,9 +438,4 @@ static struct platform_driver ks_pcie_driver __refdata = {
.of_match_table = of_match_ptr(ks_pcie_of_match),
},
 };
-
-module_platform_driver(ks_pcie_driver);
-
-MODULE_AUTHOR("Murali Karicheri ");
-MODULE_DESCRIPTION("Keystone PCIe host controller driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(ks_pcie_driver);
-- 
2.8.4



[PATCH 02/14] PCI: artpec6: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCIE_ARTPEC6
drivers/pci/host/Kconfig:   bool "Axis ARTPEC-6 PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

Cc: Niklas Cassel 
Cc: Jesper Nilsson 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-artpec6.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pcie-artpec6.c b/drivers/pci/host/pcie-artpec6.c
index be54fad4698b..73d4e8cb020b 100644
--- a/drivers/pci/host/pcie-artpec6.c
+++ b/drivers/pci/host/pcie-artpec6.c
@@ -10,7 +10,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -267,7 +267,6 @@ static const struct of_device_id artpec6_pcie_of_match[] = {
{ .compatible = "axis,artpec6-pcie", },
{},
 };
-MODULE_DEVICE_TABLE(of, artpec6_pcie_of_match);
 
 static struct platform_driver artpec6_pcie_driver = {
.probe = artpec6_pcie_probe,
@@ -276,9 +275,4 @@ static struct platform_driver artpec6_pcie_driver = {
.of_match_table = artpec6_pcie_of_match,
},
 };
-
-module_platform_driver(artpec6_pcie_driver);
-
-MODULE_AUTHOR("Niklas Cassel ");
-MODULE_DESCRIPTION("Axis ARTPEC-6 PCIe host controller driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(artpec6_pcie_driver);
-- 
2.8.4



[PATCH 06/14] PCI: keystone: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_KEYSTONE
drivers/pci/host/Kconfig:   bool "TI Keystone PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple instances of modular code usage, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Murali Karicheri 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-keystone.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c
index 6b8301ef21ca..8ba28834d470 100644
--- a/drivers/pci/host/pci-keystone.c
+++ b/drivers/pci/host/pci-keystone.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -360,7 +360,6 @@ static const struct of_device_id ks_pcie_of_match[] = {
},
{ },
 };
-MODULE_DEVICE_TABLE(of, ks_pcie_of_match);
 
 static int __exit ks_pcie_remove(struct platform_device *pdev)
 {
@@ -439,9 +438,4 @@ static struct platform_driver ks_pcie_driver __refdata = {
.of_match_table = of_match_ptr(ks_pcie_of_match),
},
 };
-
-module_platform_driver(ks_pcie_driver);
-
-MODULE_AUTHOR("Murali Karicheri ");
-MODULE_DESCRIPTION("Keystone PCIe host controller driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(ks_pcie_driver);
-- 
2.8.4



[PATCH 02/14] PCI: artpec6: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCIE_ARTPEC6
drivers/pci/host/Kconfig:   bool "Axis ARTPEC-6 PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

Cc: Niklas Cassel 
Cc: Jesper Nilsson 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-artpec6.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pcie-artpec6.c b/drivers/pci/host/pcie-artpec6.c
index be54fad4698b..73d4e8cb020b 100644
--- a/drivers/pci/host/pcie-artpec6.c
+++ b/drivers/pci/host/pcie-artpec6.c
@@ -10,7 +10,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -267,7 +267,6 @@ static const struct of_device_id artpec6_pcie_of_match[] = {
{ .compatible = "axis,artpec6-pcie", },
{},
 };
-MODULE_DEVICE_TABLE(of, artpec6_pcie_of_match);
 
 static struct platform_driver artpec6_pcie_driver = {
.probe = artpec6_pcie_probe,
@@ -276,9 +275,4 @@ static struct platform_driver artpec6_pcie_driver = {
.of_match_table = artpec6_pcie_of_match,
},
 };
-
-module_platform_driver(artpec6_pcie_driver);
-
-MODULE_AUTHOR("Niklas Cassel ");
-MODULE_DESCRIPTION("Axis ARTPEC-6 PCIe host controller driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(artpec6_pcie_driver);
-- 
2.8.4



Re: [PATCH RFC 0/7] support clk setting during kernel early boot

2016-07-02 Thread Stefan Agner
On 2016-07-01 18:12, Stephen Boyd wrote:
> On 06/29, Dong Aisheng wrote:
>> Recently several people met the kernel complaining
>> "bad: scheduling from the idle thread!" issue which caused by
>> sleeping during kernel early booting phase by calling clk
>> APIs like clk_prepare_enable.
>>
>> See:
>> https://lkml.org/lkml/fancy/2016/1/29/695
>> https://lkml.org/lkml/2016/6/10/779
>> http://www.spinics.net/lists/linux-clk/msg08635.html
> 
> That last one was another bug that happened to trigger this
> problem mistakenly. I doubt critical clks are an issue (more
> below).
> 
>>
>> The calling sequence simply could be like:
>> start_kernel
>>   ->time_init
>> ->of_clk_init
>>   ->clk_core_prepare
>> ->clk_pllv3_prepare
>>   ->usleep_range
>> ->dequeue_task_idle
>>
>> This issue is mainly caused during time_init, the irq is still
>> not enabled and scheduler is still not ready, thus there's no way
>> to allow sleep at that time.
>>
>> However, there're many exist platforms calling clk_prepare_enable/
>> clk_get_rate/clk_set_parent at that time in CLK_OF_DECLARE init
>> function.
>> e.g
>> drivers/clk/imx/clk-{soc}.c
>> drivers/clk/rockchip/clk-rk3188.c
>> drivers/clk/ti/clk-44xx.c
>> ...
>>
>> And irqchip and clock source is also initialized before it which
>> may requires to do clk settings.
>>
>> Furthermore, current clk framework also supports critical clocks
>> flagged by CLK_IS_CRITICAL which will be prepared and
>> enabled during clk_register by clk core, that is also happened
>> quite early in of_clk_init usually.
>>
>> And clk framework also supports assign default clk rate and parent for
>> each registered clk provider which also happens early in of_clk_init.
>> (see of_clk_set_defaults())
>>
>> Above are all possible cases which may cause sleeping during kernel
>> early booting.
> 
> How many of these cases are really happening and causing problems
> though?
> 
>>
>> So it seems we'd like to have the requirement to make kernel support
>> calling clk APIs during kernel early boot without sleep.
> 
> I wonder if the problem is more that the framework doesn't know
> the hardware state of on/off when it initializes? So we call the
> clk_ops prepare/enable functions when we really shouldn't be
> doing that at all because the clk is already prepared/enabled.
> Presumably for critical clks, we shouldn't go and touch any
> hardware to turn them on, because by definition they're critical
> and should already be on anyway.

I found that remark interesting, and agree here with Stephen, critical
clks should be already on and everything else should be controlled from
drivers.

With that in mind I went on and looked again what is currently (after
the parents enable patchset) still wrong on i.MX 7. Turned out to be not
that much, and I think it should be fixable with that:
https://lkml.org/lkml/2016/7/2/138

--
Stefan



Re: [PATCH RFC 0/7] support clk setting during kernel early boot

2016-07-02 Thread Stefan Agner
On 2016-07-01 18:12, Stephen Boyd wrote:
> On 06/29, Dong Aisheng wrote:
>> Recently several people met the kernel complaining
>> "bad: scheduling from the idle thread!" issue which caused by
>> sleeping during kernel early booting phase by calling clk
>> APIs like clk_prepare_enable.
>>
>> See:
>> https://lkml.org/lkml/fancy/2016/1/29/695
>> https://lkml.org/lkml/2016/6/10/779
>> http://www.spinics.net/lists/linux-clk/msg08635.html
> 
> That last one was another bug that happened to trigger this
> problem mistakenly. I doubt critical clks are an issue (more
> below).
> 
>>
>> The calling sequence simply could be like:
>> start_kernel
>>   ->time_init
>> ->of_clk_init
>>   ->clk_core_prepare
>> ->clk_pllv3_prepare
>>   ->usleep_range
>> ->dequeue_task_idle
>>
>> This issue is mainly caused during time_init, the irq is still
>> not enabled and scheduler is still not ready, thus there's no way
>> to allow sleep at that time.
>>
>> However, there're many exist platforms calling clk_prepare_enable/
>> clk_get_rate/clk_set_parent at that time in CLK_OF_DECLARE init
>> function.
>> e.g
>> drivers/clk/imx/clk-{soc}.c
>> drivers/clk/rockchip/clk-rk3188.c
>> drivers/clk/ti/clk-44xx.c
>> ...
>>
>> And irqchip and clock source is also initialized before it which
>> may requires to do clk settings.
>>
>> Furthermore, current clk framework also supports critical clocks
>> flagged by CLK_IS_CRITICAL which will be prepared and
>> enabled during clk_register by clk core, that is also happened
>> quite early in of_clk_init usually.
>>
>> And clk framework also supports assign default clk rate and parent for
>> each registered clk provider which also happens early in of_clk_init.
>> (see of_clk_set_defaults())
>>
>> Above are all possible cases which may cause sleeping during kernel
>> early booting.
> 
> How many of these cases are really happening and causing problems
> though?
> 
>>
>> So it seems we'd like to have the requirement to make kernel support
>> calling clk APIs during kernel early boot without sleep.
> 
> I wonder if the problem is more that the framework doesn't know
> the hardware state of on/off when it initializes? So we call the
> clk_ops prepare/enable functions when we really shouldn't be
> doing that at all because the clk is already prepared/enabled.
> Presumably for critical clks, we shouldn't go and touch any
> hardware to turn them on, because by definition they're critical
> and should already be on anyway.

I found that remark interesting, and agree here with Stephen, critical
clks should be already on and everything else should be controlled from
drivers.

With that in mind I went on and looked again what is currently (after
the parents enable patchset) still wrong on i.MX 7. Turned out to be not
that much, and I think it should be fixable with that:
https://lkml.org/lkml/2016/7/2/138

--
Stefan



[PATCH 09/14] PCI: rcar: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_RCAR_GEN2_PCIE
drivers/pci/host/Kconfig:   bool "Renesas R-Car PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Simon Horman 
Acked-by: Simon Horman 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Cc: Phil Edworthy 
Acked-by: Phil Edworthy 
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-rcar.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 6546ca79f188..7e61ae41910e 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -7,6 +7,8 @@
  *  arch/sh/drivers/pci/ops-sh7786.c
  *  Copyright (C) 2009 - 2011  Paul Mundt
  *
+ * Module Author: Phil Edworthy 
+ *
  * This file is licensed under the terms of the GNU General Public
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
@@ -18,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -936,7 +938,6 @@ static const struct of_device_id rcar_pcie_of_match[] = {
{ .compatible = "renesas,pcie-r8a7795", .data = rcar_pcie_hw_init },
{},
 };
-MODULE_DEVICE_TABLE(of, rcar_pcie_of_match);
 
 static int rcar_pcie_parse_request_of_pci_ranges(struct rcar_pcie *pci)
 {
@@ -1056,8 +1057,4 @@ static struct platform_driver rcar_pcie_driver = {
},
.probe = rcar_pcie_probe,
 };
-module_platform_driver(rcar_pcie_driver);
-
-MODULE_AUTHOR("Phil Edworthy ");
-MODULE_DESCRIPTION("Renesas R-Car PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(rcar_pcie_driver);
-- 
2.8.4



[PATCH 11/14] PCI: tegra: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_TEGRA
drivers/pci/host/Kconfig:   bool "NVIDIA Tegra PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Thierry Reding 
Cc: Bjorn Helgaas 
Cc: Stephen Warren 
Cc: Alexandre Courbot 
Cc: linux-te...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-tegra.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 013d5488f9f8..c9a8eb252f50 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -9,6 +9,8 @@
  *
  * Bits taken from arch/arm/mach-dove/pcie.c
  *
+ * Author: Thierry Reding 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -32,7 +34,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -2088,7 +2090,6 @@ static const struct of_device_id tegra_pcie_of_match[] = {
{ .compatible = "nvidia,tegra20-pcie", .data = _pcie_data },
{ },
 };
-MODULE_DEVICE_TABLE(of, tegra_pcie_of_match);
 
 static void *tegra_pcie_ports_seq_start(struct seq_file *s, loff_t *pos)
 {
@@ -2277,8 +2278,4 @@ static struct platform_driver tegra_pcie_driver = {
},
.probe = tegra_pcie_probe,
 };
-module_platform_driver(tegra_pcie_driver);
-
-MODULE_AUTHOR("Thierry Reding ");
-MODULE_DESCRIPTION("NVIDIA Tegra PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(tegra_pcie_driver);
-- 
2.8.4



[PATCH 09/14] PCI: rcar: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_RCAR_GEN2_PCIE
drivers/pci/host/Kconfig:   bool "Renesas R-Car PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Simon Horman 
Acked-by: Simon Horman 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Cc: Phil Edworthy 
Acked-by: Phil Edworthy 
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-rcar.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 6546ca79f188..7e61ae41910e 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -7,6 +7,8 @@
  *  arch/sh/drivers/pci/ops-sh7786.c
  *  Copyright (C) 2009 - 2011  Paul Mundt
  *
+ * Module Author: Phil Edworthy 
+ *
  * This file is licensed under the terms of the GNU General Public
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
@@ -18,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -936,7 +938,6 @@ static const struct of_device_id rcar_pcie_of_match[] = {
{ .compatible = "renesas,pcie-r8a7795", .data = rcar_pcie_hw_init },
{},
 };
-MODULE_DEVICE_TABLE(of, rcar_pcie_of_match);
 
 static int rcar_pcie_parse_request_of_pci_ranges(struct rcar_pcie *pci)
 {
@@ -1056,8 +1057,4 @@ static struct platform_driver rcar_pcie_driver = {
},
.probe = rcar_pcie_probe,
 };
-module_platform_driver(rcar_pcie_driver);
-
-MODULE_AUTHOR("Phil Edworthy ");
-MODULE_DESCRIPTION("Renesas R-Car PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(rcar_pcie_driver);
-- 
2.8.4



[PATCH 11/14] PCI: tegra: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_TEGRA
drivers/pci/host/Kconfig:   bool "NVIDIA Tegra PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Thierry Reding 
Cc: Bjorn Helgaas 
Cc: Stephen Warren 
Cc: Alexandre Courbot 
Cc: linux-te...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-tegra.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 013d5488f9f8..c9a8eb252f50 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -9,6 +9,8 @@
  *
  * Bits taken from arch/arm/mach-dove/pcie.c
  *
+ * Author: Thierry Reding 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -32,7 +34,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -2088,7 +2090,6 @@ static const struct of_device_id tegra_pcie_of_match[] = {
{ .compatible = "nvidia,tegra20-pcie", .data = _pcie_data },
{ },
 };
-MODULE_DEVICE_TABLE(of, tegra_pcie_of_match);
 
 static void *tegra_pcie_ports_seq_start(struct seq_file *s, loff_t *pos)
 {
@@ -2277,8 +2278,4 @@ static struct platform_driver tegra_pcie_driver = {
},
.probe = tegra_pcie_probe,
 };
-module_platform_driver(tegra_pcie_driver);
-
-MODULE_AUTHOR("Thierry Reding ");
-MODULE_DESCRIPTION("NVIDIA Tegra PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(tegra_pcie_driver);
-- 
2.8.4



[PATCH 1/2] net: ethernet: smsc: smsc911x: use phydev from struct net_device

2016-07-02 Thread Philippe Reynes
The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/smsc/smsc911x.c |   66 --
 1 files changed, 31 insertions(+), 35 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c 
b/drivers/net/ethernet/smsc/smsc911x.c
index b5ab5e1..6fded67 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -114,7 +114,6 @@ struct smsc911x_data {
/* spinlock to ensure register accesses are serialised */
spinlock_t dev_lock;
 
-   struct phy_device *phy_dev;
struct mii_bus *mii_bus;
unsigned int using_extphy;
int last_duplex;
@@ -833,7 +832,7 @@ static int smsc911x_phy_reset(struct smsc911x_data *pdata)
 static int smsc911x_phy_loopbacktest(struct net_device *dev)
 {
struct smsc911x_data *pdata = netdev_priv(dev);
-   struct phy_device *phy_dev = pdata->phy_dev;
+   struct phy_device *phy_dev = dev->phydev;
int result = -EIO;
unsigned int i, val;
unsigned long flags;
@@ -903,7 +902,8 @@ static int smsc911x_phy_loopbacktest(struct net_device *dev)
 
 static void smsc911x_phy_update_flowcontrol(struct smsc911x_data *pdata)
 {
-   struct phy_device *phy_dev = pdata->phy_dev;
+   struct net_device *ndev = pdata->dev;
+   struct phy_device *phy_dev = ndev->phydev;
u32 afc = smsc911x_reg_read(pdata, AFC_CFG);
u32 flow;
unsigned long flags;
@@ -944,7 +944,7 @@ static void smsc911x_phy_update_flowcontrol(struct 
smsc911x_data *pdata)
 static void smsc911x_phy_adjust_link(struct net_device *dev)
 {
struct smsc911x_data *pdata = netdev_priv(dev);
-   struct phy_device *phy_dev = pdata->phy_dev;
+   struct phy_device *phy_dev = dev->phydev;
unsigned long flags;
int carrier;
 
@@ -1037,7 +1037,6 @@ static int smsc911x_mii_probe(struct net_device *dev)
  SUPPORTED_Asym_Pause);
phydev->advertising = phydev->supported;
 
-   pdata->phy_dev = phydev;
pdata->last_duplex = -1;
pdata->last_carrier = -1;
 
@@ -1338,9 +1337,11 @@ static void 
smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata)
 
 static int smsc911x_phy_general_power_up(struct smsc911x_data *pdata)
 {
+   struct net_device *ndev = pdata->dev;
+   struct phy_device *phy_dev = ndev->phydev;
int rc = 0;
 
-   if (!pdata->phy_dev)
+   if (!phy_dev)
return rc;
 
/* If the internal PHY is in General Power-Down mode, all, except the
@@ -1350,7 +1351,7 @@ static int smsc911x_phy_general_power_up(struct 
smsc911x_data *pdata)
 * In that case, clear the bit 0.11, so the PHY powers up and we can
 * access to the phy registers.
 */
-   rc = phy_read(pdata->phy_dev, MII_BMCR);
+   rc = phy_read(phy_dev, MII_BMCR);
if (rc < 0) {
SMSC_WARN(pdata, drv, "Failed reading PHY control reg");
return rc;
@@ -1360,7 +1361,7 @@ static int smsc911x_phy_general_power_up(struct 
smsc911x_data *pdata)
 * disable the general power down-mode.
 */
if (rc & BMCR_PDOWN) {
-   rc = phy_write(pdata->phy_dev, MII_BMCR, rc & ~BMCR_PDOWN);
+   rc = phy_write(phy_dev, MII_BMCR, rc & ~BMCR_PDOWN);
if (rc < 0) {
SMSC_WARN(pdata, drv, "Failed writing PHY control reg");
return rc;
@@ -1374,12 +1375,14 @@ static int smsc911x_phy_general_power_up(struct 
smsc911x_data *pdata)
 
 static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata)
 {
+   struct net_device *ndev = pdata->dev;
+   struct phy_device *phy_dev = ndev->phydev;
int rc = 0;
 
-   if (!pdata->phy_dev)
+   if (!phy_dev)
return rc;
 
-   rc = phy_read(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS);
+   rc = phy_read(phy_dev, MII_LAN83C185_CTRL_STATUS);
 
if (rc < 0) {
SMSC_WARN(pdata, drv, "Failed reading PHY control reg");
@@ -1389,7 +1392,7 @@ static int smsc911x_phy_disable_energy_detect(struct 
smsc911x_data *pdata)
/* Only disable if energy detect mode is already enabled */
if (rc & MII_LAN83C185_EDPWRDOWN) {
/* Disable energy detect mode for this SMSC Transceivers */
-   rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS,
+   rc = phy_write(phy_dev, MII_LAN83C185_CTRL_STATUS,
   rc & (~MII_LAN83C185_EDPWRDOWN));
 
if (rc < 0) {
@@ -1405,12 +1408,14 @@ static int smsc911x_phy_disable_energy_detect(struct 
smsc911x_data *pdata)
 
 static int smsc911x_phy_enable_energy_detect(struct 

[PATCH 1/2] net: ethernet: smsc: smsc911x: use phydev from struct net_device

2016-07-02 Thread Philippe Reynes
The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/smsc/smsc911x.c |   66 --
 1 files changed, 31 insertions(+), 35 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c 
b/drivers/net/ethernet/smsc/smsc911x.c
index b5ab5e1..6fded67 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -114,7 +114,6 @@ struct smsc911x_data {
/* spinlock to ensure register accesses are serialised */
spinlock_t dev_lock;
 
-   struct phy_device *phy_dev;
struct mii_bus *mii_bus;
unsigned int using_extphy;
int last_duplex;
@@ -833,7 +832,7 @@ static int smsc911x_phy_reset(struct smsc911x_data *pdata)
 static int smsc911x_phy_loopbacktest(struct net_device *dev)
 {
struct smsc911x_data *pdata = netdev_priv(dev);
-   struct phy_device *phy_dev = pdata->phy_dev;
+   struct phy_device *phy_dev = dev->phydev;
int result = -EIO;
unsigned int i, val;
unsigned long flags;
@@ -903,7 +902,8 @@ static int smsc911x_phy_loopbacktest(struct net_device *dev)
 
 static void smsc911x_phy_update_flowcontrol(struct smsc911x_data *pdata)
 {
-   struct phy_device *phy_dev = pdata->phy_dev;
+   struct net_device *ndev = pdata->dev;
+   struct phy_device *phy_dev = ndev->phydev;
u32 afc = smsc911x_reg_read(pdata, AFC_CFG);
u32 flow;
unsigned long flags;
@@ -944,7 +944,7 @@ static void smsc911x_phy_update_flowcontrol(struct 
smsc911x_data *pdata)
 static void smsc911x_phy_adjust_link(struct net_device *dev)
 {
struct smsc911x_data *pdata = netdev_priv(dev);
-   struct phy_device *phy_dev = pdata->phy_dev;
+   struct phy_device *phy_dev = dev->phydev;
unsigned long flags;
int carrier;
 
@@ -1037,7 +1037,6 @@ static int smsc911x_mii_probe(struct net_device *dev)
  SUPPORTED_Asym_Pause);
phydev->advertising = phydev->supported;
 
-   pdata->phy_dev = phydev;
pdata->last_duplex = -1;
pdata->last_carrier = -1;
 
@@ -1338,9 +1337,11 @@ static void 
smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata)
 
 static int smsc911x_phy_general_power_up(struct smsc911x_data *pdata)
 {
+   struct net_device *ndev = pdata->dev;
+   struct phy_device *phy_dev = ndev->phydev;
int rc = 0;
 
-   if (!pdata->phy_dev)
+   if (!phy_dev)
return rc;
 
/* If the internal PHY is in General Power-Down mode, all, except the
@@ -1350,7 +1351,7 @@ static int smsc911x_phy_general_power_up(struct 
smsc911x_data *pdata)
 * In that case, clear the bit 0.11, so the PHY powers up and we can
 * access to the phy registers.
 */
-   rc = phy_read(pdata->phy_dev, MII_BMCR);
+   rc = phy_read(phy_dev, MII_BMCR);
if (rc < 0) {
SMSC_WARN(pdata, drv, "Failed reading PHY control reg");
return rc;
@@ -1360,7 +1361,7 @@ static int smsc911x_phy_general_power_up(struct 
smsc911x_data *pdata)
 * disable the general power down-mode.
 */
if (rc & BMCR_PDOWN) {
-   rc = phy_write(pdata->phy_dev, MII_BMCR, rc & ~BMCR_PDOWN);
+   rc = phy_write(phy_dev, MII_BMCR, rc & ~BMCR_PDOWN);
if (rc < 0) {
SMSC_WARN(pdata, drv, "Failed writing PHY control reg");
return rc;
@@ -1374,12 +1375,14 @@ static int smsc911x_phy_general_power_up(struct 
smsc911x_data *pdata)
 
 static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata)
 {
+   struct net_device *ndev = pdata->dev;
+   struct phy_device *phy_dev = ndev->phydev;
int rc = 0;
 
-   if (!pdata->phy_dev)
+   if (!phy_dev)
return rc;
 
-   rc = phy_read(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS);
+   rc = phy_read(phy_dev, MII_LAN83C185_CTRL_STATUS);
 
if (rc < 0) {
SMSC_WARN(pdata, drv, "Failed reading PHY control reg");
@@ -1389,7 +1392,7 @@ static int smsc911x_phy_disable_energy_detect(struct 
smsc911x_data *pdata)
/* Only disable if energy detect mode is already enabled */
if (rc & MII_LAN83C185_EDPWRDOWN) {
/* Disable energy detect mode for this SMSC Transceivers */
-   rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS,
+   rc = phy_write(phy_dev, MII_LAN83C185_CTRL_STATUS,
   rc & (~MII_LAN83C185_EDPWRDOWN));
 
if (rc < 0) {
@@ -1405,12 +1408,14 @@ static int smsc911x_phy_disable_energy_detect(struct 
smsc911x_data *pdata)
 
 static int smsc911x_phy_enable_energy_detect(struct smsc911x_data *pdata)

[PATCH 08/14] PCI: mvebu: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_MVEBU
drivers/pci/host/Kconfig:   bool "Marvell EBU PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Thomas Petazzoni 
Reviewed-by: Thomas Petazzoni 
Cc: Jason Cooper 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-mvebu.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 2287a4e18add..4545d204f864 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -1,6 +1,8 @@
 /*
  * PCIe driver for Marvell Armada 370 and Armada XP SoCs
  *
+ * Module Author: Thomas Petazzoni 
+ *
  * This file is licensed under the terms of the GNU General Public
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
@@ -11,7 +13,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -1295,7 +1297,6 @@ static const struct of_device_id 
mvebu_pcie_of_match_table[] = {
{ .compatible = "marvell,kirkwood-pcie", },
{},
 };
-MODULE_DEVICE_TABLE(of, mvebu_pcie_of_match_table);
 
 static const struct dev_pm_ops mvebu_pcie_pm_ops = {
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mvebu_pcie_suspend, mvebu_pcie_resume)
@@ -1311,8 +1312,4 @@ static struct platform_driver mvebu_pcie_driver = {
},
.probe = mvebu_pcie_probe,
 };
-module_platform_driver(mvebu_pcie_driver);
-
-MODULE_AUTHOR("Thomas Petazzoni ");
-MODULE_DESCRIPTION("Marvell EBU PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(mvebu_pcie_driver);
-- 
2.8.4



[PATCH 14/14] PCI: xgene: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_XGENE
drivers/pci/host/Kconfig:   bool "X-Gene PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Tanmay Inamdar 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-xgene.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index 7eb20cc76dd3..a81273c23341 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -21,7 +21,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -579,8 +579,4 @@ static struct platform_driver xgene_pcie_driver = {
},
.probe = xgene_pcie_probe_bridge,
 };
-module_platform_driver(xgene_pcie_driver);
-
-MODULE_AUTHOR("Tanmay Inamdar ");
-MODULE_DESCRIPTION("APM X-Gene PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(xgene_pcie_driver);
-- 
2.8.4



[PATCH 10/14] PCI: rcar-gen2: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_RCAR_GEN2
drivers/pci/host/Kconfig:   bool "Renesas R-Car Gen2 Internal PCI 
controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Simon Horman 
Acked-by: Simon Horman 
Cc: Bjorn Helgaas 
Cc: Phil Edworthy 
Cc: Valentine Barshak 
Acked-by: Phil Edworthy 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-rcar-gen2.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c
index e8f5ac84b2c6..77a451cd3e32 100644
--- a/drivers/pci/host/pci-rcar-gen2.c
+++ b/drivers/pci/host/pci-rcar-gen2.c
@@ -4,6 +4,8 @@
  * Copyright (C) 2013 Renesas Solutions Corp.
  * Copyright (C) 2013 Cogent Embedded, Inc.
  *
+ * Module Author: Valentine Barshak 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
@@ -14,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -432,8 +433,6 @@ static struct of_device_id rcar_pci_of_match[] = {
{ },
 };
 
-MODULE_DEVICE_TABLE(of, rcar_pci_of_match);
-
 static struct platform_driver rcar_pci_driver = {
.driver = {
.name = "pci-rcar-gen2",
@@ -442,9 +441,4 @@ static struct platform_driver rcar_pci_driver = {
},
.probe = rcar_pci_probe,
 };
-
-module_platform_driver(rcar_pci_driver);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("Renesas R-Car Gen2 internal PCI");
-MODULE_AUTHOR("Valentine Barshak ");
+builtin_platform_driver(rcar_pci_driver);
-- 
2.8.4



[PATCH 08/14] PCI: mvebu: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_MVEBU
drivers/pci/host/Kconfig:   bool "Marvell EBU PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Thomas Petazzoni 
Reviewed-by: Thomas Petazzoni 
Cc: Jason Cooper 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-mvebu.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 2287a4e18add..4545d204f864 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -1,6 +1,8 @@
 /*
  * PCIe driver for Marvell Armada 370 and Armada XP SoCs
  *
+ * Module Author: Thomas Petazzoni 
+ *
  * This file is licensed under the terms of the GNU General Public
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
@@ -11,7 +13,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -1295,7 +1297,6 @@ static const struct of_device_id 
mvebu_pcie_of_match_table[] = {
{ .compatible = "marvell,kirkwood-pcie", },
{},
 };
-MODULE_DEVICE_TABLE(of, mvebu_pcie_of_match_table);
 
 static const struct dev_pm_ops mvebu_pcie_pm_ops = {
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mvebu_pcie_suspend, mvebu_pcie_resume)
@@ -1311,8 +1312,4 @@ static struct platform_driver mvebu_pcie_driver = {
},
.probe = mvebu_pcie_probe,
 };
-module_platform_driver(mvebu_pcie_driver);
-
-MODULE_AUTHOR("Thomas Petazzoni ");
-MODULE_DESCRIPTION("Marvell EBU PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(mvebu_pcie_driver);
-- 
2.8.4



[PATCH 14/14] PCI: xgene: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_XGENE
drivers/pci/host/Kconfig:   bool "X-Gene PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Tanmay Inamdar 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-xgene.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index 7eb20cc76dd3..a81273c23341 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -21,7 +21,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -579,8 +579,4 @@ static struct platform_driver xgene_pcie_driver = {
},
.probe = xgene_pcie_probe_bridge,
 };
-module_platform_driver(xgene_pcie_driver);
-
-MODULE_AUTHOR("Tanmay Inamdar ");
-MODULE_DESCRIPTION("APM X-Gene PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(xgene_pcie_driver);
-- 
2.8.4



[PATCH 10/14] PCI: rcar-gen2: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_RCAR_GEN2
drivers/pci/host/Kconfig:   bool "Renesas R-Car Gen2 Internal PCI 
controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Simon Horman 
Acked-by: Simon Horman 
Cc: Bjorn Helgaas 
Cc: Phil Edworthy 
Cc: Valentine Barshak 
Acked-by: Phil Edworthy 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-rcar-gen2.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c
index e8f5ac84b2c6..77a451cd3e32 100644
--- a/drivers/pci/host/pci-rcar-gen2.c
+++ b/drivers/pci/host/pci-rcar-gen2.c
@@ -4,6 +4,8 @@
  * Copyright (C) 2013 Renesas Solutions Corp.
  * Copyright (C) 2013 Cogent Embedded, Inc.
  *
+ * Module Author: Valentine Barshak 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
@@ -14,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -432,8 +433,6 @@ static struct of_device_id rcar_pci_of_match[] = {
{ },
 };
 
-MODULE_DEVICE_TABLE(of, rcar_pci_of_match);
-
 static struct platform_driver rcar_pci_driver = {
.driver = {
.name = "pci-rcar-gen2",
@@ -442,9 +441,4 @@ static struct platform_driver rcar_pci_driver = {
},
.probe = rcar_pci_probe,
 };
-
-module_platform_driver(rcar_pci_driver);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("Renesas R-Car Gen2 internal PCI");
-MODULE_AUTHOR("Valentine Barshak ");
+builtin_platform_driver(rcar_pci_driver);
-- 
2.8.4



[PATCH 12/14] PCI: thunder-ecam: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_HOST_THUNDER_ECAM
drivers/pci/host/Kconfig:   bool "Cavium Thunder ECAM controller to on-chip 
devices on pass-1.x silicon"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: David Daney 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-thunder-ecam.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/host/pci-thunder-ecam.c 
b/drivers/pci/host/pci-thunder-ecam.c
index a9fc1c9105fd..d50a3dc2d8db 100644
--- a/drivers/pci/host/pci-thunder-ecam.c
+++ b/drivers/pci/host/pci-thunder-ecam.c
@@ -7,7 +7,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -359,7 +359,6 @@ static const struct of_device_id thunder_ecam_of_match[] = {
{ .compatible = "cavium,pci-host-thunder-ecam" },
{ },
 };
-MODULE_DEVICE_TABLE(of, thunder_ecam_of_match);
 
 static int thunder_ecam_probe(struct platform_device *pdev)
 {
@@ -373,7 +372,4 @@ static struct platform_driver thunder_ecam_driver = {
},
.probe = thunder_ecam_probe,
 };
-module_platform_driver(thunder_ecam_driver);
-
-MODULE_DESCRIPTION("Thunder ECAM PCI host driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(thunder_ecam_driver);
-- 
2.8.4



[PATCH 12/14] PCI: thunder-ecam: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_HOST_THUNDER_ECAM
drivers/pci/host/Kconfig:   bool "Cavium Thunder ECAM controller to on-chip 
devices on pass-1.x silicon"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: David Daney 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-thunder-ecam.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/host/pci-thunder-ecam.c 
b/drivers/pci/host/pci-thunder-ecam.c
index a9fc1c9105fd..d50a3dc2d8db 100644
--- a/drivers/pci/host/pci-thunder-ecam.c
+++ b/drivers/pci/host/pci-thunder-ecam.c
@@ -7,7 +7,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -359,7 +359,6 @@ static const struct of_device_id thunder_ecam_of_match[] = {
{ .compatible = "cavium,pci-host-thunder-ecam" },
{ },
 };
-MODULE_DEVICE_TABLE(of, thunder_ecam_of_match);
 
 static int thunder_ecam_probe(struct platform_device *pdev)
 {
@@ -373,7 +372,4 @@ static struct platform_driver thunder_ecam_driver = {
},
.probe = thunder_ecam_probe,
 };
-module_platform_driver(thunder_ecam_driver);
-
-MODULE_DESCRIPTION("Thunder ECAM PCI host driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(thunder_ecam_driver);
-- 
2.8.4



[PATCH 2/2] net: ethernet: smsc: smsc911x: use phy_ethtool_{get|set}_link_ksettings

2016-07-02 Thread Philippe Reynes
There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/smsc/smsc911x.c |   18 ++
 1 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c 
b/drivers/net/ethernet/smsc/smsc911x.c
index 6fded67..ca31345 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1915,20 +1915,6 @@ static int smsc911x_do_ioctl(struct net_device *dev, 
struct ifreq *ifr, int cmd)
return phy_mii_ioctl(dev->phydev, ifr, cmd);
 }
 
-static int
-smsc911x_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-   cmd->maxtxpkt = 1;
-   cmd->maxrxpkt = 1;
-   return phy_ethtool_gset(dev->phydev, cmd);
-}
-
-static int
-smsc911x_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-   return phy_ethtool_sset(dev->phydev, cmd);
-}
-
 static void smsc911x_ethtool_getdrvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
 {
@@ -2112,8 +2098,6 @@ static int smsc911x_ethtool_set_eeprom(struct net_device 
*dev,
 }
 
 static const struct ethtool_ops smsc911x_ethtool_ops = {
-   .get_settings = smsc911x_ethtool_getsettings,
-   .set_settings = smsc911x_ethtool_setsettings,
.get_link = ethtool_op_get_link,
.get_drvinfo = smsc911x_ethtool_getdrvinfo,
.nway_reset = smsc911x_ethtool_nwayreset,
@@ -2125,6 +2109,8 @@ static const struct ethtool_ops smsc911x_ethtool_ops = {
.get_eeprom = smsc911x_ethtool_get_eeprom,
.set_eeprom = smsc911x_ethtool_set_eeprom,
.get_ts_info = ethtool_op_get_ts_info,
+   .get_link_ksettings = phy_ethtool_get_link_ksettings,
+   .set_link_ksettings = phy_ethtool_set_link_ksettings,
 };
 
 static const struct net_device_ops smsc911x_netdev_ops = {
-- 
1.7.4.4



[PATCH 13/14] PCI: thunder-pem: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_HOST_THUNDER_PEM
drivers/pci/host/Kconfig:   bool "Cavium Thunder PCIe controller to 
off-chip devices"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: David Daney 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-thunder-pem.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/host/pci-thunder-pem.c 
b/drivers/pci/host/pci-thunder-pem.c
index 91f6fc68d374..6abaf80ffb39 100644
--- a/drivers/pci/host/pci-thunder-pem.c
+++ b/drivers/pci/host/pci-thunder-pem.c
@@ -15,7 +15,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -346,7 +346,6 @@ static const struct of_device_id thunder_pem_of_match[] = {
{ .compatible = "cavium,pci-host-thunder-pem" },
{ },
 };
-MODULE_DEVICE_TABLE(of, thunder_pem_of_match);
 
 static int thunder_pem_probe(struct platform_device *pdev)
 {
@@ -360,7 +359,4 @@ static struct platform_driver thunder_pem_driver = {
},
.probe = thunder_pem_probe,
 };
-module_platform_driver(thunder_pem_driver);
-
-MODULE_DESCRIPTION("Thunder PEM PCIe host driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(thunder_pem_driver);
-- 
2.8.4



[PATCH 2/2] net: ethernet: smsc: smsc911x: use phy_ethtool_{get|set}_link_ksettings

2016-07-02 Thread Philippe Reynes
There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/smsc/smsc911x.c |   18 ++
 1 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c 
b/drivers/net/ethernet/smsc/smsc911x.c
index 6fded67..ca31345 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1915,20 +1915,6 @@ static int smsc911x_do_ioctl(struct net_device *dev, 
struct ifreq *ifr, int cmd)
return phy_mii_ioctl(dev->phydev, ifr, cmd);
 }
 
-static int
-smsc911x_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-   cmd->maxtxpkt = 1;
-   cmd->maxrxpkt = 1;
-   return phy_ethtool_gset(dev->phydev, cmd);
-}
-
-static int
-smsc911x_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-   return phy_ethtool_sset(dev->phydev, cmd);
-}
-
 static void smsc911x_ethtool_getdrvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
 {
@@ -2112,8 +2098,6 @@ static int smsc911x_ethtool_set_eeprom(struct net_device 
*dev,
 }
 
 static const struct ethtool_ops smsc911x_ethtool_ops = {
-   .get_settings = smsc911x_ethtool_getsettings,
-   .set_settings = smsc911x_ethtool_setsettings,
.get_link = ethtool_op_get_link,
.get_drvinfo = smsc911x_ethtool_getdrvinfo,
.nway_reset = smsc911x_ethtool_nwayreset,
@@ -2125,6 +2109,8 @@ static const struct ethtool_ops smsc911x_ethtool_ops = {
.get_eeprom = smsc911x_ethtool_get_eeprom,
.set_eeprom = smsc911x_ethtool_set_eeprom,
.get_ts_info = ethtool_op_get_ts_info,
+   .get_link_ksettings = phy_ethtool_get_link_ksettings,
+   .set_link_ksettings = phy_ethtool_set_link_ksettings,
 };
 
 static const struct net_device_ops smsc911x_netdev_ops = {
-- 
1.7.4.4



[PATCH 13/14] PCI: thunder-pem: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_HOST_THUNDER_PEM
drivers/pci/host/Kconfig:   bool "Cavium Thunder PCIe controller to 
off-chip devices"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: David Daney 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-thunder-pem.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/host/pci-thunder-pem.c 
b/drivers/pci/host/pci-thunder-pem.c
index 91f6fc68d374..6abaf80ffb39 100644
--- a/drivers/pci/host/pci-thunder-pem.c
+++ b/drivers/pci/host/pci-thunder-pem.c
@@ -15,7 +15,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -346,7 +346,6 @@ static const struct of_device_id thunder_pem_of_match[] = {
{ .compatible = "cavium,pci-host-thunder-pem" },
{ },
 };
-MODULE_DEVICE_TABLE(of, thunder_pem_of_match);
 
 static int thunder_pem_probe(struct platform_device *pdev)
 {
@@ -360,7 +359,4 @@ static struct platform_driver thunder_pem_driver = {
},
.probe = thunder_pem_probe,
 };
-module_platform_driver(thunder_pem_driver);
-
-MODULE_DESCRIPTION("Thunder PEM PCIe host driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(thunder_pem_driver);
-- 
2.8.4



[PATCH 01/14] PCI: armada8k: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCIE_ARMADA_8K
drivers/pci/host/Kconfig:   bool "Marvell Armada-8K PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Bjorn Helgaas 
Cc: Thomas Petazzoni 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-armada8k.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host/pcie-armada8k.c b/drivers/pci/host/pcie-armada8k.c
index 55723567b5d4..0f4f570068e3 100644
--- a/drivers/pci/host/pcie-armada8k.c
+++ b/drivers/pci/host/pcie-armada8k.c
@@ -5,6 +5,9 @@
  *
  * Copyright (C) 2016 Marvell Technology Group Ltd.
  *
+ * Author: Yehuda Yitshak 
+ * Author: Shadi Ammouri 
+ *
  * This file is licensed under the terms of the GNU General Public
  * License version 2. This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
@@ -14,7 +17,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -244,7 +247,6 @@ static const struct of_device_id armada8k_pcie_of_match[] = 
{
{ .compatible = "marvell,armada8k-pcie", },
{},
 };
-MODULE_DEVICE_TABLE(of, armada8k_pcie_of_match);
 
 static struct platform_driver armada8k_pcie_driver = {
.probe  = armada8k_pcie_probe,
@@ -253,10 +255,4 @@ static struct platform_driver armada8k_pcie_driver = {
.of_match_table = of_match_ptr(armada8k_pcie_of_match),
},
 };
-
-module_platform_driver(armada8k_pcie_driver);
-
-MODULE_DESCRIPTION("Armada 8k PCIe host controller driver");
-MODULE_AUTHOR("Yehuda Yitshak ");
-MODULE_AUTHOR("Shadi Ammouri ");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(armada8k_pcie_driver);
-- 
2.8.4



[PATCH 03/14] PCI: designware-plat: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCIE_DW_PLAT
drivers/pci/host/Kconfig:   bool "Platform bus based DesignWare PCIe 
Controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Jingoo Han 
Cc: Pratyush Anand 
Cc: Joao Pinto 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-designware-plat.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pcie-designware-plat.c 
b/drivers/pci/host/pcie-designware-plat.c
index b3500994d08a..c8079dc81c10 100644
--- a/drivers/pci/host/pcie-designware-plat.c
+++ b/drivers/pci/host/pcie-designware-plat.c
@@ -14,7 +14,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -121,7 +121,6 @@ static const struct of_device_id dw_plat_pcie_of_match[] = {
{ .compatible = "snps,dw-pcie", },
{},
 };
-MODULE_DEVICE_TABLE(of, dw_plat_pcie_of_match);
 
 static struct platform_driver dw_plat_pcie_driver = {
.driver = {
@@ -130,9 +129,4 @@ static struct platform_driver dw_plat_pcie_driver = {
},
.probe = dw_plat_pcie_probe,
 };
-
-module_platform_driver(dw_plat_pcie_driver);
-
-MODULE_AUTHOR("Joao Pinto ");
-MODULE_DESCRIPTION("Synopsys PCIe host controller glue platform driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(dw_plat_pcie_driver);
-- 
2.8.4



[PATCH 01/14] PCI: armada8k: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCIE_ARMADA_8K
drivers/pci/host/Kconfig:   bool "Marvell Armada-8K PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Bjorn Helgaas 
Cc: Thomas Petazzoni 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-armada8k.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host/pcie-armada8k.c b/drivers/pci/host/pcie-armada8k.c
index 55723567b5d4..0f4f570068e3 100644
--- a/drivers/pci/host/pcie-armada8k.c
+++ b/drivers/pci/host/pcie-armada8k.c
@@ -5,6 +5,9 @@
  *
  * Copyright (C) 2016 Marvell Technology Group Ltd.
  *
+ * Author: Yehuda Yitshak 
+ * Author: Shadi Ammouri 
+ *
  * This file is licensed under the terms of the GNU General Public
  * License version 2. This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
@@ -14,7 +17,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -244,7 +247,6 @@ static const struct of_device_id armada8k_pcie_of_match[] = 
{
{ .compatible = "marvell,armada8k-pcie", },
{},
 };
-MODULE_DEVICE_TABLE(of, armada8k_pcie_of_match);
 
 static struct platform_driver armada8k_pcie_driver = {
.probe  = armada8k_pcie_probe,
@@ -253,10 +255,4 @@ static struct platform_driver armada8k_pcie_driver = {
.of_match_table = of_match_ptr(armada8k_pcie_of_match),
},
 };
-
-module_platform_driver(armada8k_pcie_driver);
-
-MODULE_DESCRIPTION("Armada 8k PCIe host controller driver");
-MODULE_AUTHOR("Yehuda Yitshak ");
-MODULE_AUTHOR("Shadi Ammouri ");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(armada8k_pcie_driver);
-- 
2.8.4



[PATCH 03/14] PCI: designware-plat: make it explicitly non-modular

2016-07-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCIE_DW_PLAT
drivers/pci/host/Kconfig:   bool "Platform bus based DesignWare PCIe 
Controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Jingoo Han 
Cc: Pratyush Anand 
Cc: Joao Pinto 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-designware-plat.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pcie-designware-plat.c 
b/drivers/pci/host/pcie-designware-plat.c
index b3500994d08a..c8079dc81c10 100644
--- a/drivers/pci/host/pcie-designware-plat.c
+++ b/drivers/pci/host/pcie-designware-plat.c
@@ -14,7 +14,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -121,7 +121,6 @@ static const struct of_device_id dw_plat_pcie_of_match[] = {
{ .compatible = "snps,dw-pcie", },
{},
 };
-MODULE_DEVICE_TABLE(of, dw_plat_pcie_of_match);
 
 static struct platform_driver dw_plat_pcie_driver = {
.driver = {
@@ -130,9 +129,4 @@ static struct platform_driver dw_plat_pcie_driver = {
},
.probe = dw_plat_pcie_probe,
 };
-
-module_platform_driver(dw_plat_pcie_driver);
-
-MODULE_AUTHOR("Joao Pinto ");
-MODULE_DESCRIPTION("Synopsys PCIe host controller glue platform driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(dw_plat_pcie_driver);
-- 
2.8.4



Re: [PATCH 2/2] input: add ADC resistor ladder driver

2016-07-02 Thread Matt Ranostay
On Fri, Jul 1, 2016 at 2:30 PM, Alexandre Belloni
 wrote:
> A common way of multiplexing buttons on a single input in cheap devices is
> to use a resistor ladder on an ADC. This driver supports that configuration
> by polling an ADC channel provided by IIO.
>
> Signed-off-by: Alexandre Belloni 
> ---
>  drivers/input/keyboard/Kconfig|  15 +++
>  drivers/input/keyboard/Makefile   |   1 +
>  drivers/input/keyboard/adc-keys.c | 209 
> ++
>  3 files changed, 225 insertions(+)
>  create mode 100644 drivers/input/keyboard/adc-keys.c
>
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index 509608c95994..ba20808f31e0 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -12,6 +12,21 @@ menuconfig INPUT_KEYBOARD
>
>  if INPUT_KEYBOARD
>
> +config KEYBOARD_ADC
> +   tristate "ADC ladder Buttons"
> +   depends on IIO || COMPILE_TEST

Why is this IIO or COMPILE_TEST? shouldn't it depend on both?

> +   select INPUT_POLLDEV
> +   help
> + This driver implements support for buttons connected
> + to an ADC using a resistor ladder.
> +
> + Say Y here if your device has such buttons connected to an ADC.  
> Your
> + board-specific setup logic must also provide a configuration data
> + saying mapping voltages to buttons.
> +
> + To compile this driver as a module, choose M here: the
> + module will be called adc_keys.
> +
>  config KEYBOARD_ADP5520
> tristate "Keypad Support for ADP5520 PMIC"
> depends on PMIC_ADP5520
> diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
> index 1d416ddf84e4..d9f4cfcf3410 100644
> --- a/drivers/input/keyboard/Makefile
> +++ b/drivers/input/keyboard/Makefile
> @@ -4,6 +4,7 @@
>
>  # Each configuration option enables a list of files.
>
> +obj-$(CONFIG_KEYBOARD_ADC) += adc-keys.o
>  obj-$(CONFIG_KEYBOARD_ADP5520) += adp5520-keys.o
>  obj-$(CONFIG_KEYBOARD_ADP5588) += adp5588-keys.o
>  obj-$(CONFIG_KEYBOARD_ADP5589) += adp5589-keys.o
> diff --git a/drivers/input/keyboard/adc-keys.c 
> b/drivers/input/keyboard/adc-keys.c
> new file mode 100644
> index ..ba6ee91272b2
> --- /dev/null
> +++ b/drivers/input/keyboard/adc-keys.c
> @@ -0,0 +1,209 @@
> +/* Input driver for resistor ladder connected on ADC
> + *
> + * Copyright (c) 2016 Alexandre Belloni
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published 
> by
> + * the Free Software Foundation.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct adc_keys_button {
> +   u32 voltage;
> +   u32 keycode;
> +};
> +
> +struct adc_keys_state {
> +   struct iio_channel *channel;
> +   u32 num_keys;
> +   u32 last_key;
> +   u32 keyup_voltage;
> +   struct adc_keys_button *map;
> +};
> +
> +static void adc_keys_poll(struct input_polled_dev *dev)
> +{
> +   struct adc_keys_state *st = dev->private;
> +   int i, value, ret;
> +   u32 diff, closest = 0x;
> +   int keycode = 0;
> +
> +   ret = iio_read_channel_processed(st->channel, );
> +   if (ret < 0) {
> +   if (st->last_key) {
> +   input_report_key(dev->input, st->last_key, 0);
> +   input_sync(dev->input);
> +   st->last_key = 0;
> +   }
> +   return;
> +   }
> +
> +   for (i = 0; i < st->num_keys; i++) {
> +   diff = abs(st->map[i].voltage - value);
> +   if (diff < closest) {
> +   closest = diff;
> +   keycode = st->map[i].keycode;
> +   }
> +   }
> +
> +   if (abs(st->keyup_voltage - value) < closest) {
> +   input_report_key(dev->input, st->last_key, 0);
> +   st->last_key = 0;
> +   } else {
> +   if (st->last_key && st->last_key != keycode)
> +   input_report_key(dev->input, st->last_key, 0);
> +   input_report_key(dev->input, keycode, 1);
> +   st->last_key = keycode;
> +   }
> +
> +   input_sync(dev->input);
> +}
> +
> +static int adc_keys_load_dt_keymap(struct device *dev,
> +  struct adc_keys_state *st)
> +{
> +   struct device_node *pp, *np = dev->of_node;
> +   int i;
> +
> +   st->num_keys = of_get_child_count(np);
> +   if (st->num_keys == 0) {
> +   dev_err(dev, "keymap is missing\n");
> +   return -EINVAL;
> +   }
> +
> +   st->map = devm_kmalloc_array(dev, st->num_keys, sizeof(*st->map),
> +

Re: [PATCH 2/2] input: add ADC resistor ladder driver

2016-07-02 Thread Matt Ranostay
On Fri, Jul 1, 2016 at 2:30 PM, Alexandre Belloni
 wrote:
> A common way of multiplexing buttons on a single input in cheap devices is
> to use a resistor ladder on an ADC. This driver supports that configuration
> by polling an ADC channel provided by IIO.
>
> Signed-off-by: Alexandre Belloni 
> ---
>  drivers/input/keyboard/Kconfig|  15 +++
>  drivers/input/keyboard/Makefile   |   1 +
>  drivers/input/keyboard/adc-keys.c | 209 
> ++
>  3 files changed, 225 insertions(+)
>  create mode 100644 drivers/input/keyboard/adc-keys.c
>
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index 509608c95994..ba20808f31e0 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -12,6 +12,21 @@ menuconfig INPUT_KEYBOARD
>
>  if INPUT_KEYBOARD
>
> +config KEYBOARD_ADC
> +   tristate "ADC ladder Buttons"
> +   depends on IIO || COMPILE_TEST

Why is this IIO or COMPILE_TEST? shouldn't it depend on both?

> +   select INPUT_POLLDEV
> +   help
> + This driver implements support for buttons connected
> + to an ADC using a resistor ladder.
> +
> + Say Y here if your device has such buttons connected to an ADC.  
> Your
> + board-specific setup logic must also provide a configuration data
> + saying mapping voltages to buttons.
> +
> + To compile this driver as a module, choose M here: the
> + module will be called adc_keys.
> +
>  config KEYBOARD_ADP5520
> tristate "Keypad Support for ADP5520 PMIC"
> depends on PMIC_ADP5520
> diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
> index 1d416ddf84e4..d9f4cfcf3410 100644
> --- a/drivers/input/keyboard/Makefile
> +++ b/drivers/input/keyboard/Makefile
> @@ -4,6 +4,7 @@
>
>  # Each configuration option enables a list of files.
>
> +obj-$(CONFIG_KEYBOARD_ADC) += adc-keys.o
>  obj-$(CONFIG_KEYBOARD_ADP5520) += adp5520-keys.o
>  obj-$(CONFIG_KEYBOARD_ADP5588) += adp5588-keys.o
>  obj-$(CONFIG_KEYBOARD_ADP5589) += adp5589-keys.o
> diff --git a/drivers/input/keyboard/adc-keys.c 
> b/drivers/input/keyboard/adc-keys.c
> new file mode 100644
> index ..ba6ee91272b2
> --- /dev/null
> +++ b/drivers/input/keyboard/adc-keys.c
> @@ -0,0 +1,209 @@
> +/* Input driver for resistor ladder connected on ADC
> + *
> + * Copyright (c) 2016 Alexandre Belloni
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published 
> by
> + * the Free Software Foundation.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct adc_keys_button {
> +   u32 voltage;
> +   u32 keycode;
> +};
> +
> +struct adc_keys_state {
> +   struct iio_channel *channel;
> +   u32 num_keys;
> +   u32 last_key;
> +   u32 keyup_voltage;
> +   struct adc_keys_button *map;
> +};
> +
> +static void adc_keys_poll(struct input_polled_dev *dev)
> +{
> +   struct adc_keys_state *st = dev->private;
> +   int i, value, ret;
> +   u32 diff, closest = 0x;
> +   int keycode = 0;
> +
> +   ret = iio_read_channel_processed(st->channel, );
> +   if (ret < 0) {
> +   if (st->last_key) {
> +   input_report_key(dev->input, st->last_key, 0);
> +   input_sync(dev->input);
> +   st->last_key = 0;
> +   }
> +   return;
> +   }
> +
> +   for (i = 0; i < st->num_keys; i++) {
> +   diff = abs(st->map[i].voltage - value);
> +   if (diff < closest) {
> +   closest = diff;
> +   keycode = st->map[i].keycode;
> +   }
> +   }
> +
> +   if (abs(st->keyup_voltage - value) < closest) {
> +   input_report_key(dev->input, st->last_key, 0);
> +   st->last_key = 0;
> +   } else {
> +   if (st->last_key && st->last_key != keycode)
> +   input_report_key(dev->input, st->last_key, 0);
> +   input_report_key(dev->input, keycode, 1);
> +   st->last_key = keycode;
> +   }
> +
> +   input_sync(dev->input);
> +}
> +
> +static int adc_keys_load_dt_keymap(struct device *dev,
> +  struct adc_keys_state *st)
> +{
> +   struct device_node *pp, *np = dev->of_node;
> +   int i;
> +
> +   st->num_keys = of_get_child_count(np);
> +   if (st->num_keys == 0) {
> +   dev_err(dev, "keymap is missing\n");
> +   return -EINVAL;
> +   }
> +
> +   st->map = devm_kmalloc_array(dev, st->num_keys, sizeof(*st->map),
> +GFP_KERNEL);
> +   if (!st->map)
> +   return -ENOMEM;
> +
> 

[PATCH 2/2] net: ethernet: lantiq_etop: use phy_ethtool_{get|set}_link_ksettings

2016-07-02 Thread Philippe Reynes
There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/lantiq_etop.c |   16 ++--
 1 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c 
b/drivers/net/ethernet/lantiq_etop.c
index ad715a4..91e09d6 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -304,18 +304,6 @@ ltq_etop_get_drvinfo(struct net_device *dev, struct 
ethtool_drvinfo *info)
 }
 
 static int
-ltq_etop_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-   return phy_ethtool_gset(dev->phydev, cmd);
-}
-
-static int
-ltq_etop_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-   return phy_ethtool_sset(dev->phydev, cmd);
-}
-
-static int
 ltq_etop_nway_reset(struct net_device *dev)
 {
return phy_start_aneg(dev->phydev);
@@ -323,9 +311,9 @@ ltq_etop_nway_reset(struct net_device *dev)
 
 static const struct ethtool_ops ltq_etop_ethtool_ops = {
.get_drvinfo = ltq_etop_get_drvinfo,
-   .get_settings = ltq_etop_get_settings,
-   .set_settings = ltq_etop_set_settings,
.nway_reset = ltq_etop_nway_reset,
+   .get_link_ksettings = phy_ethtool_get_link_ksettings,
+   .set_link_ksettings = phy_ethtool_set_link_ksettings,
 };
 
 static int
-- 
1.7.4.4



[PATCH 2/2] net: ethernet: lantiq_etop: use phy_ethtool_{get|set}_link_ksettings

2016-07-02 Thread Philippe Reynes
There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/lantiq_etop.c |   16 ++--
 1 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c 
b/drivers/net/ethernet/lantiq_etop.c
index ad715a4..91e09d6 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -304,18 +304,6 @@ ltq_etop_get_drvinfo(struct net_device *dev, struct 
ethtool_drvinfo *info)
 }
 
 static int
-ltq_etop_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-   return phy_ethtool_gset(dev->phydev, cmd);
-}
-
-static int
-ltq_etop_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-   return phy_ethtool_sset(dev->phydev, cmd);
-}
-
-static int
 ltq_etop_nway_reset(struct net_device *dev)
 {
return phy_start_aneg(dev->phydev);
@@ -323,9 +311,9 @@ ltq_etop_nway_reset(struct net_device *dev)
 
 static const struct ethtool_ops ltq_etop_ethtool_ops = {
.get_drvinfo = ltq_etop_get_drvinfo,
-   .get_settings = ltq_etop_get_settings,
-   .set_settings = ltq_etop_set_settings,
.nway_reset = ltq_etop_nway_reset,
+   .get_link_ksettings = phy_ethtool_get_link_ksettings,
+   .set_link_ksettings = phy_ethtool_set_link_ksettings,
 };
 
 static int
-- 
1.7.4.4



[PATCH 1/2] net: ethernet: lantiq_etop: use phydev from struct net_device

2016-07-02 Thread Philippe Reynes
The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/lantiq_etop.c |   24 +++-
 1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c 
b/drivers/net/ethernet/lantiq_etop.c
index 0d2f8e9..ad715a4 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -102,7 +102,6 @@ struct ltq_etop_priv {
struct resource *res;
 
struct mii_bus *mii_bus;
-   struct phy_device *phydev;
 
struct ltq_etop_chan ch[MAX_DMA_CHAN];
int tx_free[MAX_DMA_CHAN >> 1];
@@ -307,25 +306,19 @@ ltq_etop_get_drvinfo(struct net_device *dev, struct 
ethtool_drvinfo *info)
 static int
 ltq_etop_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
-   struct ltq_etop_priv *priv = netdev_priv(dev);
-
-   return phy_ethtool_gset(priv->phydev, cmd);
+   return phy_ethtool_gset(dev->phydev, cmd);
 }
 
 static int
 ltq_etop_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
-   struct ltq_etop_priv *priv = netdev_priv(dev);
-
-   return phy_ethtool_sset(priv->phydev, cmd);
+   return phy_ethtool_sset(dev->phydev, cmd);
 }
 
 static int
 ltq_etop_nway_reset(struct net_device *dev)
 {
-   struct ltq_etop_priv *priv = netdev_priv(dev);
-
-   return phy_start_aneg(priv->phydev);
+   return phy_start_aneg(dev->phydev);
 }
 
 static const struct ethtool_ops ltq_etop_ethtool_ops = {
@@ -401,7 +394,6 @@ ltq_etop_mdio_probe(struct net_device *dev)
  | SUPPORTED_TP);
 
phydev->advertising = phydev->supported;
-   priv->phydev = phydev;
phy_attached_info(phydev);
 
return 0;
@@ -450,7 +442,7 @@ ltq_etop_mdio_cleanup(struct net_device *dev)
 {
struct ltq_etop_priv *priv = netdev_priv(dev);
 
-   phy_disconnect(priv->phydev);
+   phy_disconnect(dev->phydev);
mdiobus_unregister(priv->mii_bus);
mdiobus_free(priv->mii_bus);
 }
@@ -469,7 +461,7 @@ ltq_etop_open(struct net_device *dev)
ltq_dma_open(>dma);
napi_enable(>napi);
}
-   phy_start(priv->phydev);
+   phy_start(dev->phydev);
netif_tx_start_all_queues(dev);
return 0;
 }
@@ -481,7 +473,7 @@ ltq_etop_stop(struct net_device *dev)
int i;
 
netif_tx_stop_all_queues(dev);
-   phy_stop(priv->phydev);
+   phy_stop(dev->phydev);
for (i = 0; i < MAX_DMA_CHAN; i++) {
struct ltq_etop_chan *ch = >ch[i];
 
@@ -556,10 +548,8 @@ ltq_etop_change_mtu(struct net_device *dev, int new_mtu)
 static int
 ltq_etop_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
-   struct ltq_etop_priv *priv = netdev_priv(dev);
-
/* TODO: mii-toll reports "No MII transceiver present!." ?!*/
-   return phy_mii_ioctl(priv->phydev, rq, cmd);
+   return phy_mii_ioctl(dev->phydev, rq, cmd);
 }
 
 static int
-- 
1.7.4.4



[PATCH 1/2] net: ethernet: lantiq_etop: use phydev from struct net_device

2016-07-02 Thread Philippe Reynes
The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/lantiq_etop.c |   24 +++-
 1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c 
b/drivers/net/ethernet/lantiq_etop.c
index 0d2f8e9..ad715a4 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -102,7 +102,6 @@ struct ltq_etop_priv {
struct resource *res;
 
struct mii_bus *mii_bus;
-   struct phy_device *phydev;
 
struct ltq_etop_chan ch[MAX_DMA_CHAN];
int tx_free[MAX_DMA_CHAN >> 1];
@@ -307,25 +306,19 @@ ltq_etop_get_drvinfo(struct net_device *dev, struct 
ethtool_drvinfo *info)
 static int
 ltq_etop_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
-   struct ltq_etop_priv *priv = netdev_priv(dev);
-
-   return phy_ethtool_gset(priv->phydev, cmd);
+   return phy_ethtool_gset(dev->phydev, cmd);
 }
 
 static int
 ltq_etop_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
-   struct ltq_etop_priv *priv = netdev_priv(dev);
-
-   return phy_ethtool_sset(priv->phydev, cmd);
+   return phy_ethtool_sset(dev->phydev, cmd);
 }
 
 static int
 ltq_etop_nway_reset(struct net_device *dev)
 {
-   struct ltq_etop_priv *priv = netdev_priv(dev);
-
-   return phy_start_aneg(priv->phydev);
+   return phy_start_aneg(dev->phydev);
 }
 
 static const struct ethtool_ops ltq_etop_ethtool_ops = {
@@ -401,7 +394,6 @@ ltq_etop_mdio_probe(struct net_device *dev)
  | SUPPORTED_TP);
 
phydev->advertising = phydev->supported;
-   priv->phydev = phydev;
phy_attached_info(phydev);
 
return 0;
@@ -450,7 +442,7 @@ ltq_etop_mdio_cleanup(struct net_device *dev)
 {
struct ltq_etop_priv *priv = netdev_priv(dev);
 
-   phy_disconnect(priv->phydev);
+   phy_disconnect(dev->phydev);
mdiobus_unregister(priv->mii_bus);
mdiobus_free(priv->mii_bus);
 }
@@ -469,7 +461,7 @@ ltq_etop_open(struct net_device *dev)
ltq_dma_open(>dma);
napi_enable(>napi);
}
-   phy_start(priv->phydev);
+   phy_start(dev->phydev);
netif_tx_start_all_queues(dev);
return 0;
 }
@@ -481,7 +473,7 @@ ltq_etop_stop(struct net_device *dev)
int i;
 
netif_tx_stop_all_queues(dev);
-   phy_stop(priv->phydev);
+   phy_stop(dev->phydev);
for (i = 0; i < MAX_DMA_CHAN; i++) {
struct ltq_etop_chan *ch = >ch[i];
 
@@ -556,10 +548,8 @@ ltq_etop_change_mtu(struct net_device *dev, int new_mtu)
 static int
 ltq_etop_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
-   struct ltq_etop_priv *priv = netdev_priv(dev);
-
/* TODO: mii-toll reports "No MII transceiver present!." ?!*/
-   return phy_mii_ioctl(priv->phydev, rq, cmd);
+   return phy_mii_ioctl(dev->phydev, rq, cmd);
 }
 
 static int
-- 
1.7.4.4



[PATCH 2/2] net: ethernet: cavium: octeon: use phy_ethtool_{get|set}_link_ksettings

2016-07-02 Thread Philippe Reynes
There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |   25 +
 1 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c 
b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
index de678e6..e8bc15b 100644
--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
@@ -1346,27 +1346,6 @@ static void octeon_mgmt_get_drvinfo(struct net_device 
*netdev,
strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
 }
 
-static int octeon_mgmt_get_settings(struct net_device *netdev,
-   struct ethtool_cmd *cmd)
-{
-   if (netdev->phydev)
-   return phy_ethtool_gset(netdev->phydev, cmd);
-
-   return -EOPNOTSUPP;
-}
-
-static int octeon_mgmt_set_settings(struct net_device *netdev,
-   struct ethtool_cmd *cmd)
-{
-   if (!capable(CAP_NET_ADMIN))
-   return -EPERM;
-
-   if (netdev->phydev)
-   return phy_ethtool_sset(netdev->phydev, cmd);
-
-   return -EOPNOTSUPP;
-}
-
 static int octeon_mgmt_nway_reset(struct net_device *dev)
 {
if (!capable(CAP_NET_ADMIN))
@@ -1380,10 +1359,10 @@ static int octeon_mgmt_nway_reset(struct net_device 
*dev)
 
 static const struct ethtool_ops octeon_mgmt_ethtool_ops = {
.get_drvinfo = octeon_mgmt_get_drvinfo,
-   .get_settings = octeon_mgmt_get_settings,
-   .set_settings = octeon_mgmt_set_settings,
.nway_reset = octeon_mgmt_nway_reset,
.get_link = ethtool_op_get_link,
+   .get_link_ksettings = phy_ethtool_get_link_ksettings,
+   .set_link_ksettings = phy_ethtool_set_link_ksettings,
 };
 
 static const struct net_device_ops octeon_mgmt_ops = {
-- 
1.7.4.4



[PATCH 2/2] net: ethernet: cavium: octeon: use phy_ethtool_{get|set}_link_ksettings

2016-07-02 Thread Philippe Reynes
There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |   25 +
 1 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c 
b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
index de678e6..e8bc15b 100644
--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
@@ -1346,27 +1346,6 @@ static void octeon_mgmt_get_drvinfo(struct net_device 
*netdev,
strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
 }
 
-static int octeon_mgmt_get_settings(struct net_device *netdev,
-   struct ethtool_cmd *cmd)
-{
-   if (netdev->phydev)
-   return phy_ethtool_gset(netdev->phydev, cmd);
-
-   return -EOPNOTSUPP;
-}
-
-static int octeon_mgmt_set_settings(struct net_device *netdev,
-   struct ethtool_cmd *cmd)
-{
-   if (!capable(CAP_NET_ADMIN))
-   return -EPERM;
-
-   if (netdev->phydev)
-   return phy_ethtool_sset(netdev->phydev, cmd);
-
-   return -EOPNOTSUPP;
-}
-
 static int octeon_mgmt_nway_reset(struct net_device *dev)
 {
if (!capable(CAP_NET_ADMIN))
@@ -1380,10 +1359,10 @@ static int octeon_mgmt_nway_reset(struct net_device 
*dev)
 
 static const struct ethtool_ops octeon_mgmt_ethtool_ops = {
.get_drvinfo = octeon_mgmt_get_drvinfo,
-   .get_settings = octeon_mgmt_get_settings,
-   .set_settings = octeon_mgmt_set_settings,
.nway_reset = octeon_mgmt_nway_reset,
.get_link = ethtool_op_get_link,
+   .get_link_ksettings = phy_ethtool_get_link_ksettings,
+   .set_link_ksettings = phy_ethtool_set_link_ksettings,
 };
 
 static const struct net_device_ops octeon_mgmt_ops = {
-- 
1.7.4.4



[PATCH 1/2] net: ethernet: cavium: octeon: use phydev from struct net_device

2016-07-02 Thread Philippe Reynes
The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |   86 ++
 1 files changed, 40 insertions(+), 46 deletions(-)

diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c 
b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
index 388cd79..de678e6 100644
--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
@@ -146,7 +146,6 @@ struct octeon_mgmt {
struct device *dev;
struct napi_struct napi;
struct tasklet_struct tx_clean_tasklet;
-   struct phy_device *phydev;
struct device_node *phy_np;
resource_size_t mix_phys;
resource_size_t mix_size;
@@ -787,14 +786,12 @@ static int octeon_mgmt_ioctl_hwtstamp(struct net_device 
*netdev,
 static int octeon_mgmt_ioctl(struct net_device *netdev,
 struct ifreq *rq, int cmd)
 {
-   struct octeon_mgmt *p = netdev_priv(netdev);
-
switch (cmd) {
case SIOCSHWTSTAMP:
return octeon_mgmt_ioctl_hwtstamp(netdev, rq, cmd);
default:
-   if (p->phydev)
-   return phy_mii_ioctl(p->phydev, rq, cmd);
+   if (netdev->phydev)
+   return phy_mii_ioctl(netdev->phydev, rq, cmd);
return -EINVAL;
}
 }
@@ -836,16 +833,18 @@ static void octeon_mgmt_enable_link(struct octeon_mgmt *p)
 
 static void octeon_mgmt_update_link(struct octeon_mgmt *p)
 {
+   struct net_device *ndev = p->netdev;
+   struct phy_device *phydev = ndev->phydev;
union cvmx_agl_gmx_prtx_cfg prtx_cfg;
 
prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG);
 
-   if (!p->phydev->link)
+   if (!phydev->link)
prtx_cfg.s.duplex = 1;
else
-   prtx_cfg.s.duplex = p->phydev->duplex;
+   prtx_cfg.s.duplex = phydev->duplex;
 
-   switch (p->phydev->speed) {
+   switch (phydev->speed) {
case 10:
prtx_cfg.s.speed = 0;
prtx_cfg.s.slottime = 0;
@@ -871,7 +870,7 @@ static void octeon_mgmt_update_link(struct octeon_mgmt *p)
prtx_cfg.s.speed_msb = 0;
/* Only matters for half-duplex */
prtx_cfg.s.slottime = 1;
-   prtx_cfg.s.burst = p->phydev->duplex;
+   prtx_cfg.s.burst = phydev->duplex;
}
break;
case 0:  /* No link */
@@ -894,9 +893,9 @@ static void octeon_mgmt_update_link(struct octeon_mgmt *p)
/* MII (both speeds) and RGMII 1000 speed. */
agl_clk.s.clk_cnt = 1;
if (prtx_ctl.s.mode == 0) { /* RGMII mode */
-   if (p->phydev->speed == 10)
+   if (phydev->speed == 10)
agl_clk.s.clk_cnt = 50;
-   else if (p->phydev->speed == 100)
+   else if (phydev->speed == 100)
agl_clk.s.clk_cnt = 5;
}
cvmx_write_csr(p->agl + AGL_GMX_TX_CLK, agl_clk.u64);
@@ -906,39 +905,40 @@ static void octeon_mgmt_update_link(struct octeon_mgmt *p)
 static void octeon_mgmt_adjust_link(struct net_device *netdev)
 {
struct octeon_mgmt *p = netdev_priv(netdev);
+   struct phy_device *phydev = netdev->phydev;
unsigned long flags;
int link_changed = 0;
 
-   if (!p->phydev)
+   if (!phydev)
return;
 
spin_lock_irqsave(>lock, flags);
 
 
-   if (!p->phydev->link && p->last_link)
+   if (!phydev->link && p->last_link)
link_changed = -1;
 
-   if (p->phydev->link
-   && (p->last_duplex != p->phydev->duplex
-   || p->last_link != p->phydev->link
-   || p->last_speed != p->phydev->speed)) {
+   if (phydev->link &&
+   (p->last_duplex != phydev->duplex ||
+p->last_link != phydev->link ||
+p->last_speed != phydev->speed)) {
octeon_mgmt_disable_link(p);
link_changed = 1;
octeon_mgmt_update_link(p);
octeon_mgmt_enable_link(p);
}
 
-   p->last_link = p->phydev->link;
-   p->last_speed = p->phydev->speed;
-   p->last_duplex = p->phydev->duplex;
+   p->last_link = phydev->link;
+   p->last_speed = phydev->speed;
+   p->last_duplex = phydev->duplex;
 
spin_unlock_irqrestore(>lock, flags);
 
if (link_changed != 0) {
if (link_changed > 0) {
pr_info("%s: Link is up - %d/%s\n", netdev->name,
- 

[PATCH 1/2] net: ethernet: cavium: octeon: use phydev from struct net_device

2016-07-02 Thread Philippe Reynes
The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phy in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |   86 ++
 1 files changed, 40 insertions(+), 46 deletions(-)

diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c 
b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
index 388cd79..de678e6 100644
--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
@@ -146,7 +146,6 @@ struct octeon_mgmt {
struct device *dev;
struct napi_struct napi;
struct tasklet_struct tx_clean_tasklet;
-   struct phy_device *phydev;
struct device_node *phy_np;
resource_size_t mix_phys;
resource_size_t mix_size;
@@ -787,14 +786,12 @@ static int octeon_mgmt_ioctl_hwtstamp(struct net_device 
*netdev,
 static int octeon_mgmt_ioctl(struct net_device *netdev,
 struct ifreq *rq, int cmd)
 {
-   struct octeon_mgmt *p = netdev_priv(netdev);
-
switch (cmd) {
case SIOCSHWTSTAMP:
return octeon_mgmt_ioctl_hwtstamp(netdev, rq, cmd);
default:
-   if (p->phydev)
-   return phy_mii_ioctl(p->phydev, rq, cmd);
+   if (netdev->phydev)
+   return phy_mii_ioctl(netdev->phydev, rq, cmd);
return -EINVAL;
}
 }
@@ -836,16 +833,18 @@ static void octeon_mgmt_enable_link(struct octeon_mgmt *p)
 
 static void octeon_mgmt_update_link(struct octeon_mgmt *p)
 {
+   struct net_device *ndev = p->netdev;
+   struct phy_device *phydev = ndev->phydev;
union cvmx_agl_gmx_prtx_cfg prtx_cfg;
 
prtx_cfg.u64 = cvmx_read_csr(p->agl + AGL_GMX_PRT_CFG);
 
-   if (!p->phydev->link)
+   if (!phydev->link)
prtx_cfg.s.duplex = 1;
else
-   prtx_cfg.s.duplex = p->phydev->duplex;
+   prtx_cfg.s.duplex = phydev->duplex;
 
-   switch (p->phydev->speed) {
+   switch (phydev->speed) {
case 10:
prtx_cfg.s.speed = 0;
prtx_cfg.s.slottime = 0;
@@ -871,7 +870,7 @@ static void octeon_mgmt_update_link(struct octeon_mgmt *p)
prtx_cfg.s.speed_msb = 0;
/* Only matters for half-duplex */
prtx_cfg.s.slottime = 1;
-   prtx_cfg.s.burst = p->phydev->duplex;
+   prtx_cfg.s.burst = phydev->duplex;
}
break;
case 0:  /* No link */
@@ -894,9 +893,9 @@ static void octeon_mgmt_update_link(struct octeon_mgmt *p)
/* MII (both speeds) and RGMII 1000 speed. */
agl_clk.s.clk_cnt = 1;
if (prtx_ctl.s.mode == 0) { /* RGMII mode */
-   if (p->phydev->speed == 10)
+   if (phydev->speed == 10)
agl_clk.s.clk_cnt = 50;
-   else if (p->phydev->speed == 100)
+   else if (phydev->speed == 100)
agl_clk.s.clk_cnt = 5;
}
cvmx_write_csr(p->agl + AGL_GMX_TX_CLK, agl_clk.u64);
@@ -906,39 +905,40 @@ static void octeon_mgmt_update_link(struct octeon_mgmt *p)
 static void octeon_mgmt_adjust_link(struct net_device *netdev)
 {
struct octeon_mgmt *p = netdev_priv(netdev);
+   struct phy_device *phydev = netdev->phydev;
unsigned long flags;
int link_changed = 0;
 
-   if (!p->phydev)
+   if (!phydev)
return;
 
spin_lock_irqsave(>lock, flags);
 
 
-   if (!p->phydev->link && p->last_link)
+   if (!phydev->link && p->last_link)
link_changed = -1;
 
-   if (p->phydev->link
-   && (p->last_duplex != p->phydev->duplex
-   || p->last_link != p->phydev->link
-   || p->last_speed != p->phydev->speed)) {
+   if (phydev->link &&
+   (p->last_duplex != phydev->duplex ||
+p->last_link != phydev->link ||
+p->last_speed != phydev->speed)) {
octeon_mgmt_disable_link(p);
link_changed = 1;
octeon_mgmt_update_link(p);
octeon_mgmt_enable_link(p);
}
 
-   p->last_link = p->phydev->link;
-   p->last_speed = p->phydev->speed;
-   p->last_duplex = p->phydev->duplex;
+   p->last_link = phydev->link;
+   p->last_speed = phydev->speed;
+   p->last_duplex = phydev->duplex;
 
spin_unlock_irqrestore(>lock, flags);
 
if (link_changed != 0) {
if (link_changed > 0) {
pr_info("%s: Link is up - %d/%s\n", netdev->name,
-   

Re: master build: 0 failures 4 warnings (v4.7-rc5-347-g99b0f54)

2016-07-02 Thread Arnd Bergmann
On Saturday, July 2, 2016 8:39:38 PM CEST Build bot for Mark Brown wrote:
> Warnings:
> 
> ../drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/polaris10_hwmgr.c:1817:4: 
> warning: this decimal constant is unsigned only in ISO C90
> 
> ../drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/polaris10_hwmgr.c:1822:4: 
> warning: this decimal constant is unsigned only in ISO C90
> 
> ../drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/polaris10_hwmgr.c:1824:4: 
> warning: this decimal constant is unsigned only in ISO C90

It seems this was introduced today from 0812a945fbb8 ("drm/amd/powerplay:
Update CKS on/ CKS off voltage offset calculation").

Arnd


Re: master build: 0 failures 4 warnings (v4.7-rc5-347-g99b0f54)

2016-07-02 Thread Arnd Bergmann
On Saturday, July 2, 2016 8:39:38 PM CEST Build bot for Mark Brown wrote:
> Warnings:
> 
> ../drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/polaris10_hwmgr.c:1817:4: 
> warning: this decimal constant is unsigned only in ISO C90
> 
> ../drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/polaris10_hwmgr.c:1822:4: 
> warning: this decimal constant is unsigned only in ISO C90
> 
> ../drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/polaris10_hwmgr.c:1824:4: 
> warning: this decimal constant is unsigned only in ISO C90

It seems this was introduced today from 0812a945fbb8 ("drm/amd/powerplay:
Update CKS on/ CKS off voltage offset calculation").

Arnd


[PATCH][RESEND] pps: kc: fix non-tickless system config dependency

2016-07-02 Thread Maciej S. Szmigiero
CONFIG_NO_HZ currently only sets the default value
of dynticks config so if PPS kernel consumer needs
periodic timer ticks it should depend on
!CONFIG_NO_HZ_COMMON instead of !CONFIG_NO_HZ.

Otherwise it is possible to enable it even on
tickless system which has CONFIG_NO_HZ not set and
CONFIG_NO_HZ_IDLE (or CONFIG_NO_HZ_FULL) set.

Signed-off-by: Maciej S. Szmigiero 
---
This is a resend without functional changes since previous
submission wasn't picked up.

 drivers/pps/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pps/Kconfig b/drivers/pps/Kconfig
index 7512e98e9311..564a51abeece 100644
--- a/drivers/pps/Kconfig
+++ b/drivers/pps/Kconfig
@@ -31,7 +31,7 @@ config PPS_DEBUG
 
 config NTP_PPS
bool "PPS kernel consumer support"
-   depends on !NO_HZ
+   depends on !NO_HZ_COMMON
help
  This option adds support for direct in-kernel time
  synchronization using an external PPS signal.


[PATCH][RESEND] pps: kc: fix non-tickless system config dependency

2016-07-02 Thread Maciej S. Szmigiero
CONFIG_NO_HZ currently only sets the default value
of dynticks config so if PPS kernel consumer needs
periodic timer ticks it should depend on
!CONFIG_NO_HZ_COMMON instead of !CONFIG_NO_HZ.

Otherwise it is possible to enable it even on
tickless system which has CONFIG_NO_HZ not set and
CONFIG_NO_HZ_IDLE (or CONFIG_NO_HZ_FULL) set.

Signed-off-by: Maciej S. Szmigiero 
---
This is a resend without functional changes since previous
submission wasn't picked up.

 drivers/pps/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pps/Kconfig b/drivers/pps/Kconfig
index 7512e98e9311..564a51abeece 100644
--- a/drivers/pps/Kconfig
+++ b/drivers/pps/Kconfig
@@ -31,7 +31,7 @@ config PPS_DEBUG
 
 config NTP_PPS
bool "PPS kernel consumer support"
-   depends on !NO_HZ
+   depends on !NO_HZ_COMMON
help
  This option adds support for direct in-kernel time
  synchronization using an external PPS signal.


  1   2   3   4   >