[PATCH 1/1] mtd: fsl-quadspi: Add mutex for accessing different SPI-NOR devices

Alexander Stein alexander.stein at systec-electronic.com
Thu Jul 23 08:41:34 PDT 2015


Hi Han,

On Thursday 23 July 2015 10:31:05, Han Xu wrote:
> I think it is the same patch
> 
>  http://patchwork.ozlabs.org/patch/429631/

Yep. They are more or less the same. I didn't know about this.
I lack the include though, which seems the right thing to do.

But I see a problem in your case:
> @@ -751,6 +753,8 @@ static int fsl_qspi_prep(struct spi_nor *nor, enum 
spi_nor_ops ops)
>  	struct fsl_qspi *q = nor->priv;
>  	int ret;
>  
> +	mutex_lock(&q->lock);
> +
>  	ret = clk_enable(q->clk_en);
>  	if (ret)
>  		return ret;

I see a problem here. If one of those clk_enable fails, you return with the 
mutex still being locked. That's why I lock/unlock the mutex the last/first in 
prepare/unprepare.

Best regards,
Alexander
-- 
Dipl.-Inf. Alexander Stein
SYS TEC electronic GmbH
alexander.stein at systec-electronic.com

Legal and Commercial Address:
Am Windrad 2
08468 Heinsdorfergrund
Germany

Office: +49 (0) 3765 38600-0
Fax:    +49 (0) 3765 38600-4100
 
Managing Directors:
	Director Technology/CEO: Dipl.-Phys. Siegmar Schmidt;
	Director Commercial Affairs/COO: Dipl. Ing. (FH) Armin von Collrepp
Commercial Registry:
	Amtsgericht Chemnitz, HRB 28082; USt.-Id Nr. DE150534010




More information about the linux-mtd mailing list