sa11x0 PCMCIA updates
Subsystems (2)
cover sa11x0 PCMCIA updates
A series of PCMCIA updates for SA11x0/PXA devices consisting mainly of patches switching the code to use the devm_* APIs, thus cleaning the code up.
The first patch fixes an omitted clk_put() in sa11xx_base.c by switching the clk_get to devm_clk_get().
drivers/pcmcia/pxa2xx_base.c | 17 +++++------------ drivers/pcmcia/sa1100_generic.c | 2 -- drivers/pcmcia/sa1111_generic.c | 14 +++++++------- drivers/pcmcia/sa11xx_base.c | 17 ++--------------- drivers/pcmcia/soc_common.h | 1 - 5 files changed, 14 insertions(+), 37 deletions(-)
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.
PATCH 1/8 pcmcia: sa11x0: fix missing clk_put() in sa11x0 socket drivers
Fix the lack of clk_put() in sa11xx_base.c's error cleanup paths by converting the driver to the devm_* API.
--- drivers/pcmcia/sa1100_generic.c | 1 - drivers/pcmcia/sa11xx_base.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/pcmcia/sa1100_generic.c +0 -1
@@ -93,7 +93,6 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)for (i =0 ; i < sinfo->nskt; i++)soc_pcmcia_remove_one (&sinfo->skt[i]); -clk_put (sinfo->clk);kfree (sinfo);return 0 ; }
drivers/pcmcia/sa11xx_base.c +1 -2
@@ -222,7 +222,7 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,int i, ret =0 ;struct clk *clk; - clk =clk_get (dev,NULL ); + clk =devm_clk_get (dev,NULL );if (IS_ERR (clk))return PTR_ERR (clk);
@@ -251,7 +251,6 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,if (ret) {while (--i >=0 )soc_pcmcia_remove_one (&sinfo->skt[i]); -clk_put (clk);kfree (sinfo); }else {dev_set_drvdata (dev, sinfo);
Signature · 1 line
2.1.0
PATCH 2/8 pcmcia: sa11x0: convert memory allocation to devm_* API
In reply to Russell King - ARM LinuxConvert the sa11x0 socket driver memory allocation to use devm_kzalloc() to simplify the cleanup path.
--- drivers/pcmcia/sa1100_generic.c | 1 - drivers/pcmcia/sa11xx_base.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/pcmcia/sa1100_generic.c +0 -1
@@ -93,7 +93,6 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)for (i =0 ; i < sinfo->nskt; i++)soc_pcmcia_remove_one (&sinfo->skt[i]); -kfree (sinfo);return 0 ; }
drivers/pcmcia/sa11xx_base.c +1 -2
@@ -228,7 +228,7 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,sa11xx_drv_pcmcia_ops (ops); - sinfo =kzalloc (SKT_DEV_INFO_SIZE (nr),GFP_KERNEL ); + sinfo =devm_kzalloc (dev,SKT_DEV_INFO_SIZE (nr),GFP_KERNEL );if (!sinfo)return -ENOMEM ;
@@ -251,7 +251,6 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,if (ret) {while (--i >=0 )soc_pcmcia_remove_one (&sinfo->skt[i]); -kfree (sinfo); }else {dev_set_drvdata (dev, sinfo); }
Signature · 1 line
2.1.0
PATCH 3/8 pcmcia: pxa2xx: update socket driver to use devm_clk_get() API
In reply to Russell King - ARM LinuxUpdate the pxa2xx socket driver to use the devm_clk_get() API so that the cleanup paths are simplified.
--- drivers/pcmcia/pxa2xx_base.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/pcmcia/pxa2xx_base.c +2 -6
@@ -296,17 +296,15 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) goto err0; } - clk =clk_get (&dev->dev,NULL ); + clk =devm_clk_get (&dev->dev,NULL );if (IS_ERR (clk))return -ENODEV ;pxa2xx_drv_pcmcia_ops (ops); sinfo =kzalloc (SKT_DEV_INFO_SIZE (ops->nr),GFP_KERNEL ); -if (!sinfo) { -clk_put (clk); +if (!sinfo)return -ENOMEM ; - } sinfo->nskt = ops->nr; sinfo->clk = clk;
@@ -332,7 +330,6 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) err1:while (--i >=0 )soc_pcmcia_remove_one (&sinfo->skt[i]); -clk_put (clk);kfree (sinfo); err0:return ret;
@@ -348,7 +345,6 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev)for (i =0 ; i < sinfo->nskt; i++)soc_pcmcia_remove_one (&sinfo->skt[i]); -clk_put (sinfo->clk);kfree (sinfo);return 0 ; }
Signature · 1 line
2.1.0
Robert Jarzmik
maintainerPATCH 3/8 pcmcia: pxa2xx: update socket driver to use devm_clk_get() API
Quoted 4 lines · Russell King
Update the pxa2xx socket driver to use the
devm_clk_get()API so that the cleanup paths are simplified.Signed-off-by Russell King <[email protected]>
Cheers.
--
Robert
PATCH 4/8 pcmcia: pxa2xx: convert memory allocation to devm_* API
In reply to Russell King - ARM LinuxConvert the pxa2xx socket driver memory allocation to use devm_kzalloc() to simplify the cleanup path.
--- drivers/pcmcia/pxa2xx_base.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/pcmcia/pxa2xx_base.c +3 -5
@@ -302,7 +302,8 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)pxa2xx_drv_pcmcia_ops (ops); - sinfo =kzalloc (SKT_DEV_INFO_SIZE (ops->nr),GFP_KERNEL ); + sinfo =devm_kzalloc (&dev->dev,SKT_DEV_INFO_SIZE (ops->nr), +GFP_KERNEL );if (!sinfo)return -ENOMEM ;
@@ -330,7 +331,7 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) err1:while (--i >=0 )soc_pcmcia_remove_one (&sinfo->skt[i]); -kfree (sinfo); + err0:return ret; }
@@ -340,12 +341,9 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev)struct skt_dev_info *sinfo =platform_get_drvdata (dev);int i; -platform_set_drvdata (dev,NULL ); -for (i =0 ; i < sinfo->nskt; i++)soc_pcmcia_remove_one (&sinfo->skt[i]); -kfree (sinfo);return 0 ; }
Signature · 1 line
2.1.0
Robert Jarzmik
maintainerPATCH 4/8 pcmcia: pxa2xx: convert memory allocation to devm_* API
Quoted 4 lines · Russell King
Convert the pxa2xx socket driver memory allocation to use
devm_kzalloc()to simplify the cleanup path.Signed-off-by Russell King <[email protected]>
Cheers.
--
Robert
PATCH 5/8 pcmcia: sa1111: update socket driver to use devm_clk_get() API
In reply to Russell King - ARM LinuxUpdate the pxa2xx socket driver to use the devm_clk_get() API so that the cleanup paths are simplified.
--- drivers/pcmcia/sa1111_generic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pcmcia/sa1111_generic.c +1 -2
@@ -145,7 +145,7 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,return -ENOMEM ; s->soc.nr = ops->first + i; - s->soc.clk =clk_get (&dev->dev,NULL ); + s->soc.clk =devm_clk_get (&dev->dev,NULL );if (IS_ERR (s->soc.clk)) { ret =PTR_ERR (s->soc.clk);kfree (s);
@@ -226,7 +226,6 @@ static int pcmcia_remove(struct sa1111_dev *dev)for (; s; s = next) { next = s->next;soc_pcmcia_remove_one (&s->soc); -clk_put (s->soc.clk);kfree (s); }
Signature · 1 line
2.1.0
PATCH 6/8 pcmcia: sa1111: simplify clk handing in sa1111_pcmcia_add()
In reply to Russell King - ARM Linuxclk_get(dev, NULL) will always refer to the same clock, so it's pointless calling this multiple times for the same device. As we no longer have to worry about the cleanup (via use of devm_clk_get()) we can simplify sa1111_pcmcia_add() too.
--- drivers/pcmcia/sa1111_generic.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/pcmcia/sa1111_generic.c +7 -6
@@ -135,8 +135,13 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops, int (*add)(struct soc_pcmcia_socket *)) {struct sa1111_pcmcia_socket *s; +struct clk *clk;int i, ret =0 ; + clk =devm_clk_get (&dev->dev,NULL ); +if (IS_ERR (clk)) +return PTR_ERR (clk); + ops->socket_state = sa1111_pcmcia_socket_state;for (i =0 ; i < ops->nr; i++) {
@@ -145,12 +150,8 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,return -ENOMEM ; s->soc.nr = ops->first + i; - s->soc.clk =devm_clk_get (&dev->dev,NULL ); -if (IS_ERR (s->soc.clk)) { - ret =PTR_ERR (s->soc.clk); -kfree (s); -return ret; - } + s->soc.clk = clk; +soc_pcmcia_init_one (&s->soc, ops, &dev->dev); s->dev = dev;if (s->soc.nr) {
Signature · 1 line
2.1.0
PATCH 7/8 pcmcia: sa11xx_base.c: remove useless init/exit functions
In reply to Russell King - ARM LinuxA library module is not required to have module init/exit functions. Get rid of these unnecessary functions.
--- drivers/pcmcia/sa11xx_base.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/pcmcia/sa11xx_base.c +0 -10
@@ -259,16 +259,6 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, }EXPORT_SYMBOL (sa11xx_drv_pcmcia_probe); -static int __init sa11xx_pcmcia_init (void ) -{ -return 0 ; -} -fs_initcall (sa11xx_pcmcia_init); - -static void __exit sa11xx_pcmcia_exit(void) {} - -module_exit (sa11xx_pcmcia_exit); -MODULE_AUTHOR ("John Dorsey <[email protected]>" );MODULE_DESCRIPTION ("Linux PCMCIA Card Services: SA-11xx core socket driver" );MODULE_LICENSE ("Dual MPL/GPL" );
Signature · 1 line
2.1.0
PATCH 8/8 pcmcia: soc_common: remove skt_dev_info's clk pointer
In reply to Russell King - ARM LinuxWe no longer need to store the clk pointer in struct skt_dev_info as we no longer need to remember the clk pointer for the cleanup paths.
--- drivers/pcmcia/pxa2xx_base.c | 1 - drivers/pcmcia/sa11xx_base.c | 1 - drivers/pcmcia/soc_common.h | 1 - 3 files changed, 3 deletions(-)
drivers/pcmcia/pxa2xx_base.c +0 -1
@@ -308,7 +308,6 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)return -ENOMEM ; sinfo->nskt = ops->nr; - sinfo->clk = clk;/* Initialize processor specific parameters */ for (i =0 ; i < ops->nr; i++) {
drivers/pcmcia/sa11xx_base.c +0 -1
@@ -233,7 +233,6 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,return -ENOMEM ; sinfo->nskt = nr; - sinfo->clk = clk;/* Initialize processor specific parameters */ for (i =0 ; i < nr; i++) {
drivers/pcmcia/soc_common.h +0 -1
@@ -68,7 +68,6 @@ struct soc_pcmcia_socket {struct skt_dev_info {int nskt; -struct clk *clk;struct soc_pcmcia_socket skt[0 ]; };
Signature · 1 line
2.1.0
Robert Jarzmik
maintainerPATCH 8/8 pcmcia: soc_common: remove skt_dev_info's clk pointer
Quoted 4 lines · Russell King
We no longer need to store the clk pointer in struct
skt_dev_infoas we no longer need to remember the clk pointer for the cleanup paths.Signed-off-by Russell King <[email protected]>
Cheers.
--
Robert