Re: [PATCH 1/4] irqchip/sg2042-msi: Improve the logic of obtaining msi-ranges parameters

Chen Wang <[email protected]>
Newsgroups dev.linux.lists.sophgo,org.infradead.lists.linux-riscv,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <MAUPR01MB110725A1D283DE4D69AEC137DFE3EA@MAUPR01MB11072.INDPRD01.PROD.OUTLOOK.COM>
On 8/25/2025 3:33 PM, Inochi Amaoto wrote:
> On Mon, Aug 25, 2025 at 02:55:03PM +0800, Chen Wang wrote:
>> From: Chen Wang <[email protected]>
>>
>> Get the arguments of msi-ranges by specifying nargs directly instead of
>> using nargs_prop. This only takes one step, unlike the previous two
>> steps to get the values of all the arguments.
>>
>> Signed-off-by: Chen Wang <[email protected]>
>> ---
>>   drivers/irqchip/irq-sg2042-msi.c | 14 +++-----------
>>   1 file changed, 3 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/irqchip/irq-sg2042-msi.c b/drivers/irqchip/irq-sg2042-msi.c
>> index 3b13dbbfdb51..5249afd93b4a 100644
>> --- a/drivers/irqchip/irq-sg2042-msi.c
>> +++ b/drivers/irqchip/irq-sg2042-msi.c
>> @@ -276,17 +276,9 @@ static int sg2042_msi_probe(struct platform_device *pdev)
>>   	data->doorbell_addr = res->start;
>>   
>>   	ret = fwnode_property_get_reference_args(dev_fwnode(dev), "msi-ranges",
>> -						 "#interrupt-cells", 0, 0, &args);
>> +						 NULL, 3, 0, &args);
> Why using a fixed range here? I see no improvement. I think using #interrupt-cells
> is just OK.
Ok, I will revert this change.
> Regards,
> Inochi
>
>>   	if (ret) {
>> -		dev_err(dev, "Unable to parse MSI vec base\n");
>> -		return ret;
>> -	}
>> -	fwnode_handle_put(args.fwnode);
>> -
>> -	ret = fwnode_property_get_reference_args(dev_fwnode(dev), "msi-ranges", NULL,
>> -						 args.nargs + 1, 0, &args);
>> -	if (ret) {
>> -		dev_err(dev, "Unable to parse MSI vec number\n");
>> +		dev_err(dev, "Unable to parse MSI Ranges\n");
>>   		return ret;
>>   	}
>>   
>> @@ -298,7 +290,7 @@ static int sg2042_msi_probe(struct platform_device *pdev)
>>   	}
>>   
>>   	data->irq_first = (u32)args.args[0];
>> -	data->num_irqs = (u32)args.args[args.nargs - 1];
>> +	data->num_irqs = (u32)args.args[2];
>>   
>>   	mutex_init(&data->msi_map_lock);
>>   
>> -- 
>> 2.34.1
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.