[3/4] media: cedrus: Make SRAM section claiming optional

Message ID 20221231164628.19688-4-samuel@sholland.org
State New
Headers
Series Allwinner D1 video engine support |

Commit Message

Samuel Holland Dec. 31, 2022, 4:46 p.m. UTC
  The video engine in the D1 family of SoCs does not have a switchable
SRAM section. Allow the driver to probe even when the SRAM section
reference is missing.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

 drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Paul Kocialkowski Jan. 5, 2023, 10:02 a.m. UTC | #1
Hi Samuel,

On Sat 31 Dec 22, 10:46, Samuel Holland wrote:
> The video engine in the D1 family of SoCs does not have a switchable
> SRAM section. Allow the driver to probe even when the SRAM section
> reference is missing.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Looks good, I've also just checked that calling sunxi_sram_release with no
reference to the SRAM held is fine (maybe a word about it in the commit log
would be nice, but probably not worth making a v2 just for that).

Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Cheers,

Paul

> ---
> 
>  drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> index fa86a658fdc6..11e859617932 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> @@ -257,7 +257,7 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
>  	}
>  
>  	ret = sunxi_sram_claim(dev->dev);
> -	if (ret) {
> +	if (ret && ret != -ENOENT) {
>  		dev_err(dev->dev, "Failed to claim SRAM\n");
>  
>  		goto err_mem;
> -- 
> 2.37.4
>
  
Jernej Škrabec Jan. 5, 2023, 4:19 p.m. UTC | #2
Dne sobota, 31. december 2022 ob 17:46:26 CET je Samuel Holland napisal(a):
> The video engine in the D1 family of SoCs does not have a switchable
> SRAM section. Allow the driver to probe even when the SRAM section
> reference is missing.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c index
> fa86a658fdc6..11e859617932 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> @@ -257,7 +257,7 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
>  	}
> 
>  	ret = sunxi_sram_claim(dev->dev);
> -	if (ret) {
> +	if (ret && ret != -ENOENT) {

What about more strict check based on quirks flag?

Best regards,
Jernej

>  		dev_err(dev->dev, "Failed to claim SRAM\n");
> 
>  		goto err_mem;
  

Patch

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
index fa86a658fdc6..11e859617932 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
@@ -257,7 +257,7 @@  int cedrus_hw_probe(struct cedrus_dev *dev)
 	}
 
 	ret = sunxi_sram_claim(dev->dev);
-	if (ret) {
+	if (ret && ret != -ENOENT) {
 		dev_err(dev->dev, "Failed to claim SRAM\n");
 
 		goto err_mem;