@@ -186,8 +186,8 @@ static int of_pci_prop_interrupts(struct pci_dev *pdev,
186
186
static int of_pci_prop_intr_map (struct pci_dev * pdev , struct of_changeset * ocs ,
187
187
struct device_node * np )
188
188
{
189
+ u32 i , addr_sz [OF_PCI_MAX_INT_PIN ] = { 0 }, map_sz = 0 ;
189
190
struct of_phandle_args out_irq [OF_PCI_MAX_INT_PIN ];
190
- u32 i , addr_sz [OF_PCI_MAX_INT_PIN ], map_sz = 0 ;
191
191
__be32 laddr [OF_PCI_ADDRESS_CELLS ] = { 0 };
192
192
u32 int_map_mask [] = { 0xffff00 , 0 , 0 , 7 };
193
193
struct device_node * pnode ;
@@ -213,33 +213,44 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs,
213
213
out_irq [i ].args [0 ] = pin ;
214
214
ret = of_irq_parse_raw (laddr , & out_irq [i ]);
215
215
if (ret ) {
216
- pci_err (pdev , "parse irq %d failed, ret %d" , pin , ret );
216
+ out_irq [i ].np = NULL ;
217
+ pci_dbg (pdev , "parse irq %d failed, ret %d" , pin , ret );
217
218
continue ;
218
219
}
219
- ret = of_property_read_u32 (out_irq [i ].np , "#address-cells" ,
220
- & addr_sz [i ]);
221
- if (ret )
222
- addr_sz [i ] = 0 ;
220
+ of_property_read_u32 (out_irq [i ].np , "#address-cells" ,
221
+ & addr_sz [i ]);
223
222
}
224
223
225
224
list_for_each_entry (child , & pdev -> subordinate -> devices , bus_list ) {
226
225
for (pin = 1 ; pin <= OF_PCI_MAX_INT_PIN ; pin ++ ) {
227
226
i = pci_swizzle_interrupt_pin (child , pin ) - 1 ;
227
+ if (!out_irq [i ].np )
228
+ continue ;
228
229
map_sz += 5 + addr_sz [i ] + out_irq [i ].args_count ;
229
230
}
230
231
}
231
232
233
+ /*
234
+ * Parsing interrupt failed for all pins. In this case, it does not
235
+ * need to generate interrupt-map property.
236
+ */
237
+ if (!map_sz )
238
+ return 0 ;
239
+
232
240
int_map = kcalloc (map_sz , sizeof (u32 ), GFP_KERNEL );
233
241
mapp = int_map ;
234
242
235
243
list_for_each_entry (child , & pdev -> subordinate -> devices , bus_list ) {
236
244
for (pin = 1 ; pin <= OF_PCI_MAX_INT_PIN ; pin ++ ) {
245
+ i = pci_swizzle_interrupt_pin (child , pin ) - 1 ;
246
+ if (!out_irq [i ].np )
247
+ continue ;
248
+
237
249
* mapp = (child -> bus -> number << 16 ) |
238
250
(child -> devfn << 8 );
239
251
mapp += OF_PCI_ADDRESS_CELLS ;
240
252
* mapp = pin ;
241
253
mapp ++ ;
242
- i = pci_swizzle_interrupt_pin (child , pin ) - 1 ;
243
254
* mapp = out_irq [i ].np -> phandle ;
244
255
mapp ++ ;
245
256
if (addr_sz [i ]) {
0 commit comments