本文整理汇总了C++中device_release_driver函数的典型用法代码示例。如果您正苦于以下问题:C++ device_release_driver函数的具体用法?C++ device_release_driver怎么用?C++ device_release_driver使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了device_release_driver函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: brcmf_fw_request_code_done
static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx)
{
struct brcmf_fw *fwctx = ctx;
int ret;
brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev));
if (!fw)
goto fail;
/* only requested code so done here */
if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
fwctx->done(fwctx->dev, fw, NULL, 0);
kfree(fwctx);
return;
}
fwctx->code = fw;
ret = request_firmware_nowait(THIS_MODULE, true, fwctx->nvram_name,
fwctx->dev, GFP_KERNEL, fwctx,
brcmf_fw_request_nvram_done);
if (!ret)
return;
brcmf_fw_request_nvram_done(NULL, fwctx);
return;
fail:
brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
device_release_driver(fwctx->dev);
kfree(fwctx);
}
示例2: ar9170_usb_firmware_failed
static void ar9170_usb_firmware_failed(struct ar9170_usb *aru)
{
struct device *parent = aru->udev->dev.parent;
struct usb_device *udev;
/*
* Store a copy of the usb_device pointer locally.
* This is because device_release_driver initiates
* ar9170_usb_disconnect, which in turn frees our
* driver context (aru).
*/
udev = aru->udev;
complete(&aru->firmware_loading_complete);
/* unbind anything failed */
if (parent)
down(&parent->sem);
device_release_driver(&udev->dev);
if (parent)
up(&parent->sem);
usb_put_dev(udev);
}
示例3: bus_remove_device
/**
* bus_remove_device - remove device from bus
* @dev: device to be removed
*
* - Remove device from all interfaces.
* - Remove symlink from bus' directory.
* - Delete device from bus's list.
* - Detach from its driver.
* - Drop reference taken in bus_add_device().
*/
void bus_remove_device(struct device *dev)
{
struct bus_type *bus = dev->bus;
struct subsys_interface *sif;
if (!bus)
return;
mutex_lock(&bus->p->mutex);
list_for_each_entry(sif, &bus->p->interfaces, node)
if (sif->remove_dev)
sif->remove_dev(dev, sif);
mutex_unlock(&bus->p->mutex);
sysfs_remove_link(&dev->kobj, "subsystem");
sysfs_remove_link(&dev->bus->p->devices_kset->kobj,
dev_name(dev));
device_remove_attrs(dev->bus, dev);
if (klist_node_attached(&dev->p->knode_bus))
klist_del(&dev->p->knode_bus);
pr_debug("bus: '%s': remove device %s\n",
dev->bus->name, dev_name(dev));
device_release_driver(dev);
bus_put(dev->bus);
}
示例4: brcmf_pcie_setup
static void brcmf_pcie_setup(struct device *dev, const struct firmware *fw,
void *nvram, u32 nvram_len)
{
struct brcmf_bus *bus = dev_get_drvdata(dev);
struct brcmf_pciedev *pcie_bus_dev = bus->bus_priv.pcie;
struct brcmf_pciedev_info *devinfo = pcie_bus_dev->devinfo;
struct brcmf_commonring **flowrings;
int ret;
u32 i;
brcmf_pcie_attach(devinfo);
ret = brcmf_pcie_download_fw_nvram(devinfo, fw, nvram, nvram_len);
if (ret)
goto fail;
devinfo->state = BRCMFMAC_PCIE_STATE_UP;
ret = brcmf_pcie_init_ringbuffers(devinfo);
if (ret)
goto fail;
ret = brcmf_pcie_init_scratchbuffers(devinfo);
if (ret)
goto fail;
brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
ret = brcmf_pcie_request_irq(devinfo);
if (ret)
goto fail;
/* hook the commonrings in the bus structure. */
for (i = 0; i < BRCMF_NROF_COMMON_MSGRINGS; i++)
bus->msgbuf->commonrings[i] =
&devinfo->shared.commonrings[i]->commonring;
flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(flowrings),
GFP_KERNEL);
if (!flowrings)
goto fail;
for (i = 0; i < devinfo->shared.nrof_flowrings; i++)
flowrings[i] = &devinfo->shared.flowrings[i].commonring;
bus->msgbuf->flowrings = flowrings;
bus->msgbuf->rx_dataoffset = devinfo->shared.rx_dataoffset;
bus->msgbuf->max_rxbufpost = devinfo->shared.max_rxbufpost;
bus->msgbuf->nrof_flowrings = devinfo->shared.nrof_flowrings;
init_waitqueue_head(&devinfo->mbdata_resp_wait);
brcmf_pcie_intr_enable(devinfo);
if (brcmf_pcie_attach_bus(bus->dev) == 0)
return;
brcmf_pcie_bus_console_read(devinfo);
fail:
device_release_driver(dev);
}
示例5: carl9170_usb_firmware_failed
static void carl9170_usb_firmware_failed(struct ar9170 *ar)
{
struct device *parent = ar->udev->dev.parent;
struct usb_device *udev;
/*
* Store a copy of the usb_device pointer locally.
* This is because device_release_driver initiates
* carl9170_usb_disconnect, which in turn frees our
* driver context (ar).
*/
udev = ar->udev;
complete(&ar->fw_load_wait);
/* unbind anything failed */
if (parent)
device_lock(parent);
device_release_driver(&udev->dev);
if (parent)
device_unlock(parent);
usb_put_dev(udev);
}
示例6: device_reprobe
/**
* device_reprobe - remove driver for a device and probe for a new driver
* @dev: the device to reprobe
*
* This function detaches the attached driver (if any) for the given
* device and restarts the driver probing process. It is intended
* to use if probing criteria changed during a devices lifetime and
* driver attachment should change accordingly.
*/
int device_reprobe(struct device *dev)
{
if (dev->driver) {
if (dev->parent) /* Needed for USB */
down(&dev->parent->sem);
device_release_driver(dev);
if (dev->parent)
up(&dev->parent->sem);
}
return bus_rescan_devices_helper(dev, NULL);
}
示例7: phy_detach
/**
* phy_detach - detach a PHY device from its network device
* @phydev: target phy_device struct
*/
void phy_detach(struct phy_device *phydev)
{
phydev->attached_dev = NULL;
/* If the device had no specific driver before (i.e. - it
* was using the generic driver), we unbind the device
* from the generic driver so that there's a chance a
* real driver could be loaded */
if (phydev->dev.driver == &genphy_driver.driver)
device_release_driver(&phydev->dev);
}
示例8: bus_remove_device
/**
* bus_remove_device - remove device from bus
* @dev: device to be removed
*
* - Remove symlink from bus's directory.
* - Delete device from bus's list.
* - Detach from its driver.
* - Drop reference taken in bus_add_device().
*/
void bus_remove_device(struct device * dev)
{
if (dev->bus) {
sysfs_remove_link(&dev->kobj, "bus");
sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
device_remove_attrs(dev->bus, dev);
klist_remove(&dev->knode_bus);
pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id);
device_release_driver(dev);
put_bus(dev->bus);
}
}
示例9: p54p_firmware_step2
static void p54p_firmware_step2(const struct firmware *fw,
void *context)
{
struct p54p_priv *priv = context;
struct ieee80211_hw *dev = priv->common.hw;
struct pci_dev *pdev = priv->pdev;
int err;
if (!fw) {
dev_err(&pdev->dev, "Cannot find firmware (isl3886pci)\n");
err = -ENOENT;
goto out;
}
priv->firmware = fw;
err = p54p_open(dev);
if (err)
goto out;
err = p54_read_eeprom(dev);
p54p_stop(dev);
if (err)
goto out;
err = p54_register_common(dev, &pdev->dev);
if (err)
goto out;
out:
complete(&priv->fw_loaded);
if (err) {
struct device *parent = pdev->dev.parent;
if (parent)
device_lock(parent);
/*
* This will indirectly result in a call to p54p_remove.
* Hence, we don't need to bother with freeing any
* allocated ressources at all.
*/
device_release_driver(&pdev->dev);
if (parent)
device_unlock(parent);
}
pci_dev_put(pdev);
}
示例10: pci_stop_dev
static void pci_stop_dev(struct pci_dev *dev)
{
pci_pme_active(dev, false);
if (dev->is_added) {
pci_proc_detach_device(dev);
pci_remove_sysfs_dev_files(dev);
device_release_driver(&dev->dev);
dev->is_added = 0;
}
if (dev->bus->self)
pcie_aspm_exit_link_state(dev);
}
示例11: umc_bus_pre_reset_helper
static int umc_bus_pre_reset_helper(struct device *dev, void *data)
{
int ret = 0;
if (dev->driver) {
struct umc_dev *umc = to_umc_dev(dev);
struct umc_driver *umc_drv = to_umc_driver(dev->driver);
if (umc_drv->pre_reset)
ret = umc_drv->pre_reset(umc);
else
device_release_driver(dev);
}
return ret;
}
示例12: ar9170_usb_firmware_failed
static void ar9170_usb_firmware_failed(struct ar9170_usb *aru)
{
struct device *parent = aru->udev->dev.parent;
complete(&aru->firmware_loading_complete);
/* unbind anything failed */
if (parent)
device_lock(parent);
device_release_driver(&aru->udev->dev);
if (parent)
device_unlock(parent);
usb_put_dev(aru->udev);
}
示例13: pci_stop_root_bus
void pci_stop_root_bus(struct pci_bus *bus)
{
struct pci_dev *child, *tmp;
struct pci_host_bridge *host_bridge;
if (!pci_is_root_bus(bus))
return;
host_bridge = to_pci_host_bridge(bus->bridge);
list_for_each_entry_safe_reverse(child, tmp,
&bus->devices, bus_list)
pci_stop_bus_device(child);
/* stop the host bridge */
device_release_driver(&host_bridge->dev);
}
示例14: bus_remove_device
/**
* bus_remove_device - remove device from bus
* @dev: device to be removed
*
* - Remove symlink from bus's directory.
* - Delete device from bus's list.
* - Detach from its driver.
* - Drop reference taken in bus_add_device().
*/
void bus_remove_device(struct device * dev)
{
if (dev->bus) {
sysfs_remove_link(&dev->kobj, "subsystem");
remove_deprecated_bus_links(dev);
sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
device_remove_attrs(dev->bus, dev);
if (dev->is_registered) {
dev->is_registered = 0;
klist_del(&dev->knode_bus);
}
pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id);
device_release_driver(dev);
put_bus(dev->bus);
}
}
示例15: bus_remove_device
/**
* bus_remove_device - remove device from bus
* @dev: device to be removed
*
* - Remove symlink from bus's directory.
* - Delete device from bus's list.
* - Detach from its driver.
* - Drop reference taken in bus_add_device().
*/
void bus_remove_device(struct device *dev)
{
if (dev->bus) {
sysfs_remove_link(&dev->kobj, "subsystem");
sysfs_remove_link(&dev->bus->p->devices_kset->kobj,
dev_name(dev));
device_remove_attrs(dev->bus, dev);
if (klist_node_attached(&dev->p->knode_bus))
klist_del(&dev->p->knode_bus);
pr_debug("bus: '%s': remove device %s\n",
dev->bus->name, dev_name(dev));
device_release_driver(dev);
bus_put(dev->bus);
}
}