/* * 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); 1e7a682'>diff
diff options
context:
space:
mode:
authorNicolae Rosia <Nicolae_Rosia@mentor.com>2016-11-12 14:42:14 +0200
committerMark Brown <broonie@kernel.org>2016-11-16 18:03:39 +0000
commitdab780a3b489b038a47d8fbbc49c33aae1e7a682 (patch)
treec9599a6970c187f95f7875d2a3e948f05cef1e45 /include/dt-bindings/clk
parent1001354ca34179f3db924eb66672442a173147dc (diff)
regulator: twl-regulator: rework fixed regulator definition
TWL603X and TWL4030 are different and have different code logic. Rework the regulator definition method so we can split the file easily in twl4030 and twl6030. Signed-off-by: Nicolae Rosia <Nicolae_Rosia@mentor.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/dt-bindings/clk')