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

Commit 73858173 authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by Linus Torvalds
Browse files

genalloc: add name arg to gen_pool_get() and devm_gen_pool_create()



This change modifies gen_pool_get() and devm_gen_pool_create() client
interfaces adding one more argument "name" of a gen_pool object.

Due to implementation gen_pool_get() is capable to retrieve only one
gen_pool associated with a device even if multiple gen_pools are created,
fortunately right at the moment it is sufficient for the clients, hence
provide NULL as a valid argument on both producer devm_gen_pool_create()
and consumer gen_pool_get() sides.

Because only one created gen_pool per device is addressable, explicitly
add a restriction to devm_gen_pool_create() to create only one gen_pool
per device, this implies two possible error codes returned by the
function, account it on client side (only misc/sram).  This completes
client side changes related to genalloc updates.

[akpm@linux-foundation.org: gen_pool_get() cleanup]
Signed-off-by: default avatarVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c0a29498
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -369,7 +369,7 @@ static void __init at91_pm_sram_init(void)
		return;
		return;
	}
	}


	sram_pool = gen_pool_get(&pdev->dev);
	sram_pool = gen_pool_get(&pdev->dev, NULL);
	if (!sram_pool) {
	if (!sram_pool) {
		pr_warn("%s: sram pool unavailable!\n", __func__);
		pr_warn("%s: sram pool unavailable!\n", __func__);
		return;
		return;
+1 −1
Original line number Original line Diff line number Diff line
@@ -297,7 +297,7 @@ static int __init imx_suspend_alloc_ocram(
		goto put_node;
		goto put_node;
	}
	}


	ocram_pool = gen_pool_get(&pdev->dev);
	ocram_pool = gen_pool_get(&pdev->dev, NULL);
	if (!ocram_pool) {
	if (!ocram_pool) {
		pr_warn("%s: ocram pool unavailable!\n", __func__);
		pr_warn("%s: ocram pool unavailable!\n", __func__);
		ret = -ENODEV;
		ret = -ENODEV;
+1 −1
Original line number Original line Diff line number Diff line
@@ -451,7 +451,7 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
		goto put_node;
		goto put_node;
	}
	}


	ocram_pool = gen_pool_get(&pdev->dev);
	ocram_pool = gen_pool_get(&pdev->dev, NULL);
	if (!ocram_pool) {
	if (!ocram_pool) {
		pr_warn("%s: ocram pool unavailable!\n", __func__);
		pr_warn("%s: ocram pool unavailable!\n", __func__);
		ret = -ENODEV;
		ret = -ENODEV;
+1 −1
Original line number Original line Diff line number Diff line
@@ -56,7 +56,7 @@ static int socfpga_setup_ocram_self_refresh(void)
		goto put_node;
		goto put_node;
	}
	}


	ocram_pool = gen_pool_get(&pdev->dev);
	ocram_pool = gen_pool_get(&pdev->dev, NULL);
	if (!ocram_pool) {
	if (!ocram_pool) {
		pr_warn("%s: ocram pool unavailable!\n", __func__);
		pr_warn("%s: ocram pool unavailable!\n", __func__);
		ret = -ENODEV;
		ret = -ENODEV;
+1 −1
Original line number Original line Diff line number Diff line
@@ -2157,7 +2157,7 @@ static int coda_probe(struct platform_device *pdev)
	/* Get IRAM pool from device tree or platform data */
	/* Get IRAM pool from device tree or platform data */
	pool = of_gen_pool_get(np, "iram", 0);
	pool = of_gen_pool_get(np, "iram", 0);
	if (!pool && pdata)
	if (!pool && pdata)
		pool = gen_pool_get(pdata->iram_dev);
		pool = gen_pool_get(pdata->iram_dev, NULL);
	if (!pool) {
	if (!pool) {
		dev_err(&pdev->dev, "iram pool not available\n");
		dev_err(&pdev->dev, "iram pool not available\n");
		return -ENOMEM;
		return -ENOMEM;
Loading