mfd: syscon: Removed support for unloading
Subsystems (2)
PATCH v5 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
@@ -139,17 +139,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" ,
@@ -157,7 +146,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 )
@@ -166,12 +154,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
PATCH v5 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
@@ -25,17 +25,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)
@@ -130,7 +128,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
Quoted 3 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.
Why not fix the clients to module_get() at the appropriate times; then you could still allow unloading, couldn't you?
Quoted 7 lines · Alexander Shiyan
Quoted 3 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.
Why not fix the clients to
module_get()at the appropriate times; then you could still allow unloading, couldn't you?
I has explain this before. Driver defined as "bool" and loaded via postcore_initcall. Once loaded it should not be unloaded, in other case it have not way to be loaded back. I am correctly understand your question?
Thanks.
---
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 9 lines · Alexander Shiyan
Quoted 7 lines · Alexander Shiyan
Quoted 3 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.
Why not fix the clients to
module_get()at the appropriate times; then you could still allow unloading, couldn't you?I has explain this before.
If multiple people have asked this, perhaps it'd be a good idea to include the answer in the commit description.
Quoted 1 line
Driver defined as "bool" and loaded via
postcore_initcall.
Being defined as a "bool" sounds like a reasonable reason that no remove() is required.
Being loaded via postcore_initcall() (a) should have absolutely no influence over whether a remove() is required (an actual module could just as well include a postcore_initcall function, which would get executed at module load time), and (b) is wrong; initcall ordering shouldn't be used to influence driver probe ordering.
Quoted 11 lines · Stephen Warren
Quoted 9 lines · Alexander Shiyan
Quoted 7 lines · Alexander Shiyan
Quoted 3 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.
Why not fix the clients to
module_get()at the appropriate times; then you could still allow unloading, couldn't you?I has explain this before.
Quoted 7 lines
If multiple people have asked this, perhaps it'd be a good idea to include the answer in the commit description.
Quoted 1 line
Driver defined as "bool" and loaded via
postcore_initcall.Being defined as a "bool" sounds like a reasonable reason that no
remove()is required.
No, it is not - I can still unbind the device from driver via sysfs. Now what will happen is resources are leaked and won't be available when trying to bin (via sysfs) again.
This patch is broken.
Thanks.
Signature · 1 line
Dmitry
Quoted 17 lines · Stephen Warren
Quoted 16 lines · Alexander Shiyan
Quoted 9 lines
Quoted 7 lines · Alexander Shiyan
Quoted 3 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.
Why not fix the clients to
module_get()at the appropriate times; then you could still allow unloading, couldn't you?I has explain this before.
If multiple people have asked this, perhaps it'd be a good idea to include the answer in the commit description.
Quoted 1 line
Driver defined as "bool" and loaded via
postcore_initcall.
Quoted 8 lines
Quoted 2 lines
Being defined as a "bool" sounds like a reasonable reason that no
remove()is required.No, it is not - I can still unbind the device from driver via sysfs. Now what will happen is resources are leaked and won't be available when trying to bin (via sysfs) again.
This patch is broken.
I will try to resolve the dispute.
Initially, the first part of the patch (this) was an attempt to prevent the unloading (unregister) of the driver (not the device), ie remove module_exit call. The patch also removes the code to remove the device. Inclusion in this patch of the code was a mistake. Because of this, people are confused about the terms, including me.
Code, relating to the removal of the device should be moved to the third patch. Since all moved to using the managed resources, it should not have any questions.
About uloading (unregister) driver: As far i understand "__exit" section is completely discarded when kernel compiled without module support. But where is this call (module_exit) is placing in case "bool" driver and kernel is compiled with module support? Fixme please.
Thanks.
---
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 35 lines · Alexander Shiyan
Quoted 17 lines · Stephen Warren
Quoted 16 lines · Alexander Shiyan
Quoted 9 lines
Quoted 7 lines · Alexander Shiyan
Quoted 3 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.
Why not fix the clients to
module_get()at the appropriate times; then you could still allow unloading, couldn't you?I has explain this before.
If multiple people have asked this, perhaps it'd be a good idea to include the answer in the commit description.
Quoted 1 line
Driver defined as "bool" and loaded via
postcore_initcall.Quoted 8 lines
Quoted 2 lines
Being defined as a "bool" sounds like a reasonable reason that no
remove()is required.No, it is not - I can still unbind the device from driver via sysfs. Now what will happen is resources are leaked and won't be available when trying to bin (via sysfs) again.
This patch is broken.
I will try to resolve the dispute.
Initially, the first part of the patch (this) was an attempt to prevent the unloading (unregister) of the driver (not the device), ie removemodule_exitcall. The patch also removes the code to remove the device. Inclusion in this patch of the code was a mistake. Because of this, people are confused about the terms, including me.
Code, relating to the removal of the device should be moved to the third patch. Since all moved to using the managed resources, it should not have any questions.
Quoted 4 lines
About uloading (unregister) driver: As far i understand "
__exit" section is completely discarded when kernel compiled without module support. But where is this call (module_exit) is placing in case "bool" driver and kernel is compiled with module support? Fixme please.
In both cases __exit code goes to .exit.text section which is either discarded (code is compiled into the kernel) or kept (code is built as a module).
Still, because the device can forcibly be unbound from the driver, all these changes are pretty useless for the stated purpose. All in all, it seems to me that this code should not be a driver at all, but rather rolled into regmap infrastructure and be part of it's initialization process.
Thanks.
Signature · 1 line
Dmitry
PATCH v5 3/3 mfd: syscon: Add non-DT support
In reply to Alexander ShiyanThis patch allow using syscon driver from the platform data, i.e. possibility using driver on systems without oftree support. For search syscon device from the client drivers, "syscon_regmap_lookup_by_pdevname" function was added.
--- drivers/mfd/Kconfig | 1 - drivers/mfd/syscon.c | 67 ++++++++++++++++++++++++++++++++-------------- include/linux/mfd/syscon.h | 1 + 3 files changed, 48 insertions(+), 21 deletions(-)
drivers/mfd/Kconfig +0 -1
@@ -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 +47 -20
115 lines not on this page · raw message
include/linux/mfd/syscon.h +1 -0
@@ -17,6 +17,7 @@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_pdevname (const char *s);extern struct regmap *syscon_regmap_lookup_by_phandle (struct device_node *np,const char *property);
Signature · 1 line
1.7.12.4
Arnd Bergmann
maintainerQuoted 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.
Signed-off-by Alexander Shiyan <[email protected]>
I think the description is still wrong here, as mentioned before.
Arnd