/** * nci_free_device - deallocate nci device * * @ndev: The nci device to deallocate */ void nci_free_device(struct nci_dev *ndev) { nfc_dbg("entry"); nfc_free_device(ndev->nfc_dev); kfree(ndev); }
static void nfcsim_free_device(struct nfcsim *dev) { nfc_unregister_device(dev->nfc_dev); nfc_free_device(dev->nfc_dev); kfree(dev); }
static struct nfcsim *nfcsim_init_dev(void) { struct nfcsim *dev; int rc = -ENOMEM; dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (dev == NULL) return ERR_PTR(-ENOMEM); mutex_init(&dev->lock); INIT_DELAYED_WORK(&dev->recv_work, nfcsim_wq_recv); INIT_DELAYED_WORK(&dev->poll_work, nfcsim_wq_poll); dev->nfc_dev = nfc_allocate_device(&nfcsim_nfc_ops, NFC_PROTO_NFC_DEP_MASK, 0, 0); if (!dev->nfc_dev) goto error; nfc_set_drvdata(dev->nfc_dev, dev); rc = nfc_register_device(dev->nfc_dev); if (rc) goto free_nfc_dev; return dev; free_nfc_dev: nfc_free_device(dev->nfc_dev); error: kfree(dev); return ERR_PTR(rc); }
/** * nci_free_device - deallocate nci device * * @ndev: The nci device to deallocate */ void nci_free_device(struct nci_dev *ndev) { nfc_free_device(ndev->nfc_dev); kfree(ndev); }