Log messages about claimed sram.

Signed-off-by: Michal Suchanek <[email protected]>
---
 drivers/soc/sunxi/sunxi_sram.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c
index 5b76fd1..3d03e89 100644
--- a/drivers/soc/sunxi/sunxi_sram.c
+++ b/drivers/soc/sunxi/sunxi_sram.c
@@ -35,6 +35,8 @@ struct sunxi_sram_desc {
        bool                    enabled;
 };
 
+static struct platform_device *pdev;
+
 #define SUNXI_SRAM_MAP(_val, _func)                            \
        {                                                       \
                .func = _func,                                  \
@@ -127,11 +129,13 @@ int sunxi_sram_claim(enum sunxi_sram_type type, const 
char *function)
 
                if (sram->claimed) {
                        spin_unlock(&sram_lock);
+                       dev_warn(&pdev->dev, "Sram %s already claimed.\n", 
sram->name );
                        return -EBUSY;
                }
 
                sram->claimed = true;
                spin_unlock(&sram_lock);
+               dev_info(&pdev->dev, "Claiming sram %s.\n", sram->name );
 
                for (func = sram->func; func->func; func++) {
                        if (strcmp(function, func->func))
@@ -164,6 +168,7 @@ int sunxi_sram_release(enum sunxi_sram_type type)
                spin_lock(&sram_lock);
                sram->claimed = false;
                spin_unlock(&sram_lock);
+               dev_info(&pdev->dev, "Releasing sram %s.\n", sram->name );
 
                return 0;
        }
@@ -179,7 +184,7 @@ static const struct of_device_id sunxi_sram_dt_match[] = {
 };
 MODULE_DEVICE_TABLE(of, sunxi_sram_dt_match);
 
-static int sunxi_sram_probe(struct platform_device *pdev)
+static int sunxi_sram_probe(struct platform_device *_pdev)
 {
        const struct of_device_id *match;
        struct sunxi_sram_desc *sram;
@@ -188,12 +193,12 @@ static int sunxi_sram_probe(struct platform_device *pdev)
        struct dentry *d;
        const char *name;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       base = devm_ioremap_resource(&pdev->dev, res);
+       res = platform_get_resource(_pdev, IORESOURCE_MEM, 0);
+       base = devm_ioremap_resource(&_pdev->dev, res);
        if (IS_ERR(base))
                return PTR_ERR(base);
 
-       match = of_match_device(sunxi_sram_dt_match, &pdev->dev);
+       match = of_match_device(sunxi_sram_dt_match, &_pdev->dev);
        if (!match)
                return -ENODEV;
 
@@ -212,6 +217,7 @@ static int sunxi_sram_probe(struct platform_device *pdev)
 
                sram->enabled = true;
        }
+       pdev = _pdev;
 
        d = debugfs_create_file("sram", S_IRUGO, NULL, NULL,
                                &sunxi_sram_fops);
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to