linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] soc: mediatek: SCPSYS: use module_platform_driver
@ 2015-12-16 11:00 Sascha Hauer
  2015-12-16 11:22 ` Arnd Bergmann
  0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2015-12-16 11:00 UTC (permalink / raw)
  To: linux-arm-kernel

With regulator support to the scpsys driver needs to be able to defer
probe. Probe deferral is incompatible with module_platform_driver_probe,
so use module_platform_driver. module_platform_driver_probe sets the
suppress_bind_attrs. To prevent unbinding the device with
module_platform_driver we have to set the flag explicitly in the driver
now.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---

Changes since v1:
- Add suppress_bind_attrs attribute

 drivers/soc/mediatek/mtk-scpsys.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
index e425619..ae2d177 100644
--- a/drivers/soc/mediatek/mtk-scpsys.c
+++ b/drivers/soc/mediatek/mtk-scpsys.c
@@ -542,11 +542,13 @@ static const struct of_device_id of_scpsys_match_tbl[] = {
 };
 
 static struct platform_driver scpsys_drv = {
+	.probe = scpsys_probe,
 	.driver = {
 		.name = "mtk-scpsys",
+		.suppress_bind_attrs = true,
 		.owner = THIS_MODULE,
 		.of_match_table = of_match_ptr(of_scpsys_match_tbl),
 	},
 };
 
-module_platform_driver_probe(scpsys_drv, scpsys_probe);
+module_platform_driver(scpsys_drv);
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2] soc: mediatek: SCPSYS: use module_platform_driver
  2015-12-16 11:00 [PATCH v2] soc: mediatek: SCPSYS: use module_platform_driver Sascha Hauer
@ 2015-12-16 11:22 ` Arnd Bergmann
  2015-12-16 11:55   ` Matthias Brugger
  0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2015-12-16 11:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 16 December 2015 12:00:56 Sascha Hauer wrote:
> With regulator support to the scpsys driver needs to be able to defer
> probe. Probe deferral is incompatible with module_platform_driver_probe,
> so use module_platform_driver. module_platform_driver_probe sets the
> suppress_bind_attrs. To prevent unbinding the device with
> module_platform_driver we have to set the flag explicitly in the driver
> now.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> 

Looks good now,

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] soc: mediatek: SCPSYS: use module_platform_driver
  2015-12-16 11:22 ` Arnd Bergmann
@ 2015-12-16 11:55   ` Matthias Brugger
  2015-12-17  2:52     ` Daniel Kurtz
  0 siblings, 1 reply; 6+ messages in thread
From: Matthias Brugger @ 2015-12-16 11:55 UTC (permalink / raw)
  To: linux-arm-kernel



On 16/12/15 12:22, Arnd Bergmann wrote:
> On Wednesday 16 December 2015 12:00:56 Sascha Hauer wrote:
>> With regulator support to the scpsys driver needs to be able to defer
>> probe. Probe deferral is incompatible with module_platform_driver_probe,
>> so use module_platform_driver. module_platform_driver_probe sets the
>> suppress_bind_attrs. To prevent unbinding the device with
>> module_platform_driver we have to set the flag explicitly in the driver
>> now.
>>
>> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>> ---
>>
>
> Looks good now,
>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
>

Applied to v4.4-next/soc

Sascha next time please don't forget to send Mediatek related patches to 
the corresponding mailinglist as well.

Thanks,
Matthias

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] soc: mediatek: SCPSYS: use module_platform_driver
  2015-12-16 11:55   ` Matthias Brugger
@ 2015-12-17  2:52     ` Daniel Kurtz
  2015-12-17 15:16       ` Paul Gortmaker
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Kurtz @ 2015-12-17  2:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sasha, Matthias,

On Wed, Dec 16, 2015 at 7:55 PM, Matthias Brugger
<matthias.bgg@gmail.com> wrote:
>
>
> On 16/12/15 12:22, Arnd Bergmann wrote:
>>
>> On Wednesday 16 December 2015 12:00:56 Sascha Hauer wrote:
>>>
>>> With regulator support to the scpsys driver needs to be able to defer
>>> probe. Probe deferral is incompatible with module_platform_driver_probe,
>>> so use module_platform_driver. module_platform_driver_probe sets the
>>> suppress_bind_attrs. To prevent unbinding the device with
>>> module_platform_driver we have to set the flag explicitly in the driver
>>> now.
>>>
>>> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>>> ---
>>>
>>
>> Looks good now,
>>
>> Acked-by: Arnd Bergmann <arnd@arndb.de>
>>
>
> Applied to v4.4-next/soc

This patch does not compile on my system.

With "CONFIG_DEBUG_SECTION_MISMATCH=y" I see:

WARNING: vmlinux.o(.data+0x387c8): Section mismatch in reference from
the variable scpsys_drv to the function .init.text:scpsys_probe()
The variable scpsys_drv references
the function __init scpsys_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

FATAL: modpost: Section mismatches detected.
Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.


The problem is that scpsys_probe() is still __init, but it references
scp_domain_data[] which is __initconst.
However, scpsys_drv is not __initdata, so it cannot contain a pointer
to an __init function.

The only way I know to fix this is by dropping the __init & __initconst.
This is rather unfortunate.
Is there another way where we can use -EPROBE_DEFER and still preserve
__init / __initconst ?

Also, since scpsys' Kconfig is "bool" not "tristate" it isn't a real
module so I think we should use:
builtin_platform_driver not module_platform_driver

CC'ing Paul Gortmaker who seems to be on a mass
builtin_platform_driver conversion at the moment, see:
https://lkml.org/lkml/2015/12/9/952

-Dan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] soc: mediatek: SCPSYS: use module_platform_driver
  2015-12-17  2:52     ` Daniel Kurtz
@ 2015-12-17 15:16       ` Paul Gortmaker
  2015-12-18  8:33         ` Matthias Brugger
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Gortmaker @ 2015-12-17 15:16 UTC (permalink / raw)
  To: linux-arm-kernel

[Re: [PATCH v2] soc: mediatek: SCPSYS: use module_platform_driver] On 17/12/2015 (Thu 10:52) Daniel Kurtz wrote:

[...]

> 
> Also, since scpsys' Kconfig is "bool" not "tristate" it isn't a real
> module so I think we should use:
> builtin_platform_driver not module_platform_driver
> 
> CC'ing Paul Gortmaker who seems to be on a mass
> builtin_platform_driver conversion at the moment, see:
> https://lkml.org/lkml/2015/12/9/952
> 

Good guess.  In my giant queue I have that change.  I just haven't got
around to the requisite triple check and multi arch rebuild tests and
put out a series for soc yet.  Here is the short list for soc:

drivers-soc-make-mediatek-mtk-scpsys.c-explicitly-no.patch
drivers-soc-make-qcom-spm.c-explicitly-non-modular.patch
drivers-soc-make-samsung-exynos-srom.c.c-explicitly-.patch
drivers-soc-make-sunxi_sram.c-explicitly-non-modular.patch
drivers-soc-tegra-make-fuse-tegra.c-explicitly-non-m.patch

...and here is the patch you predicted.  If someone wants to fold
the change into their work then great; I'll be happy to drop
mine and be with one less patch to herd along.

Paul.
--

 From eb32cc2c1db8192c08dd64af69cb172b3be4c98b Mon Sep 17 00:00:00 2001
From: Paul Gortmaker <paul.gortmaker@windriver.com>
Date: Fri, 4 Sep 2015 19:33:54 -0400
Subject: [PATCH] drivers/soc: make mediatek/mtk-scpsys.c explicitly
 non-modular

The Kconfig currently controlling compilation of this code is:

drivers/soc/mediatek/Kconfig:config MTK_SCPSYS
drivers/soc/mediatek/Kconfig:   bool "MediaTek SCPSYS Support"

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

Lets remove the couple traces of modularity 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.

Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Daniel Kurtz <djkurtz@chromium.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Olof Johansson <olof@lixom.net>
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-mediatek at lists.infradead.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
index 164a7d8439b1..ae0ca34e64dd 100644
--- a/drivers/soc/mediatek/mtk-scpsys.c
+++ b/drivers/soc/mediatek/mtk-scpsys.c
@@ -15,7 +15,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/mfd/syscon.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
@@ -484,5 +484,4 @@ static struct platform_driver scpsys_drv = {
 		.of_match_table = of_match_ptr(of_scpsys_match_tbl),
 	},
 };
-
-module_platform_driver_probe(scpsys_drv, scpsys_probe);
+builtin_platform_driver_probe(scpsys_drv, scpsys_probe);
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2] soc: mediatek: SCPSYS: use module_platform_driver
  2015-12-17 15:16       ` Paul Gortmaker
@ 2015-12-18  8:33         ` Matthias Brugger
  0 siblings, 0 replies; 6+ messages in thread
From: Matthias Brugger @ 2015-12-18  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Paul,

On 17/12/15 16:16, Paul Gortmaker wrote:
> [Re: [PATCH v2] soc: mediatek: SCPSYS: use module_platform_driver] On 17/12/2015 (Thu 10:52) Daniel Kurtz wrote:
>
> [...]
>
>>
>> Also, since scpsys' Kconfig is "bool" not "tristate" it isn't a real
>> module so I think we should use:
>> builtin_platform_driver not module_platform_driver
>>
>> CC'ing Paul Gortmaker who seems to be on a mass
>> builtin_platform_driver conversion at the moment, see:
>> https://lkml.org/lkml/2015/12/9/952
>>
>
> Good guess.  In my giant queue I have that change.  I just haven't got
> around to the requisite triple check and multi arch rebuild tests and
> put out a series for soc yet.  Here is the short list for soc:
>
> drivers-soc-make-mediatek-mtk-scpsys.c-explicitly-no.patch
> drivers-soc-make-qcom-spm.c-explicitly-non-modular.patch
> drivers-soc-make-samsung-exynos-srom.c.c-explicitly-.patch
> drivers-soc-make-sunxi_sram.c-explicitly-non-modular.patch
> drivers-soc-tegra-make-fuse-tegra.c-explicitly-non-m.patch
>
> ...and here is the patch you predicted.  If someone wants to fold
> the change into their work then great; I'll be happy to drop
> mine and be with one less patch to herd along.
>

I take this through my tree.

Thanks a lot.
Matthias

> Paul.
> --
>
>   From eb32cc2c1db8192c08dd64af69cb172b3be4c98b Mon Sep 17 00:00:00 2001
> From: Paul Gortmaker <paul.gortmaker@windriver.com>
> Date: Fri, 4 Sep 2015 19:33:54 -0400
> Subject: [PATCH] drivers/soc: make mediatek/mtk-scpsys.c explicitly
>   non-modular
>
> The Kconfig currently controlling compilation of this code is:
>
> drivers/soc/mediatek/Kconfig:config MTK_SCPSYS
> drivers/soc/mediatek/Kconfig:   bool "MediaTek SCPSYS Support"
>
> ...meaning that it currently is not being built as a module by anyone.
>
> Lets remove the couple traces of modularity 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.
>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Daniel Kurtz <djkurtz@chromium.org>
> Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
> Cc: Olof Johansson <olof@lixom.net>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-mediatek at lists.infradead.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>
> diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
> index 164a7d8439b1..ae0ca34e64dd 100644
> --- a/drivers/soc/mediatek/mtk-scpsys.c
> +++ b/drivers/soc/mediatek/mtk-scpsys.c
> @@ -15,7 +15,7 @@
>   #include <linux/io.h>
>   #include <linux/kernel.h>
>   #include <linux/mfd/syscon.h>
> -#include <linux/module.h>
> +#include <linux/init.h>
>   #include <linux/of_device.h>
>   #include <linux/platform_device.h>
>   #include <linux/pm_domain.h>
> @@ -484,5 +484,4 @@ static struct platform_driver scpsys_drv = {
>   		.of_match_table = of_match_ptr(of_scpsys_match_tbl),
>   	},
>   };
> -
> -module_platform_driver_probe(scpsys_drv, scpsys_probe);
> +builtin_platform_driver_probe(scpsys_drv, scpsys_probe);
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-18  8:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-16 11:00 [PATCH v2] soc: mediatek: SCPSYS: use module_platform_driver Sascha Hauer
2015-12-16 11:22 ` Arnd Bergmann
2015-12-16 11:55   ` Matthias Brugger
2015-12-17  2:52     ` Daniel Kurtz
2015-12-17 15:16       ` Paul Gortmaker
2015-12-18  8:33         ` Matthias Brugger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).