Re: [PATCH v2 2/4] gpio: sifive: Look up IRQs only once during probe

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

 




On 2023-07-19 11:48 AM, Andy Shevchenko wrote:
> On Wed, Jul 19, 2023 at 09:34:43AM -0700, Samuel Holland wrote:
>> of_irq_count(), or eqivalently platform_irq_count(), simply looks up
>> successively-numbered IRQs until that fails. Since this driver needs to
>> look up each IRQ anyway to get its virq number, use that existing loop
>> to count the IRQs at the same time.
> 
> ...
> 
>> -	ngpio = of_irq_count(node);
>> -	if (ngpio > SIFIVE_GPIO_MAX) {
>> -		dev_err(dev, "Too many GPIO interrupts (max=%d)\n",
>> -			SIFIVE_GPIO_MAX);
>> -		return -ENXIO;
> 
> Do we still need this check?

I don't think so. I think this check was only intended to prevent overflowing
the irq_number array, and that is now handled by the loop condition.

>> -	}
> 
> ...
> 
>> +	for (ngpio = 0; ngpio < SIFIVE_GPIO_MAX; ngpio++) {
>> +		ret = platform_get_irq_optional(pdev, ngpio);
>>  		if (ret < 0)
>> -			return ret;
>> -		chip->irq_number[i] = ret;
>> +			break;
>> +		chip->irq_number[ngpio] = ret;
>>  	}
> 
> If so, here we need something like
> 
> 	ret = platform_get_irq_optional(pdev, ngpio);
> 	if (ret > 0) {
> 		dev_err(dev, "Too many GPIO interrupts (max=%d)\n",
> 			SIFIVE_GPIO_MAX);
> 		return -ENXIO;
> 	}
> 
> Otherwise you need to mention this relaxation in the commit message.

OK, I will add something to the commit message in v3.



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux