[PATCH 2/2] irqchip: Add Xilinx Versal NET SMMU CSR interrupt controller driver

Tushar Nimkar tunimkar at amd.com
Mon Aug 31 04:32:07 PDT 2026


Hi Thomas,

>>> +{
>>> +     struct xilinx_smmu_csr *csr;
>>> +     int ret;
>>> +
>>> +     if (WARN_ON_ONCE(!parent))
>>> +             return -EINVAL;
>>> +
>>> +     if (irq_find_matching_fwnode(of_fwnode_handle(node),
>>> +                                  DOMAIN_BUS_ANY))
>>> +             return -ENODEV;
>>> +
>>> +     csr = kzalloc(sizeof(*csr), GFP_KERNEL);
>> devm_kzalloc()
> okay
>>
>>> +     if (!csr)
>>> +             return -ENOMEM;
>>> +
>>> +     raw_spin_lock_init(&csr->lock);
>>> +
>>> +     csr->base = of_iomap(node, 0);
>> devm_of_iomap()
> okay
>>
I realized later and thought to get a clarification on 
devm_kzalloc()/devm_of_iomap() -  both need a struct device *, but this 
driver registers via IRQCHIP_DECLARE, so xilinx_smmu_csr_init() is 
called from of_irq_init() during early boot — there's no bound struct 
device at that point. AFAIK - If I get device from 
of_find_device_by_node() it might return NULL since of_irq_init() time 
the platform bus isn't populated yet.
So I think we should keep using kzalloc()/of_iomap() -  what do you think?

Thanks,
Tushar Nimkar





More information about the linux-arm-kernel mailing list