Re: [PATCH v3 1/3] irqchip: Pass platform_device pointer to init_cb

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

 



On Thu, Dec 02, 2021 at 09:52:55AM -0800, Florian Fainelli wrote:
> On 12/2/21 4:21 AM, Shawn Guo wrote:
> > It makes sense to just pass device_node for callback in IRQCHIP_DECLARE
> > case, but not so much for IRQCHIP_PLATFORM_DRIVER one, because
> > platform_driver probe/init usually needs device pointer for various
> > purposes, e.g. resource allocation, service request, device prefixed
> > message output, etc.  Create a new callback type irqchip_init_cb_t which
> > takes platform_device pointer as parameter, and update the existing
> > IRQCHIP_PLATFORM_DRIVER users accordingly.
> > 
> > Cc: Florian Fainelli <f.fainelli@xxxxxxxxx>
> > Cc: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>
> > Cc: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
> > Signed-off-by: Shawn Guo <shawn.guo@xxxxxxxxxx>
> 
> Could you copy all recipients on all 3 patches plus your cover letter
> next time so we have the full context? Thanks!
> 
> [snip]
> 
> >  
> > -static int __init bcm7120_l2_intc_probe_7120(struct device_node *dn,
> > +static int __init bcm7120_l2_intc_probe_7120(struct platform_device *pdev,
> >  					     struct device_node *parent)
> >  {
> > -	return bcm7120_l2_intc_probe(dn, parent, bcm7120_l2_intc_iomap_7120,
> > +	return bcm7120_l2_intc_probe(pdev->dev.of_node, parent,
> > +				     bcm7120_l2_intc_iomap_7120,
> >  				     "BCM7120 L2");
> 
> If you look further into that driver, you will see that we do something
> like this in bcm7120_l2_intc_probe:
> 
>           pdev = of_find_device_by_node(dn);
>           if (!pdev) {
>                   ret = -ENODEV;
>                   goto out_free_data;
>           }
> 
> which would be completely superfluous now that we pass a platform_device
> directly. Can you rework your patch so as to eliminate that
> of_find_device_by_ndoe() (and the companion put_device call)?

Firstly, I do not see any companion put_device call in the driver.
Secondly, the existing code seems to have some problem in the "out"
order.  The out_unmap should go before out_free_l1_data, right?

@@ -329,13 +323,13 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
 
 out_free_domain:
        irq_domain_remove(data->domain);
-out_free_l1_data:
-       kfree(data->l1_data);
 out_unmap:
        for (idx = 0; idx < MAX_MAPPINGS; idx++) {
                if (data->map_base[idx])
                        iounmap(data->map_base[idx]);
        }
+out_free_l1_data:
+       kfree(data->l1_data);
 out_free_data:
        kfree(data);
        return ret;

Shawn



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux