Hi,

On Wed, Apr 29, 2015 at 12:00:24PM +0200, Michal Suchanek wrote:
> Log messages about claimed sram.

A good message usually involves what you are fixing, why and how.

> 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 );

SRAM must be uppercase

>                       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 );

These two should be logged as debug (with a newline before the call
please).

>               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;

Why not storing just the struct device pointer? It's the only thing we
care about.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
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.

Attachment: signature.asc
Description: Digital signature

Reply via email to