Re: [PATCH 33/34] staging: mt7621-mmc: Fix requesting of irq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 02 2018, Christian Lütke-Stetzkamp wrote:

> The request of the irq line is not correctly handled by the current
> code, platform_get_irq may fail and if the irq is requested via
> devm_request_irq, its release is automatically done.
>
> Signed-off-by: Christian Lütke-Stetzkamp <christian@xxxxxxxx>
> ---
>  drivers/staging/mt7621-mmc/sd.c | 29 +++++++++++++----------------
>  1 file changed, 13 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
> index e709e4d47965..95c439069c2b 100644
> --- a/drivers/staging/mt7621-mmc/sd.c
> +++ b/drivers/staging/mt7621-mmc/sd.c
> @@ -2696,7 +2696,7 @@ static int msdc_drv_probe(struct platform_device *pdev)
>  	struct mmc_host *mmc;
>  	struct msdc_host *host;
>  	struct msdc_hw *hw;
> -	int ret, irq;
> +	int ret;
>  
>  	hw = &msdc0_hw;
>  
> @@ -2708,10 +2708,6 @@ static int msdc_drv_probe(struct platform_device *pdev)
>  	if (!mmc)
>  		return -ENOMEM;
>  
> -	irq  = platform_get_irq(pdev, 0);
> -
> -	//BUG_ON((!hw) || (!mem) || (irq < 0)); /* --- by chhung */
> -
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0)
>  	base = devm_ioremap_resource(&pdev->dev, res);
>  	if (IS_ERR(base)) {
> @@ -2756,7 +2752,13 @@ static int msdc_drv_probe(struct platform_device *pdev)
>  	if (host->id < 0 || host->id >= 4)
>  		host->id = 0;
>  	host->error     = 0;
> -	host->irq       = irq;
> +
> +	host->irq       = platform_get_irq(pdev, 0);
> +	if (host->irq < 0) {
> +		ret = -EINVAL;
> +		goto host_free;
> +	}
> +
>  	host->base      = (unsigned long)base;
>  	host->mclk      = 0;                   /* mclk: the request clock of mmc sub-system */
>  	host->hclk      = hclks[hw->clk_src];  /* hclk: clock of clock source to msdc controller */
> @@ -2801,20 +2803,18 @@ static int msdc_drv_probe(struct platform_device *pdev)
>  	spin_lock_init(&host->lock);
>  	msdc_init_hw(host);
>  
> -	if (ralink_soc == MT762X_SOC_MT7621AT)
> -		ret = request_irq((unsigned int)irq, msdc_irq, 0, dev_name(&pdev->dev), host);
> -	else
> -		ret = request_irq((unsigned int)irq, msdc_irq, IRQF_TRIGGER_LOW, dev_name(&pdev->dev), host);
> -
> +	//TODO check weather flags 0 is correct, the mtk-sd driver uses
> +	//IRQF_TRIGGER_LOW | IRQF_ONESHOT for flags
> +	ret = devm_request_irq(&pdev->dev, host->irq, msdc_irq, 0, pdev->name,
> +			       host);

I think the modern approach is to leave the flags as zero, and set flags
via devicetree.
sdhci has
                interrupt-parent = <&gic>;
                interrupts = <GIC_SHARED 20 IRQ_TYPE_LEVEL_HIGH>;

in device tree, so maybe the 7621 is inverted with respect to other mt
chips?

Thanks,
NeilBrown

Attachment: signature.asc
Description: PGP signature

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux