Esempio n. 1
0
/**
* intel_sst_remove - PCI remove function
*
* @pci:	PCI device structure
*
* This function is called by OS when a device is unloaded
* This frees the interrupt etc
*/
static void __devexit intel_sst_remove(struct pci_dev *pci)
{
	pm_runtime_get_noresume(&pci->dev);
	pm_runtime_forbid(&pci->dev);
	pci_dev_put(sst_drv_ctx->pci);
	mutex_lock(&sst_drv_ctx->sst_lock);
	sst_drv_ctx->sst_state = SST_UN_INIT;
	mutex_unlock(&sst_drv_ctx->sst_lock);
	misc_deregister(&lpe_ctrl);
	free_irq(pci->irq, sst_drv_ctx);
	iounmap(sst_drv_ctx->dram);
	iounmap(sst_drv_ctx->iram);
	iounmap(sst_drv_ctx->mailbox);
	iounmap(sst_drv_ctx->shim);
	sst_drv_ctx->pmic_state = SND_MAD_UN_INIT;
	if (sst_drv_ctx->pci_id == SST_MRST_PCI_ID) {
		misc_deregister(&lpe_dev);
		kfree(sst_drv_ctx->mmap_mem);
	} else
		kfree(sst_drv_ctx->fw_cntx);
	flush_scheduled_work();
	destroy_workqueue(sst_drv_ctx->process_reply_wq);
	destroy_workqueue(sst_drv_ctx->process_msg_wq);
	destroy_workqueue(sst_drv_ctx->post_msg_wq);
	destroy_workqueue(sst_drv_ctx->mad_wq);
	kfree(pci_get_drvdata(pci));
	sst_drv_ctx = NULL;
	pci_release_regions(pci);
	pci_disable_device(pci);
	pci_set_drvdata(pci, NULL);
}
Esempio n. 2
0
File: pm.c Progetto: avagin/linux
void wil_pm_runtime_forbid(struct wil6210_priv *wil)
{
	struct device *dev = wil_to_dev(wil);

	pm_runtime_forbid(dev);
	pm_runtime_get_noresume(dev);
}
Esempio n. 3
0
int smdhsic_reset_resume(struct usb_interface *intf)
{
	unsigned int devid;
	struct str_intf_priv *intfpriv;
	struct device *dev = &g_usbdev.usbdev->dev;

	pr_debug("%s: Called\n", __func__);

	if (!g_usbdev.suspended)
		return 0;

	intfpriv = usb_get_intfdata(intf);
	devid = GET_DEVID(intfpriv->devid);

	if (!usb_runtime_pm_ap_initiated_L2 &&
		atomic_read(&dev->power.usage_count) == 1)
		pm_runtime_get_noresume(dev);

	smdhsic_resume(intf);

	if (devid == CMD_DEV_ID) {
		g_usbdev.hsic->dpm_suspending = false;
		pr_debug("%s : dpm suspending set to false\n", __func__);
	}

	return 0;
}
static void xhci_ush_pci_remove(struct pci_dev *dev)
{
	struct xhci_hcd *xhci;

	xhci = hcd_to_xhci(pci_get_drvdata(dev));
	if (xhci->shared_hcd) {
		usb_remove_hcd(xhci->shared_hcd);
		usb_put_hcd(xhci->shared_hcd);
	}

	if (!pci_dev_run_wake(dev))
		pm_runtime_get_noresume(&dev->dev);

	pm_runtime_forbid(&dev->dev);

	usb_hcd_pci_remove(dev);

	/* Free the aux irq */
	hsic_aux_irq_free();
	hsic_wakeup_irq_free();
	gpio_free(hsic.aux_gpio);
	gpio_free(hsic.wakeup_gpio);

	hsic.port_disconnect = 1;
	hsic_enable = 0;
	wake_lock_destroy(&(hsic.resume_wake_lock));
	wake_lock_destroy(&hsic.s3_wake_lock);
	usb_unregister_notify(&hsic.hsic_pm_nb);
	unregister_pm_notifier(&hsic.hsic_s3_entry_nb);

	kfree(xhci);
}
static int cyttsp4_btn_release(struct cyttsp4_device *ttsp)
{
	struct device *dev = &ttsp->dev;
	struct cyttsp4_btn_data *bd = dev_get_drvdata(dev);

	dev_dbg(dev, "%s\n", __func__);

#ifdef CONFIG_HAS_EARLYSUSPEND
	/*
	 * This check is to prevent pm_runtime usage_count drop below zero
	 * because of removing the module while in suspended state
	 */
	if (bd->is_suspended)
		pm_runtime_get_noresume(dev);

	unregister_early_suspend(&bd->es);
#endif

	if (bd->input_device_registered) {
		input_unregister_device(bd->input);
	} else {
		input_free_device(bd->input);
		cyttsp4_unsubscribe_attention(ttsp, CY_ATTEN_STARTUP,
			cyttsp4_setup_input_attention, 0);
	}

	pm_runtime_suspend(dev);
	pm_runtime_disable(dev);

	dev_set_drvdata(dev, NULL);
	kfree(bd);
	return 0;
}
Esempio n. 6
0
/*
 * These are the device model conversion veneers; they convert the
 * device model structures to our more specific structures.
 */
static int amba_probe(struct device *dev)
{
    struct amba_device *pcdev = to_amba_device(dev);
    struct amba_driver *pcdrv = to_amba_driver(dev->driver);
    const struct amba_id *id = amba_lookup(pcdrv->id_table, pcdev);
    int ret;

    do {
        ret = amba_get_enable_pclk(pcdev);
        if (ret)
            break;

        pm_runtime_get_noresume(dev);
        pm_runtime_set_active(dev);
        pm_runtime_enable(dev);

        ret = pcdrv->probe(pcdev, id);
        if (ret == 0)
            break;

        pm_runtime_disable(dev);
        pm_runtime_set_suspended(dev);
        pm_runtime_put_noidle(dev);

        amba_put_disable_pclk(pcdev);
    } while (0);

    return ret;
}
Esempio n. 7
0
static int dw_mci_rockchip_probe(struct platform_device *pdev)
{
	const struct dw_mci_drv_data *drv_data;
	const struct of_device_id *match;
	int ret;

	if (!pdev->dev.of_node)
		return -ENODEV;

	match = of_match_node(dw_mci_rockchip_match, pdev->dev.of_node);
	drv_data = match->data;

	pm_runtime_get_noresume(&pdev->dev);
	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);
	pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
	pm_runtime_use_autosuspend(&pdev->dev);

	ret = dw_mci_pltfm_register(pdev, drv_data);
	if (ret) {
		pm_runtime_disable(&pdev->dev);
		pm_runtime_set_suspended(&pdev->dev);
		pm_runtime_put_noidle(&pdev->dev);
		return ret;
	}

	pm_runtime_put_autosuspend(&pdev->dev);

	return 0;
}
Esempio n. 8
0
/*
 * __device_release_driver() must be called with @dev lock held.
 * When called for a USB interface, @dev->parent lock must be held as well.
 */
static void __device_release_driver(struct device *dev)
{
	struct device_driver *drv;

	drv = dev->driver;
	if (drv) {
		pm_runtime_get_noresume(dev);
		pm_runtime_barrier(dev);

		driver_sysfs_remove(dev);

		if (dev->bus)
			blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
						     BUS_NOTIFY_UNBIND_DRIVER,
						     dev);

		if (dev->bus && dev->bus->remove)
			dev->bus->remove(dev);
		else if (drv->remove)
			drv->remove(dev);
		devres_release_all(dev);
		dev->driver = NULL;
		klist_remove(&dev->p->knode_driver);
		if (dev->bus)
			blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
						     BUS_NOTIFY_UNBOUND_DRIVER,
						     dev);

		pm_runtime_put_sync(dev);
	}
}
Esempio n. 9
0
/**
 * device_attach - try to attach device to a driver.
 * @dev: device.
 *
 * Walk the list of drivers that the bus has and call
 * driver_probe_device() for each pair. If a compatible
 * pair is found, break out and return.
 *
 * Returns 1 if the device was bound to a driver;
 * 0 if no matching driver was found;
 * -ENODEV if the device is not registered.
 *
 * When called for a USB interface, @dev->parent lock must be held.
 */
int device_attach(struct device *dev)
{
	int ret = 0;

	device_lock(dev);
	if (dev->driver) {
		if (klist_node_attached(&dev->p->knode_driver)) {
			ret = 1;
			goto out_unlock;
		}
		ret = device_bind_driver(dev);
		if (ret == 0)
			ret = 1;
		else {
			dev->driver = NULL;
			ret = 0;
		}
	} else {
		pm_runtime_get_noresume(dev);
		ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
		pm_runtime_put_sync(dev);
	}
out_unlock:
	device_unlock(dev);
	return ret;
}
static void xhci_ush_pci_remove(struct pci_dev *dev)
{
	struct xhci_hcd *xhci;

	xhci = hcd_to_xhci(pci_get_drvdata(dev));
	if (xhci->shared_hcd) {
		usb_remove_hcd(xhci->shared_hcd);
		usb_put_hcd(xhci->shared_hcd);
	}

	if (!pci_dev_run_wake(dev))
		pm_runtime_get_noresume(&dev->dev);

	pm_runtime_forbid(&dev->dev);

	usb_hcd_pci_remove(dev);

	/* Free the aux irq */
	hsic_aux_irq_free();
	hsic_wakeup_irq_free();
	gpio_free(hsic.aux_gpio);
	gpio_free(hsic.wakeup_gpio);

	hsic.hsic_stopped = 1;
	hsic_enable = 0;

	kfree(xhci);
}
Esempio n. 11
0
static int hsic_send(struct link_device *ld, struct io_device *iod,
							struct sk_buff *skb)
{
	int ret, rpm_state;
	struct usb_link_device *usb_ld = to_usb_link_device(ld);
	struct link_pm_data *pm_data = usb_ld->link_pm_data;

	if (!usb_ld->if_usb_connected)
		goto link_disconnect;

	/* delay for net channel, limited by xmm6260 capacity */
	if (iod->send_delay && (iod->io_typ == IODEV_NET) \
			&& (1400 == skb->len))
		udelay(iod->send_delay);

	rpm_state = hsic_pm_runtime_get_active_async(pm_data);
	if (rpm_state == -ENODEV)
		goto link_disconnect;

	pm_runtime_get_noresume(&usb_ld->usbdev->dev);

	ret = hsic_tx_skb(&usb_ld->devdata[iod->id], skb);

	usb_mark_last_busy(usb_ld->usbdev);
	pm_runtime_put(&usb_ld->usbdev->dev);

	return ret;

link_disconnect:
	if (iod->io_typ != IODEV_NET)
		report_modem_state(ld, MODEM_EVENT_DISCONN);
	return -EINVAL;
}
Esempio n. 12
0
static void __devexit intel_mid_i2s_remove(struct pci_dev *pdev)
{
	struct intel_mid_i2s_hdl *drv_data;

	pm_runtime_get_noresume(&pdev->dev);
	pm_runtime_forbid(&pdev->dev);

	drv_data = pci_get_drvdata(pdev);
	if (!drv_data) {
		dev_err(&pdev->dev, "no drv_data in pci device to remove!\n");
		goto leave;
	}
	if (test_bit(I2S_PORT_OPENED, &drv_data->flags)) {
		dev_warn(&pdev->dev, "Not closed before removing pci_dev!\n");
		intel_mid_i2s_close(drv_data);
	}
	pci_set_drvdata(pdev, NULL);
	/* Stop DMA is already done during close()  */
	pci_dev_put(drv_data->dmac1);
	/* Disable the SSP at the peripheral and SOC level */
	write_SSCR0(0, drv_data->ioaddr);
	free_irq(drv_data->irq, drv_data);
	iounmap(drv_data->ioaddr);
	pci_release_region(pdev, MRST_SSP_BAR);
	pci_release_region(pdev, MRST_LPE_BAR);
	pci_disable_device(pdev);
	kfree(drv_data);
leave:
	return;
}
Esempio n. 13
0
/*
 * We need to register our own PCI probe function (instead of the USB core's
 * function) in order to create a second roothub under xHCI.
 */
static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
	int retval;
	struct xhci_hcd *xhci;
	struct hc_driver *driver;
	struct usb_hcd *hcd;

	driver = (struct hc_driver *)id->driver_data;

	/* Prevent runtime suspending between USB-2 and USB-3 initialization */
	pm_runtime_get_noresume(&dev->dev);

	/* Register the USB 2.0 roothub.
	 * FIXME: USB core must know to register the USB 2.0 roothub first.
	 * This is sort of silly, because we could just set the HCD driver flags
	 * to say USB 2.0, but I'm not sure what the implications would be in
	 * the other parts of the HCD code.
	 */
	retval = usb_hcd_pci_probe(dev, id);

	if (retval)
		goto put_runtime_pm;

	/* USB 2.0 roothub is stored in the PCI device now. */
	hcd = dev_get_drvdata(&dev->dev);
	xhci = hcd_to_xhci(hcd);
	xhci->shared_hcd = usb_create_shared_hcd(driver, &dev->dev,
				pci_name(dev), hcd);
	if (!xhci->shared_hcd) {
		retval = -ENOMEM;
		goto dealloc_usb2_hcd;
	}

	retval = usb_add_hcd(xhci->shared_hcd, dev->irq,
			IRQF_SHARED);
	if (retval)
		goto put_usb3_hcd;
	/* Roothub already marked as USB 3.0 speed */

	if (!(xhci->quirks & XHCI_BROKEN_STREAMS) &&
			HCC_MAX_PSA(xhci->hcc_params) >= 4)
		xhci->shared_hcd->can_do_streams = 1;

	if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
		xhci_pme_acpi_rtd3_enable(dev);

	/* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */
	pm_runtime_put_noidle(&dev->dev);

	return 0;

put_usb3_hcd:
	usb_put_hcd(xhci->shared_hcd);
dealloc_usb2_hcd:
	usb_hcd_pci_remove(dev);
put_runtime_pm:
	pm_runtime_put_noidle(&dev->dev);
	return retval;
}
Esempio n. 14
0
static void wl1271_remove(struct sdio_func *func)
{
	struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func);

	/* Undo decrement done above in wl1271_probe */
	pm_runtime_get_noresume(&func->dev);

	platform_device_unregister(glue->core);
}
/**
 * ufshcd_pci_remove - de-allocate PCI/SCSI host and host memory space
 *		data structure memory
 * @pdev - pointer to PCI handle
 */
static void ufshcd_pci_remove(struct pci_dev *pdev)
{
	struct ufs_hba *hba = pci_get_drvdata(pdev);

	pm_runtime_forbid(&pdev->dev);
	pm_runtime_get_noresume(&pdev->dev);
	ufshcd_remove(hba);
	pci_set_drvdata(pdev, NULL);
}
/**
 * exynos_drd_switch_start_host -  helper function for starting/stoping the host
 * controller driver.
 *
 * @otg: Pointer to the usb_otg structure.
 * @on: start / stop the host controller driver.
 *
 * Returns 0 on success otherwise negative errno.
 */
static int exynos_drd_switch_start_host(struct usb_otg *otg, int on)
{
    struct exynos_drd_switch *drd_switch = container_of(otg,
                                           struct exynos_drd_switch, otg);
    struct usb_hcd *hcd;
    struct device *xhci_dev;
    int ret = 0;

    if (!otg->host)
        return -EINVAL;

    dev_dbg(otg->phy->dev, "Turn %s host %s\n",
            on ? "on" : "off", otg->host->bus_name);

    hcd = bus_to_hcd(otg->host);
    xhci_dev = hcd->self.controller;

    if (on) {
#if !defined(CONFIG_USB_HOST_NOTIFY)
        wake_lock(&drd_switch->wakelock);
#endif
        /*
         * Clear runtime_error flag. The flag could be
         * set when user space accessed the host while DRD
         * was in B-Dev mode.
         */
        pm_runtime_disable(xhci_dev);
        if (pm_runtime_status_suspended(xhci_dev))
            pm_runtime_set_suspended(xhci_dev);
        else
            pm_runtime_set_active(xhci_dev);
        pm_runtime_enable(xhci_dev);

        ret = pm_runtime_get_sync(xhci_dev);
        if (ret < 0 && ret != -EINPROGRESS) {
            pm_runtime_put_noidle(xhci_dev);
            goto err;
        }

        exynos_drd_switch_ases_vbus_ctrl(drd_switch, 1);
    } else {
        exynos_drd_switch_ases_vbus_ctrl(drd_switch, 0);

        ret = pm_runtime_put_sync(xhci_dev);
        if (ret == -EAGAIN)
            pm_runtime_get_noresume(xhci_dev);
#if !defined(CONFIG_USB_HOST_NOTIFY)
        else
            wake_unlock(&drd_switch->wakelock);
#endif
    }

err:
    /* ret can be 1 after pm_runtime_get_sync */
    return (ret < 0) ? ret : 0;
}
static void serial_hsu_pci_port_remove(struct pci_dev *pdev)
{
	struct uart_hsu_port *up = pci_get_drvdata(pdev);

	pm_runtime_forbid(&pdev->dev);
	pm_runtime_get_noresume(&pdev->dev);
	serial_hsu_port_free(up);
	pci_set_drvdata(pdev, NULL);
	pci_disable_device(pdev);
}
Esempio n. 18
0
static int replicator_probe(struct platform_device *pdev)
{
	int ret;
	struct device *dev = &pdev->dev;
	struct coresight_platform_data *pdata = NULL;
	struct replicator_drvdata *drvdata;
	struct coresight_desc desc = { 0 };
	struct device_node *np = pdev->dev.of_node;

	if (np) {
		pdata = of_get_coresight_platform_data(dev, np);
		if (IS_ERR(pdata))
			return PTR_ERR(pdata);
		pdev->dev.platform_data = pdata;
	}

	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
	if (!drvdata)
		return -ENOMEM;

	drvdata->dev = &pdev->dev;
	drvdata->atclk = devm_clk_get(&pdev->dev, "atclk"); /* optional */
	if (!IS_ERR(drvdata->atclk)) {
		ret = clk_prepare_enable(drvdata->atclk);
		if (ret)
			return ret;
	}
	pm_runtime_get_noresume(&pdev->dev);
	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);
	platform_set_drvdata(pdev, drvdata);

	desc.type = CORESIGHT_DEV_TYPE_LINK;
	desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT;
	desc.ops = &replicator_cs_ops;
	desc.pdata = pdev->dev.platform_data;
	desc.dev = &pdev->dev;
	drvdata->csdev = coresight_register(&desc);
	if (IS_ERR(drvdata->csdev)) {
		ret = PTR_ERR(drvdata->csdev);
		goto out_disable_pm;
	}

	pm_runtime_put(&pdev->dev);

	return 0;

out_disable_pm:
	if (!IS_ERR(drvdata->atclk))
		clk_disable_unprepare(drvdata->atclk);
	pm_runtime_put_noidle(&pdev->dev);
	pm_runtime_disable(&pdev->dev);

	return ret;
}
Esempio n. 19
0
static void __devexit wl1271_remove(struct sdio_func *func)
{
	struct wl1271 *wl = sdio_get_drvdata(func);

	/* Undo decrement done above in wl1271_probe */
	pm_runtime_get_noresume(&func->dev);

	wl1271_unregister_hw(wl);
	free_irq(wl->irq, wl);
	wl1271_free_hw(wl);
}
int i915_rpm_deinit(struct drm_device *drm_dev)
{
	struct device *dev = drm_dev->dev;
	pm_runtime_forbid(dev);
	pm_runtime_set_suspended(dev);
	pm_runtime_get_noresume(dev);
	if (dev->power.runtime_error)
		DRM_ERROR("rpm init: error = %d\n", dev->power.runtime_error);

	i915_rpm_procfs_deinit(drm_dev);
	return 0;
}
Esempio n. 21
0
static int cyttsp5_spi_read_default_nosize(struct cyttsp5_adapter *adap,
	void *buf, int max)
{
	struct cyttsp5_spi *ts = dev_get_drvdata(adap->dev);
	int rc;
	pm_runtime_get_noresume(adap->dev);
	mutex_lock(&ts->lock);
	rc = cyttsp5_spi_read_default_nosize_(adap, buf, max);
	mutex_unlock(&ts->lock);
	pm_runtime_put_noidle(adap->dev);
	return rc;
}
static int smsc375x_remove(struct i2c_client *client)
{
	struct smsc375x_chip *chip = i2c_get_clientdata(client);

	free_irq(client->irq, chip);
	usb_put_phy(chip->otg);
	extcon_dev_unregister(chip->edev);
	kfree(chip->edev);
	pm_runtime_get_noresume(&chip->client->dev);
	kfree(chip);
	return 0;
}
Esempio n. 23
0
/**
 * usb_autopm_get_interface_no_resume - increment a USB interface's PM-usage counter
 * @intf: the usb_interface whose counter should be incremented
 *
 * This routine increments @intf's usage counter but does not carry out an
 * autoresume.
 *
 * This routine can run in atomic context.
 */
void usb_autopm_get_interface_no_resume(struct usb_interface *intf)
{
	struct usb_device       *udev = interface_to_usbdev(intf);

	usb_mark_last_busy(udev);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
	atomic_inc(&intf->pm_usage_cnt);
#else
	intf->pm_usage_cnt++;
#endif
	pm_runtime_get_noresume(&intf->dev);
}
Esempio n. 24
0
static int msm_hsl_console_setup(struct console *co, char *options)
{
	struct uart_port *port;
	unsigned int vid;
	int baud = 0, flow, bits, parity;
	int ret;

	pr_info("%s: ir\n", __func__);

	if (unlikely(co->index >= UART_NR || co->index < 0))
		return -ENXIO;

	port = get_port_from_line(co->index);
	vid = UART_TO_MSM(port)->ver_id;
	pr_info("%s ():port->line %d, ir\n", __func__, port->line);
	if (unlikely(!port->membase))
		return -ENXIO;

	port->cons = co;

	pm_runtime_get_noresume(port->dev);

#ifndef CONFIG_PM_RUNTIME
	msm_hsl_init_clock(port);
#endif
	pm_runtime_resume(port->dev);

	if (options)
		uart_parse_options(options, &baud, &parity, &bits, &flow);

	bits = 8;
	parity = 'n';
	flow = 'n';
	msm_hsl_write(port, UARTDM_MR2_BITS_PER_CHAR_8 | STOP_BIT_ONE,
		      regmap[vid][UARTDM_MR2]);	

	if (baud < 300 || baud > 115200)
		baud = 115200;
	
	msm_hsl_set_baud_rate(port, baud);
	pr_info("%s: cir port[%d] set baud=%d\n", __func__, port->line, baud);

	ret = uart_set_options(port, co, baud, parity, bits, flow);
	msm_hsl_reset(port);
	
	msm_hsl_write(port, CR_PROTECTION_EN, regmap[vid][UARTDM_CR]);
	msm_hsl_write(port, UARTDM_CR_TX_EN_BMSK, regmap[vid][UARTDM_CR]);

	printk(KERN_INFO "msm_serial_hsl: console setup on port #%d\n",
	       port->line);
	pr_info("%s ():port->line %d, ok, ir\n", __func__, port->line);
	return ret;
}
static void __devexit sdhci_pltfm_runtime_pm_forbid(struct device *device)
{
	struct sdio_dev *dev =
		platform_get_drvdata(to_platform_device(device));

	if (!sdhci_pltfm_rpm_enabled(dev))
		return;

	pm_runtime_forbid(device);
	pm_runtime_get_noresume(device);
	pm_runtime_disable(device);
}
Esempio n. 26
0
static int usb_port_runtime_resume(struct device *dev)
{
	struct usb_port *port_dev = to_usb_port(dev);
	struct usb_device *hdev = to_usb_device(dev->parent->parent);
	struct usb_interface *intf = to_usb_interface(dev->parent);
	struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
	struct usb_device *udev = port_dev->child;
	struct usb_port *peer = port_dev->peer;
	int port1 = port_dev->portnum;
	int retval;

	if (!hub)
		return -EINVAL;
	if (hub->in_reset) {
		set_bit(port1, hub->power_bits);
		return 0;
	}

	/*
	 * Power on our usb3 peer before this usb2 port to prevent a usb3
	 * device from degrading to its usb2 connection
	 */
	if (!port_dev->is_superspeed && peer)
		pm_runtime_get_sync(&peer->dev);

	usb_autopm_get_interface(intf);
	retval = usb_hub_set_port_power(hdev, hub, port1, true);
	msleep(hub_power_on_good_delay(hub));
	if (udev && !retval) {
		/*
		 * Attempt to wait for usb hub port to be reconnected in order
		 * to make the resume procedure successful.  The device may have
		 * disconnected while the port was powered off, so ignore the
		 * return status.
		 */
		retval = hub_port_debounce_be_connected(hub, port1);
		if (retval < 0)
			dev_dbg(&port_dev->dev, "can't get reconnection after setting port  power on, status %d\n",
					retval);
		retval = 0;

		/* Force the child awake to revalidate after the power loss. */
		if (!test_and_set_bit(port1, hub->child_usage_bits)) {
			pm_runtime_get_noresume(&port_dev->dev);
			pm_request_resume(&udev->dev);
		}
	}

	usb_autopm_put_interface(intf);

	return retval;
}
Esempio n. 27
0
static void __devexit wl1271_remove(struct sdio_func *func)
{
	struct wl1271 *wl = sdio_get_drvdata(func);

	/* Undo decrement done above in wl1271_probe */
	pm_runtime_get_noresume(&func->dev);

	wl1271_unregister_hw(wl);
	device_init_wakeup(wl1271_sdio_wl_to_dev(wl), 0);
	disable_irq_wake(wl->irq);
	free_irq(wl->irq, wl);
	wl1271_free_hw(wl);
}
/* Can run in atomic context */
mali_bool _mali_osk_pm_dev_ref_add_no_power_on(void)
{
#ifdef CONFIG_PM_RUNTIME
	u32 ref;
	MALI_DEBUG_ASSERT_POINTER(mali_platform_device);
	pm_runtime_get_noresume(&(mali_platform_device->dev));
	ref = _mali_osk_atomic_read(&mali_pm_ref_count);
	MALI_DEBUG_PRINT(4, ("Mali OSK PM: No-power ref taken (%u)\n", _mali_osk_atomic_read(&mali_pm_ref_count)));
	return ref > 0 ? MALI_TRUE : MALI_FALSE;
#else
	return MALI_TRUE;
#endif
}
Esempio n. 29
0
static void wl1271_remove(struct sdio_func *func)
{
	struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func);
	struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
	struct wl12xx_platform_data *pdata = pdev_data->pdata;

	/* Undo decrement done above in wl1271_probe */
	pm_runtime_get_noresume(&func->dev);

	platform_device_unregister(glue->core);
	del_platform_data(pdata);
	kfree(glue);
}
Esempio n. 30
0
static int cyttsp5_spi_write_read_specific(struct cyttsp5_adapter *adap,
		u8 write_len, u8 *write_buf, u8 *read_buf)
{
	struct cyttsp5_spi *ts = dev_get_drvdata(adap->dev);
	int rc;
	pm_runtime_get_noresume(adap->dev);
	mutex_lock(&ts->lock);
	rc = cyttsp5_spi_write_read_specific_(adap, write_len, write_buf,
			read_buf);
	mutex_unlock(&ts->lock);
	pm_runtime_put_noidle(adap->dev);
	return rc;
}