Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c92b5bb authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull ARM pcmcia updates from Russell King:
 "A series of changes updating the PXA and SA11x0 PCMCIA code to use
  devm_* APIs, and resolve some resource leaks in doing so.  This
  results in a few small cleanups which are included in this set.

  FYI, the recommit of these today is to add Robert Jarzmik's
  reviewed-by tags, which I'd forgotten to add from mid-July"

* 'pcmcia' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
  pcmcia: soc_common: remove skt_dev_info's clk pointer
  pcmcia: sa11xx_base.c: remove useless init/exit functions
  pcmcia: sa1111: simplify clk handing in sa1111_pcmcia_add()
  pcmcia: sa1111: update socket driver to use devm_clk_get() API
  pcmcia: pxa2xx: convert memory allocation to devm_* API
  pcmcia: pxa2xx: update socket driver to use devm_clk_get() API
  pcmcia: sa11x0: convert memory allocation to devm_* API
  pcmcia: sa11x0: fix missing clk_put() in sa11x0 socket drivers
parents c706c7eb fca8b807
Loading
Loading
Loading
Loading
+5 −12
Original line number Original line Diff line number Diff line
@@ -296,20 +296,18 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
		goto err0;
		goto err0;
	}
	}


	clk = clk_get(&dev->dev, NULL);
	clk = devm_clk_get(&dev->dev, NULL);
	if (IS_ERR(clk))
	if (IS_ERR(clk))
		return -ENODEV;
		return -ENODEV;


	pxa2xx_drv_pcmcia_ops(ops);
	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),
	if (!sinfo) {
			     GFP_KERNEL);
		clk_put(clk);
	if (!sinfo)
		return -ENOMEM;
		return -ENOMEM;
	}


	sinfo->nskt = ops->nr;
	sinfo->nskt = ops->nr;
	sinfo->clk = clk;


	/* Initialize processor specific parameters */
	/* Initialize processor specific parameters */
	for (i = 0; i < ops->nr; i++) {
	for (i = 0; i < ops->nr; i++) {
@@ -332,8 +330,7 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
err1:
err1:
	while (--i >= 0)
	while (--i >= 0)
		soc_pcmcia_remove_one(&sinfo->skt[i]);
		soc_pcmcia_remove_one(&sinfo->skt[i]);
	clk_put(clk);

	kfree(sinfo);
err0:
err0:
	return ret;
	return ret;
}
}
@@ -343,13 +340,9 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev)
	struct skt_dev_info *sinfo = platform_get_drvdata(dev);
	struct skt_dev_info *sinfo = platform_get_drvdata(dev);
	int i;
	int i;


	platform_set_drvdata(dev, NULL);

	for (i = 0; i < sinfo->nskt; i++)
	for (i = 0; i < sinfo->nskt; i++)
		soc_pcmcia_remove_one(&sinfo->skt[i]);
		soc_pcmcia_remove_one(&sinfo->skt[i]);


	clk_put(sinfo->clk);
	kfree(sinfo);
	return 0;
	return 0;
}
}


+0 −2
Original line number Original line Diff line number Diff line
@@ -93,8 +93,6 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
	for (i = 0; i < sinfo->nskt; i++)
	for (i = 0; i < sinfo->nskt; i++)
		soc_pcmcia_remove_one(&sinfo->skt[i]);
		soc_pcmcia_remove_one(&sinfo->skt[i]);


	clk_put(sinfo->clk);
	kfree(sinfo);
	return 0;
	return 0;
}
}


+7 −7
Original line number Original line Diff line number Diff line
@@ -135,8 +135,13 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,
	int (*add)(struct soc_pcmcia_socket *))
	int (*add)(struct soc_pcmcia_socket *))
{
{
	struct sa1111_pcmcia_socket *s;
	struct sa1111_pcmcia_socket *s;
	struct clk *clk;
	int i, ret = 0;
	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;
	ops->socket_state = sa1111_pcmcia_socket_state;


	for (i = 0; i < ops->nr; i++) {
	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;
			return -ENOMEM;


		s->soc.nr = ops->first + i;
		s->soc.nr = ops->first + i;
		s->soc.clk = clk_get(&dev->dev, NULL);
		s->soc.clk = clk;
		if (IS_ERR(s->soc.clk)) {

			ret = PTR_ERR(s->soc.clk);
			kfree(s);
			return ret;
		}
		soc_pcmcia_init_one(&s->soc, ops, &dev->dev);
		soc_pcmcia_init_one(&s->soc, ops, &dev->dev);
		s->dev = dev;
		s->dev = dev;
		if (s->soc.nr) {
		if (s->soc.nr) {
@@ -226,7 +227,6 @@ static int pcmcia_remove(struct sa1111_dev *dev)
	for (; s; s = next) {
	for (; s; s = next) {
		next = s->next;
		next = s->next;
		soc_pcmcia_remove_one(&s->soc);
		soc_pcmcia_remove_one(&s->soc);
		clk_put(s->soc.clk);
		kfree(s);
		kfree(s);
	}
	}


+2 −15
Original line number Original line Diff line number Diff line
@@ -222,18 +222,17 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
	int i, ret = 0;
	int i, ret = 0;
	struct clk *clk;
	struct clk *clk;


	clk = clk_get(dev, NULL);
	clk = devm_clk_get(dev, NULL);
	if (IS_ERR(clk))
	if (IS_ERR(clk))
		return PTR_ERR(clk);
		return PTR_ERR(clk);


	sa11xx_drv_pcmcia_ops(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)
	if (!sinfo)
		return -ENOMEM;
		return -ENOMEM;


	sinfo->nskt = nr;
	sinfo->nskt = nr;
	sinfo->clk = clk;


	/* Initialize processor specific parameters */
	/* Initialize processor specific parameters */
	for (i = 0; i < nr; i++) {
	for (i = 0; i < nr; i++) {
@@ -251,8 +250,6 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
	if (ret) {
	if (ret) {
		while (--i >= 0)
		while (--i >= 0)
			soc_pcmcia_remove_one(&sinfo->skt[i]);
			soc_pcmcia_remove_one(&sinfo->skt[i]);
		clk_put(clk);
		kfree(sinfo);
	} else {
	} else {
		dev_set_drvdata(dev, sinfo);
		dev_set_drvdata(dev, sinfo);
	}
	}
@@ -261,16 +258,6 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
}
}
EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe);
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 <john+@cs.cmu.edu>");
MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>");
MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11xx core socket driver");
MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11xx core socket driver");
MODULE_LICENSE("Dual MPL/GPL");
MODULE_LICENSE("Dual MPL/GPL");
+0 −1
Original line number Original line Diff line number Diff line
@@ -68,7 +68,6 @@ struct soc_pcmcia_socket {


struct skt_dev_info {
struct skt_dev_info {
	int nskt;
	int nskt;
	struct clk *clk;
	struct soc_pcmcia_socket skt[0];
	struct soc_pcmcia_socket skt[0];
};
};