static void uart_clps711x_shutdown(struct uart_port *port) { /* Free the interrupts */ devm_free_irq(port->dev, TX_IRQ(port), port); devm_free_irq(port->dev, RX_IRQ(port), port); /* Disable the port */ clps_writel(clps_readl(SYSCON(port)) & ~SYSCON_UARTEN, SYSCON(port)); }
static void xlgmac_free_irqs(struct xlgmac_pdata *pdata) { struct xlgmac_channel *channel; unsigned int i; devm_free_irq(pdata->dev, pdata->dev_irq, pdata); if (!pdata->per_channel_irq) return; channel = pdata->channel_head; for (i = 0; i < pdata->channel_count; i++, channel++) devm_free_irq(pdata->dev, channel->dma_irq, channel); }
static int uart_clps711x_startup(struct uart_port *port) { struct clps711x_port *s = dev_get_drvdata(port->dev); int ret; s->tx_enabled[port->line] = 1; /* Allocate the IRQs */ ret = devm_request_irq(port->dev, TX_IRQ(port), uart_clps711x_int_tx, 0, UART_CLPS711X_NAME " TX", port); if (ret) return ret; ret = devm_request_irq(port->dev, RX_IRQ(port), uart_clps711x_int_rx, 0, UART_CLPS711X_NAME " RX", port); if (ret) { devm_free_irq(port->dev, TX_IRQ(port), port); return ret; } /* Disable break */ clps_writel(clps_readl(UBRLCR(port)) & ~UBRLCR_BREAK, UBRLCR(port)); /* Enable the port */ clps_writel(clps_readl(SYSCON(port)) | SYSCON_UARTEN, SYSCON(port)); return 0; }
static int epiphany_remove(struct platform_device *pdev) { // Disable the interrupt first disable_mailbox_irq(); // Remove interrupt handler if (mailbox.irq > 0) { devm_free_irq(&pdev->dev, mailbox.irq, &mailbox); } // flush the queue flush_workqueue(irq_workqueue); // destroy the queue destroy_workqueue(irq_workqueue); #if (UseReservedMem == 0) free_pages(global_shm.kvirt_addr, get_order(global_shm.size)); #endif device_destroy(class_epiphany, MKDEV(major, 0)); cdev_del(&epiphany_cdev); return 0; }
static void amd_xgbe_phy_remove(struct phy_device *phydev) { struct amd_xgbe_phy_priv *priv = phydev->priv; struct device *dev = priv->dev; if (priv->an_irq_allocated) { devm_free_irq(dev, priv->an_irq, priv); flush_workqueue(priv->an_workqueue); destroy_workqueue(priv->an_workqueue); } /* Release resources */ devm_iounmap(dev, priv->sir1_regs); devm_release_mem_region(dev, priv->sir1_res->start, resource_size(priv->sir1_res)); devm_iounmap(dev, priv->sir0_regs); devm_release_mem_region(dev, priv->sir0_res->start, resource_size(priv->sir0_res)); devm_iounmap(dev, priv->rxtx_regs); devm_release_mem_region(dev, priv->rxtx_res->start, resource_size(priv->rxtx_res)); devm_kfree(dev, priv); }
static void sprd_shutdown(struct uart_port *port) { sprd_release_dma(port); serial_out(port, SPRD_IEN, 0); serial_out(port, SPRD_ICLR, ~0); devm_free_irq(port->dev, port->irq, port); }
static __always_inline void max14688_destroy (struct max14688 *me) { if (likely(me->irq >= 0)) { devm_free_irq(me->dev, me->irq, me); } me->sdev.name = SWITCH_NAME; switch_dev_unregister(&me->sdev); me->sdev.name = SWITCH_NAME_ADVANCED; switch_dev_unregister(&me->sdev); me->sdev.name = SWITCH_NAME_AUX; switch_dev_unregister(&me->sdev); cancel_delayed_work_sync(&me->irq_work); cancel_delayed_work_sync(&me->det_work); if (likely(me->attr_grp)) { sysfs_remove_group(me->kobj, me->attr_grp); } if (likely(me->input_dev)) { input_unregister_device(me->input_dev); input_free_device(me->input_dev); } mutex_destroy(&me->lock); devm_kfree(me->dev, me); }
int wcd9xxx_spmi_free_irq(int irq, void *priv) { devm_free_irq(&map.spmi[BIT_BYTE(irq)]->dev, map.linuxirq[irq], priv); map.mask[BIT_BYTE(irq)] |= BYTE_BIT_MASK(irq); return 0; }
/** * input_free_int - input free irq * Input: * type: * return value: 0 : success * -EIO : i/o err. */ int input_free_int(enum input_sensor_type *input_type, void *para) { int irq_number = 0; void *data = NULL; struct device *dev = NULL; switch (*input_type) { case CTP_TYPE: data = container_of(input_type, struct ctp_config_info, input_type); irq_number = gpio_to_irq(((struct ctp_config_info *)data)->int_number); dev = ((struct ctp_config_info *)data)->dev; break; case GSENSOR_TYPE: break; case LS_TYPE: data = container_of(input_type, struct sensor_config_info, input_type); irq_number = gpio_to_irq(((struct sensor_config_info *)data)->int_number); dev = ((struct sensor_config_info *)data)->dev; break; case IR_TYPE: break; default: break; } devm_free_irq(dev, irq_number, para); return 0; }
static int xlgmac_request_irqs(struct xlgmac_pdata *pdata) { struct net_device *netdev = pdata->netdev; struct xlgmac_channel *channel; unsigned int i; int ret; ret = devm_request_irq(pdata->dev, pdata->dev_irq, xlgmac_isr, IRQF_SHARED, netdev->name, pdata); if (ret) { netdev_alert(netdev, "error requesting irq %d\n", pdata->dev_irq); return ret; } if (!pdata->per_channel_irq) return 0; channel = pdata->channel_head; for (i = 0; i < pdata->channel_count; i++, channel++) { snprintf(channel->dma_irq_name, sizeof(channel->dma_irq_name) - 1, "%s-TxRx-%u", netdev_name(netdev), channel->queue_index); ret = devm_request_irq(pdata->dev, channel->dma_irq, xlgmac_dma_isr, 0, channel->dma_irq_name, channel); if (ret) { netdev_alert(netdev, "error requesting irq %d\n", channel->dma_irq); goto err_irq; } } return 0; err_irq: /* Using an unsigned int, 'i' will go to UINT_MAX and exit */ for (i--, channel--; i < pdata->channel_count; i--, channel--) devm_free_irq(pdata->dev, channel->dma_irq, channel); devm_free_irq(pdata->dev, pdata->dev_irq, pdata); return ret; }
int mc13xxx_irq_free(struct mc13xxx *mc13xxx, int irq, void *dev) { int virq = regmap_irq_get_virq(mc13xxx->irq_data, irq); devm_free_irq(mc13xxx->dev, virq, dev); return 0; }
static int twl6040_remove(struct i2c_client *client) { struct twl6040 *twl6040 = i2c_get_clientdata(client); if (twl6040->power_count) twl6040_power(twl6040, 0); devm_free_irq(&client->dev, twl6040->irq_ready, twl6040); devm_free_irq(&client->dev, twl6040->irq_th, twl6040); regmap_del_irq_chip(twl6040->irq, twl6040->irq_data); mfd_remove_devices(&client->dev); i2c_set_clientdata(client, NULL); regulator_bulk_disable(TWL6040_NUM_SUPPLIES, twl6040->supplies); return 0; }
static void mmp_tdma_free_chan_resources(struct dma_chan *chan) { struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan); if (tdmac->irq) devm_free_irq(tdmac->dev, tdmac->irq, tdmac); mmp_tdma_free_descriptor(tdmac); return; }
static int tps65090_charger_remove(struct platform_device *pdev) { struct tps65090_charger *cdata = dev_get_drvdata(&pdev->dev); devm_free_irq(cdata->dev, cdata->irq, cdata); power_supply_unregister(&cdata->ac); return 0; }
/* * Tear down interrupt for a given DPRC object */ static void dprc_teardown_irq(struct fsl_mc_device *mc_dev) { struct fsl_mc_device_irq *irq = mc_dev->irqs[0]; (void)disable_dprc_irq(mc_dev); devm_free_irq(&mc_dev->dev, irq->msi_desc->irq, &mc_dev->dev); fsl_mc_free_irqs(mc_dev); }
static int isci_setup_interrupts(struct pci_dev *pdev) { int err, i, num_msix; struct isci_host *ihost; struct isci_pci_info *pci_info = to_pci_info(pdev); /* * Determine the number of vectors associated with this * PCI function. */ num_msix = num_controllers(pdev) * SCI_NUM_MSI_X_INT; for (i = 0; i < num_msix; i++) pci_info->msix_entries[i].entry = i; err = pci_enable_msix_exact(pdev, pci_info->msix_entries, num_msix); if (err) goto intx; for (i = 0; i < num_msix; i++) { int id = i / SCI_NUM_MSI_X_INT; struct msix_entry *msix = &pci_info->msix_entries[i]; irq_handler_t isr; ihost = pci_info->hosts[id]; /* odd numbered vectors are error interrupts */ if (i & 1) isr = isci_error_isr; else isr = isci_msix_isr; err = devm_request_irq(&pdev->dev, msix->vector, isr, 0, DRV_NAME"-msix", ihost); if (!err) continue; dev_info(&pdev->dev, "msix setup failed falling back to intx\n"); while (i--) { id = i / SCI_NUM_MSI_X_INT; ihost = pci_info->hosts[id]; msix = &pci_info->msix_entries[i]; devm_free_irq(&pdev->dev, msix->vector, ihost); } pci_disable_msix(pdev); goto intx; } return 0; intx: for_each_isci_host(i, ihost, pdev) { err = devm_request_irq(&pdev->dev, pdev->irq, isci_intx_isr, IRQF_SHARED, DRV_NAME"-intx", ihost); if (err) break; }
static void slimpro_mbox_shutdown(struct mbox_chan *chan) { struct slimpro_mbox_chan *mb_chan = chan->con_priv; u32 val; /* Mask doorbell status interrupt */ val = readl(mb_chan->reg + REG_DB_STATMASK); val |= (MBOX_STATUS_ACK_MASK | MBOX_STATUS_AVAIL_MASK); writel(val, mb_chan->reg + REG_DB_STATMASK); devm_free_irq(mb_chan->dev, mb_chan->irq, mb_chan); }
static int nrf905_remove(struct spi_device *spi) { dev_info(&spi->dev, "remove\n"); devm_free_irq(nrf905_dev->char_dev, nrf905_dev->chip.dataready_irq, nrf905_dev); nrf905_gpio_release(nrf905_dev); return 0; }
void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios) { enum mctrl_gpio_idx i; for (i = 0; i < UART_GPIO_MAX; i++) { if (gpios->irq[i]) devm_free_irq(gpios->port->dev, gpios->irq[i], gpios); if (gpios->gpio[i]) devm_gpiod_put(dev, gpios->gpio[i]); } devm_kfree(dev, gpios); }
static int rsnd_ssi_dma_remove(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); struct device *dev = rsnd_priv_to_dev(priv); int irq = ssi->irq; /* PIO will request IRQ again */ devm_free_irq(dev, irq, mod); return 0; }
static int bq24735_charger_remove(struct i2c_client *client) { struct bq24735 *charger = i2c_get_clientdata(client); if (charger->client->irq) devm_free_irq(&charger->client->dev, charger->client->irq, &charger->charger); power_supply_unregister(charger->charger); if (charger->charger_desc.name != charger->pdata->name) kfree(charger->charger_desc.name); return 0; }
static int ds1305_remove(struct spi_device *spi) { struct ds1305 *ds1305 = spi_get_drvdata(spi); sysfs_remove_bin_file(&spi->dev.kobj, &nvram); /* carefully shut down irq and workqueue, if present */ if (spi->irq) { set_bit(FLAG_EXITING, &ds1305->flags); devm_free_irq(&spi->dev, spi->irq, ds1305); cancel_work_sync(&ds1305->work); } return 0; }
static int nrf905_probe(struct spi_device *spi) { int retval = 0; dev_info(&spi->dev, "probe\n"); retval = spi_setup(spi); if (retval < 0) { dev_err(&spi->dev, "Can not setup spi device\n"); retval = -ENODEV; goto err; } spi_set_drvdata(spi, nrf905_dev); nrf905_dev->spi_dev = spi; retval = nrf905_gpio_config(nrf905_dev); if (retval < 0) goto err; retval = devm_request_irq( nrf905_dev->char_dev, nrf905_dev->chip.dataready_irq, nrf905_dr_irq, IRQF_TRIGGER_RISING, "nrf905", nrf905_dev); if (retval < 0) { dev_err(&spi->dev, "Irq request failed\n"); goto err_irq; } retval = nrf905_init_chip(nrf905_dev); if (retval < 0) goto err_init_chip; return retval; err_init_chip: devm_free_irq(nrf905_dev->char_dev, nrf905_dev->chip.dataready_irq, nrf905_dev); err_irq: nrf905_gpio_release(nrf905_dev); err: return retval; }
/** * mmc_gpiod_free_cd - free the card-detection gpio descriptor * @host: mmc host * * It's provided only for cases that client drivers need to manually free * up the card-detection gpio requested by mmc_gpiod_request_cd(). */ void mmc_gpiod_free_cd(struct mmc_host *host) { struct mmc_gpio *ctx = host->slot.handler_priv; if (!ctx || !ctx->cd_gpio) return; if (host->slot.cd_irq >= 0) { devm_free_irq(&host->class_dev, host->slot.cd_irq, host); host->slot.cd_irq = -EINVAL; } devm_gpiod_put(&host->class_dev, ctx->cd_gpio); ctx->cd_gpio = NULL; }
static void xgbe_phy_stop(struct xgbe_prv_data *pdata) { netif_dbg(pdata, link, pdata->netdev, "stopping PHY\n"); /* Disable auto-negotiation */ xgbe_disable_an(pdata); /* Disable auto-negotiation interrupts */ XMDIO_WRITE(pdata, MDIO_MMD_AN, MDIO_AN_INTMASK, 0); devm_free_irq(pdata->dev, pdata->an_irq, pdata); pdata->phy.link = 0; netif_carrier_off(pdata->netdev); xgbe_phy_adjust_link(pdata); }
/** * mmc_gpio_free_cd - free the card-detection gpio * @host: mmc host * * It's provided only for cases that client drivers need to manually free * up the card-detection gpio requested by mmc_gpio_request_cd(). */ void mmc_gpio_free_cd(struct mmc_host *host) { struct mmc_gpio *ctx = host->slot.handler_priv; int gpio; if (!ctx || !gpio_is_valid(ctx->cd_gpio)) return; if (host->slot.cd_irq >= 0) { devm_free_irq(&host->class_dev, host->slot.cd_irq, host); host->slot.cd_irq = -EINVAL; } gpio = ctx->cd_gpio; ctx->cd_gpio = -EINVAL; devm_gpio_free(&host->class_dev, gpio); }
static int ds1343_remove(struct spi_device *spi) { struct ds1343_priv *priv = spi_get_drvdata(spi); if (spi->irq) { mutex_lock(&priv->mutex); priv->irqen &= ~RTC_AF; mutex_unlock(&priv->mutex); devm_free_irq(&spi->dev, spi->irq, priv); } spi_set_drvdata(spi, NULL); ds1343_sysfs_unregister(&spi->dev); return 0; }
static int xgbe_phy_start(struct xgbe_prv_data *pdata) { struct net_device *netdev = pdata->netdev; int ret; netif_dbg(pdata, link, pdata->netdev, "starting PHY\n"); ret = devm_request_irq(pdata->dev, pdata->an_irq, xgbe_an_isr, 0, pdata->an_name, pdata); if (ret) { netdev_err(netdev, "phy irq request failed\n"); return ret; } /* Set initial mode - call the mode setting routines * directly to insure we are properly configured */ if (xgbe_use_xgmii_mode(pdata)) { xgbe_xgmii_mode(pdata); } else if (xgbe_use_gmii_mode(pdata)) { xgbe_gmii_mode(pdata); } else if (xgbe_use_gmii_2500_mode(pdata)) { xgbe_gmii_2500_mode(pdata); } else { ret = -EINVAL; goto err_irq; } /* Set up advertisement registers based on current settings */ xgbe_an_init(pdata); /* Enable auto-negotiation interrupts */ XMDIO_WRITE(pdata, MDIO_MMD_AN, MDIO_AN_INTMASK, 0x07); return xgbe_phy_config_aneg(pdata); err_irq: devm_free_irq(pdata->dev, pdata->an_irq, pdata); return ret; }
/* * fd_device_remove - Fd device remove method. * @pdev: Pointer fd platform device. */ static int fd_device_remove(struct platform_device *pdev) { struct msm_fd_device *fd; fd = platform_get_drvdata(pdev); if (NULL == fd) { dev_err(&pdev->dev, "Can not get fd drvdata\n"); return 0; } video_unregister_device(&fd->video); destroy_workqueue(fd->work_queue); v4l2_device_unregister(&fd->v4l2_dev); devm_free_irq(&pdev->dev, fd->irq_num, fd); msm_fd_hw_put_iommu(fd); msm_fd_hw_put_clocks(fd); regulator_put(fd->vdd); msm_fd_hw_release_mem_resources(fd); kfree(fd); return 0; }
static int bcm63xx_spi_remove(struct platform_device *pdev) { bcm_mpi_dev_data_t *bs = platform_get_drvdata(pdev); bcm_pr_debug("%s()\n", __func__); bcm_assert(1 == bs->ref_count); /* reset spi block */ bcm_spi_writeb(bs, 0, SPI_INT_MASK); /* HW shutdown */ clk_disable(bs->clk); devm_free_irq(&(pdev->dev), bs->irq, bs); devm_iounmap(&(pdev->dev), bs->regs); devm_release_mem_region(&(pdev->dev), bs->res_start, bs->res_size); platform_set_drvdata(pdev, NULL); clk_put(bs->clk); bs->ref_count = 0; return (0); }