Analysis of free_irq and apifree_irq For APIs interrupted by mobile development
Const void * free_irq (unsigned int irq, void * dev_id) is used to release a previously interrupted request by request_irq. static intel3_close (struct net_device * dev) {int ioaddr = dev-> base_addr; struct el3_private * lp = netdev_priv (dev); if (el3_debug> 2) pr_debug ("% s: shutting down ethercard. \ n ", dev-> name); el3_down (dev); free_irq (dev-> irq, dev);} under normal circumstances, free_irq is generally used as a cleaning function or an exception case. the source code analysis is as follows: const void * free_irq (unsigned int irq, void * dev_id) {# through ir Q_to_desc get the Interrupt Descriptor struct irq_desc * desc = irq_to_desc (irq); struct irqaction * action; const char * devname; # if the Interrupt Descriptor is null or the member variable status_use_accessors of the Interrupt Descriptor contains _ IRQ_PER_CPU_DEVID; then exit} if (! Desc | WARN_ON (irq_settings_is_per_cpu_devid (desc) return NULL; # ifdef CONFIG_SMPif (WARN_ON (desc-> affinity_policy) desc-> affinity_policy = NULL; # endif # action = _ free_irq (irq, dev_id); # exit if (! Action) return NULL; # obtain the namedevname = action-> name; # Release the space occupied by the interrupt handler and return devnamekfree (action); return devname ;}