[PATCH 04/15] x86/dtb: add irq domain abstraction

Sebastian Andrzej Siewior bigeasy at linutronix.de
Mon Jan 24 00:06:36 EST 2011


* Grant Likely | 2011-01-11 15:03:17 [-0700]:

>>  unsigned int irq_create_of_mapping(struct device_node *controller,
>>  		const u32 *intspec, unsigned int intsize)
>>  {
>> -	return intspec[0];
>> +	struct irq_domain *ih;
>> +	u32 virq;
>> +	u32 type;
>> +	int ret;
>>  
>> +	ih = get_ih_from_node(controller);
>> +	if (!ih)
>> +		return -ENODEV;
>
>Return value is an unsigned int.  0 or NO_IRQ is the correct thing to
>return if an IRQ cannot be mapped.
fixed.

>> +	ret = ih->xlate(ih, intspec, intsize, &virq, &type);
>> +	if (ret)
>> +		return ret;
>
>Ditto here.  xlate is also supposed to return a virq number, not an
>error code, so the failure condition must be "if (!ret)" or
are you sure on that? The relevant part of powerpc's
irq_create_of_mapping() looks like:

| if (host->ops->xlate(host, controller, intspec, intsize,
|                           &hwirq, &type))
|       return NO_IRQ;

so xlate here returns 0 on success and hwirq via a pointer. I do the
same thing here except I return directly virq instead of
irq_hw_number_t. I add powerpc's irq_create_mapping() including virq <->
hwirq mapping once it is generic. I shouldn't need unless we use
non-ioapics are irq controllers.

>"if (reg == NO_IRQ)".  The former is preferred since we're trying to
>eliminate references to NO_IRQ, not add more of them.
Okay. So try to get rid of NO_IRQ in my series.

Sebastian


More information about the devicetree-discuss mailing list