Skip to contentSkip to conversation

mfd: syscon: Removed support for unloading

PATCH Superseded Alexander Shiyan 3 participants 8 messages Feb 11, 2013 – Feb 17, 2013

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 mfd: syscon: Removed support for unloading

The driver can be used in various subsystems and therefore should not be unloaded when it is defined in the kernel configuration, so remove support for unloading it.

---
 drivers/mfd/syscon.c | 18 ------------------
 1 file changed, 18 deletions(-)
drivers/mfd/syscon.c +0 -18
index 3f10591..e1886fb 100644
@@ -138,17 +138,6 @@ static int syscon_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int syscon_remove(struct platform_device *pdev)
-{
-	struct syscon *syscon;
-
-	syscon = platform_get_drvdata(pdev);
-	iounmap(syscon->base);
-	platform_set_drvdata(pdev, NULL);
-
-	return 0;
-}
-
 static struct platform_driver syscon_driver = {
 	.driver = {
 		.name = "syscon",
@@ -156,7 +145,6 @@ static struct platform_driver syscon_driver = {
 		.of_match_table = of_syscon_match,
 	},
 	.probe		= syscon_probe,
-	.remove		= syscon_remove,
 };
 
 static int __init syscon_init(void)
@@ -165,12 +153,6 @@ static int __init syscon_init(void)
 }
 postcore_initcall(syscon_init);
 
-static void __exit syscon_exit(void)
-{
-	platform_driver_unregister(&syscon_driver);
-}
-module_exit(syscon_exit);
-
 MODULE_AUTHOR("Dong Aisheng <[email protected]>");
 MODULE_DESCRIPTION("System Control driver");
 MODULE_LICENSE("GPL v2");
Signature · 1 line
1.7.12.4
#1 lore raw

PATCH v2 2/3 mfd: syscon: Removed unneeded field "dev" from private driver structure

---
 drivers/mfd/syscon.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mfd/syscon.c +1 -4
index e1886fb..4a7ed5a 100644
@@ -24,17 +24,15 @@
 static struct platform_driver syscon_driver;
 
 struct syscon {
-	struct device *dev;
 	void __iomem *base;
 	struct regmap *regmap;
 };
 
 static int syscon_match(struct device *dev, void *data)
 {
-	struct syscon *syscon = dev_get_drvdata(dev);
 	struct device_node *dn = data;
 
-	return (syscon->dev->of_node == dn) ? 1 : 0;
+	return (dev->of_node == dn) ? 1 : 0;
 }
 
 struct regmap *syscon_node_to_regmap(struct device_node *np)
@@ -129,7 +127,6 @@ static int syscon_probe(struct platform_device *pdev)
 		return PTR_ERR(syscon->regmap);
 	}
 
-	syscon->dev = dev;
 	platform_set_drvdata(pdev, syscon);
 
 	dev_info(dev, "syscon regmap start 0x%x end 0x%x registered\n",
Signature · 1 line
1.7.12.4
Acked-by on v2 2/3
#2 lore raw

Re: [PATCH v2 2/3] mfd: syscon: Removed unneeded field "dev" from private driver structure

Quoted 2 lines · Alexander Shiyan

Regards
Dong Aisheng

Quoted 38 lines
---
 drivers/mfd/syscon.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mfd/syscon.c +1 -5
index e1886fb..4a7ed5a 100644
@@ -24,17 +24,15 @@
 static struct platform_driver syscon_driver;
 
 struct syscon {
-       struct device *dev;
        void __iomem *base;
        struct regmap *regmap;
 };
 
 static int syscon_match(struct device *dev, void *data)
 {
-       struct syscon *syscon = dev_get_drvdata(dev);
        struct device_node *dn = data;
 
-       return (syscon->dev->of_node == dn) ? 1 : 0;
+       return (dev->of_node == dn) ? 1 : 0;
 }
 
 struct regmap *syscon_node_to_regmap(struct device_node *np)
@@ -129,7 +127,6 @@ static int syscon_probe(struct platform_device *pdev)
                return PTR_ERR(syscon->regmap);
        }
 
-       syscon->dev = dev;
        platform_set_drvdata(pdev, syscon);
 
        dev_info(dev, "syscon regmap start 0x%x end 0x%x registered\n",
--

1.7.12.4

#3 lore raw

PATCH v2 3/3 mfd: syscon: Add non-DT support

In reply to Alexander Shiyan

This patch allow using syscon driver from the platform data, i.e. possibility works without oftree support.

---
 drivers/mfd/Kconfig        |  1 -
 drivers/mfd/syscon.c       | 77 ++++++++++++++++++++++++++++++++++------------
 include/linux/mfd/syscon.h |  4 +++
 3 files changed, 62 insertions(+), 20 deletions(-)
drivers/mfd/Kconfig +0 -1
index 671f5b1..8fdd87e 100644
@@ -1070,7 +1070,6 @@ config MFD_STA2X11
 
 config MFD_SYSCON
 	bool "System Controller Register R/W Based on Regmap"
-	depends on OF
 	select REGMAP_MMIO
 	help
 	  Select this option to enable accessing system control registers
drivers/mfd/syscon.c +58 -19

134 lines not on this page · raw message

include/linux/mfd/syscon.h +4 -0
index 6aeb6b8..96c2566 100644
@@ -15,6 +15,10 @@
 #ifndef __LINUX_MFD_SYSCON_H__
 #define __LINUX_MFD_SYSCON_H__
 
+struct syscon_pdata {
+	const char	*compatible;
+};
+
 extern struct regmap *syscon_node_to_regmap(struct device_node *np);
 extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
 extern struct regmap *syscon_regmap_lookup_by_phandle(
Signature · 1 line
1.7.12.4
maintainer
#4 lore raw
In reply to Alexander Shiyan
Quoted 5 lines · Alexander Shiyan

The driver can be used in various subsystems and therefore should not be unloaded when it is defined in the kernel configuration, so remove support for unloading it.

Can you describe a scenario where that would happen? Normally the module should stay pinned as long as any other module refers to its exported symbols.

Arnd

#5 lore raw

Hello.

Quoted 10 lines · Alexander Shiyan
Quoted 5 lines

The driver can be used in various subsystems and therefore should not be unloaded when it is defined in the kernel configuration, so remove support for unloading it.

Can you describe a scenario where that would happen? Normally the module should stay pinned as long as any other module refers to its exported symbols.

Probably I wrote a bad description.
The driver registered by "postcore_initcall". Therefore, if we unregister the driver, we have no way to register it back. Fixme please.

---
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

maintainer
#6 lore raw
Quoted 7 lines · Alexander Shiyan
Quoted 7 lines · Alexander Shiyan
Quoted 5 lines

The driver can be used in various subsystems and therefore should not be unloaded when it is defined in the kernel configuration, so remove support for unloading it.

Quoted 7 lines
Quoted 3 lines

Can you describe a scenario where that would happen? Normally the module should stay pinned as long as any other module refers to its exported symbols.

Probably I wrote a bad description.
The driver registered by "postcore_initcall". Therefore, if we unregister the driver, we have no way to register it back. Fixme please.

Ah, the driver is actually "bool" in Kconfig rather than "tristate", so it is not possible to build it as a module. Makes sense then, and if we ever want to turn this into a module, we can still revert your patch.

Arnd

Acked-by on v2 1/3
#7 lore raw
In reply to Alexander Shiyan
Quoted 5 lines · Alexander Shiyan

The driver can be used in various subsystems and therefore should not be unloaded when it is defined in the kernel configuration, so remove support for unloading it.

Regards
Dong Aisheng

Quoted 50 lines
---
 drivers/mfd/syscon.c | 18 ------------------
 1 file changed, 18 deletions(-)
drivers/mfd/syscon.c +0 -19
index 3f10591..e1886fb 100644
@@ -138,17 +138,6 @@ static int syscon_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int syscon_remove(struct platform_device *pdev)
-{
-       struct syscon *syscon;
-
-       syscon = platform_get_drvdata(pdev);
-       iounmap(syscon->base);
-       platform_set_drvdata(pdev, NULL);
-
-       return 0;
-}
-
 static struct platform_driver syscon_driver = {
        .driver = {
                .name = "syscon",
@@ -156,7 +145,6 @@ static struct platform_driver syscon_driver = {
                .of_match_table = of_syscon_match,
        },
        .probe          = syscon_probe,
-       .remove         = syscon_remove,
 };
 
 static int __init syscon_init(void)
@@ -165,12 +153,6 @@ static int __init syscon_init(void)
 }
 postcore_initcall(syscon_init);
 
-static void __exit syscon_exit(void)
-{
-       platform_driver_unregister(&syscon_driver);
-}
-module_exit(syscon_exit);
-
 MODULE_AUTHOR("Dong Aisheng <[email protected]>");
 MODULE_DESCRIPTION("System Control driver");
 MODULE_LICENSE("GPL v2");
--

1.7.12.4