/* * UWB Multi-interface Controller device management. * * Copyright (C) 2007 Cambridge Silicon Radio Ltd. * * This file is released under the GNU GPL v2. */ #include #include #include #include static void umc_device_release(struct device *dev) { struct umc_dev *umc = to_umc_dev(dev); kfree(umc); } /** * umc_device_create - allocate a child UMC device * @parent: parent of the new UMC device. * @n: index of the new device. * * The new UMC device will have a bus ID of the parent with '-n' * appended. */ struct umc_dev *umc_device_create(struct device *parent, int n) { struct umc_dev *umc; umc = kzalloc(sizeof(struct umc_dev), GFP_KERNEL); if (umc) { dev_set_name(&umc->dev, "%s-%d", dev_name(parent), n); umc->dev.parent = parent; umc->dev.bus = &umc_bus_type; umc->dev.release = umc_device_release; umc->dev.dma_mask = parent->dma_mask; } return umc; } EXPORT_SYMBOL_GPL(umc_device_create); /** * umc_device_register - register a UMC device * @umc: pointer to the UMC device * * The memory resource for the UMC device is acquired and the device * registered with the system. */ int umc_device_register(struct umc_dev *umc) { int err; err = request_resource(umc->resource.parent, &umc->resource); if (err < 0) { dev_err(&umc->dev, "can't allocate resource range %pR: %d\n", &umc->resource, err); goto error_request_resource; } err = device_register(&umc->dev); if (err < 0) goto error_device_register; return 0; error_device_register: put_device(&umc->dev); release_resource(&umc->resource); error_request_resource: return err; } EXPORT_SYMBOL_GPL(umc_device_register); /** * umc_device_unregister - unregister a UMC device * @umc: pointer to the UMC device * * First we unregister the device, make sure the driver can do it's * resource release thing and then we try to release any left over * resources. We take a ref to the device, to make sure it doesn't * disappear under our feet. */ void umc_device_unregister(struct umc_dev *umc) { struct device *dev; if (!umc) return; dev = get_device(&umc->dev); device_unregister(&umc->dev); release_resource(&umc->resource); put_device(dev); } EXPORT_SYMBOL_GPL(umc_device_unregister); e='396bf4cd835e62d70fad4a03a8963e61f19021f2'/>
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-06 14:16:23 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-06 14:16:23 -0800
commit396bf4cd835e62d70fad4a03a8963e61f19021f2 (patch)
tree79ac8f33554260fea1a8d43e6f8c4c5460115f45 /net/atm/protocols.h
parentd5adbfcd5f7bcc6fa58a41c5c5ada0e5c826ce2c (diff)
parent7c2cf1c4615cc2f576d0604406cdf0065f00b83b (diff)
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: - use-after-free in algif_aead - modular aesni regression when pcbc is modular but absent - bug causing IO page faults in ccp - double list add in ccp - NULL pointer dereference in qat (two patches) - panic in chcr - NULL pointer dereference in chcr - out-of-bound access in chcr * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: chcr - Fix key length for RFC4106 crypto: algif_aead - Fix kernel panic on list_del crypto: aesni - Fix failure when pcbc module is absent crypto: ccp - Fix double add when creating new DMA command crypto: ccp - Fix DMA operations when IOMMU is enabled crypto: chcr - Check device is allocated before use crypto: chcr - Fix panic on dma_unmap_sg crypto: qat - zero esram only for DH85x devices crypto: qat - fix bar discovery for c62x
Diffstat (limited to 'net/atm/protocols.h')