• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ bus_to_hcd函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中bus_to_hcd函数的典型用法代码示例。如果您正苦于以下问题:C++ bus_to_hcd函数的具体用法?C++ bus_to_hcd怎么用?C++ bus_to_hcd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了bus_to_hcd函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: match_location

/*
 * For each usb hub device in the system check to see if it is in the
 * peer domain of the given port_dev, and if it is check to see if it
 * has a port that matches the given port by location
 */
static int match_location(struct usb_device *peer_hdev, void *p)
{
	int port1;
	struct usb_hcd *hcd, *peer_hcd;
	struct usb_port *port_dev = p, *peer;
	struct usb_hub *peer_hub = usb_hub_to_struct_hub(peer_hdev);
	struct usb_device *hdev = to_usb_device(port_dev->dev.parent->parent);

	if (!peer_hub)
		return 0;

	hcd = bus_to_hcd(hdev->bus);
	peer_hcd = bus_to_hcd(peer_hdev->bus);
	/* peer_hcd is provisional until we verify it against the known peer */
	if (peer_hcd != hcd->shared_hcd)
		return 0;

	for (port1 = 1; port1 <= peer_hdev->maxchild; port1++) {
		peer = peer_hub->ports[port1 - 1];
		if (peer && peer->location == port_dev->location) {
			link_peers_report(port_dev, peer);
			return 1; /* done */
		}
	}

	return 0;
}
开发者ID:abhinav90,项目名称:linux,代码行数:32,代码来源:port.c


示例2: usb_poll

void usb_poll(struct usb_bus *bus)
{
#ifdef CONFIG_USB_OTG_HOST_RTL8672
	unsigned long		flags;
	struct usb_hcd *hcd=bus_to_hcd(bus);

	dwc_otg_hcd_t *otg_hcd = (struct dwc_otg_hcd_t *)hcd->hcd_priv;
	spin_lock_irqsave (&otg_hcd->lock, flags);
	dwc_otg_async(otg_hcd, 0);
	dwc_otg_hcd_handle_sof_intr (otg_hcd);
	spin_unlock_irqrestore (&otg_hcd->lock, flags);

	return;
#else
#ifdef __LINUX_2_6__
	unsigned long		flags=0;

	struct usb_hcd *hcd=bus_to_hcd(bus);
	struct ehci_hcd *ehci=(struct ehci_hcd *)hcd->hcd_priv;

	spin_lock_irqsave (&ehci->lock, flags);
	ehci_irq(hcd);
	spin_unlock_irqrestore (&ehci->lock, flags);
#else
	struct usb_hcd *hcd=bus_to_hcd(priv->udev->bus);
	ehci_irq(hcd, NULL);
#endif

	return;
#endif
}
开发者ID:kyalipay,项目名称:rtl8192su,代码行数:31,代码来源:8190n_usb.c


示例3: bcmpmu_otg_xceiv_vbus_store

static ssize_t bcmpmu_otg_xceiv_vbus_store(struct device *dev,
        struct device_attribute *attr,
        const char *buf, size_t count)
{
    struct usb_hcd *hcd;
    ssize_t result = 0;
    unsigned int val;
    struct bcmpmu_otg_xceiv_data *xceiv_data = dev_get_drvdata(dev);
    int error;

    hcd = bus_to_hcd(xceiv_data->otg_xceiver.xceiver.host);

    result = sscanf(buf, "%02x\n", &val);
    if (result != 1) {
        result = -EINVAL;
    } else if (val == 0) {
        dev_info(xceiv_data->dev, "Clearing PORT_POWER feature\n");
        error = hcd->driver->hub_control(hcd, ClearPortFeature,
                                         USB_PORT_FEAT_POWER, 1, NULL,
                                         0);
        if (error)
            dev_err(xceiv_data->dev,
                    "Failed to clear PORT_POWER feature\n");
    } else {
        dev_info(xceiv_data->dev, "Setting PORT_POWER feature\n");
        error = hcd->driver->hub_control(hcd, SetPortFeature,
                                         USB_PORT_FEAT_POWER, 1, NULL,
                                         0);
        if (error)
            dev_err(xceiv_data->dev,
                    "Failed to set PORT_POWER feature\n");
    }

    return result < 0 ? result : count;
}
开发者ID:emreharbutoglu,项目名称:i9105Sammy,代码行数:35,代码来源:bcmpmu_otg_xceiv.c


示例4: ehci_zynq_otg_stop_host

static int ehci_zynq_otg_stop_host(struct usb_phy *otg)
{
	struct usb_hcd		*hcd = bus_to_hcd(otg->otg->host);

	usb_remove_hcd(hcd);
	return 0;
}
开发者ID:Yemege,项目名称:kernel-zynq,代码行数:7,代码来源:ehci-zynq.c


示例5: hcd_buffer_free

void hcd_buffer_free(
	struct usb_bus 	*bus,
	size_t			size,
	void 			*addr,
	dma_addr_t		dma
)
{
	struct usb_hcd		*hcd = bus_to_hcd(bus);
	int 			i;

	if (!addr)
		return;

	if (!bus->controller->dma_mask &&
	    !(hcd->driver->flags & HCD_LOCAL_MEM)) {
		kfree(addr);
		return;
	}

	for (i = 0; i < HCD_BUFFER_POOLS; i++) {
		if (size <= pool_max [i]) {
			dma_pool_free(hcd->pool [i], addr, dma);
			return;
		}
	}
	dma_free_coherent(hcd->self.controller, size, addr, dma);
}
开发者ID:458941968,项目名称:mini2440-kernel-2.6.29,代码行数:27,代码来源:buffer.c


示例6: ehci_zynq_otg_start_host

static int ehci_zynq_otg_start_host(struct usb_phy *otg)
{
	struct usb_hcd		*hcd = bus_to_hcd(otg->otg->host);
	struct zynq_otg *xotg =
			xceiv_to_xotg(hcd->usb_phy);

	usb_add_hcd(hcd, xotg->irq, IRQF_SHARED);
	return 0;
}
开发者ID:Yemege,项目名称:kernel-zynq,代码行数:9,代码来源:ehci-zynq.c


示例7: exynos_drd_switch_start_host

/**
 * 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;
}
开发者ID:halaszk,项目名称:android_kernel_samsung_lt03,代码行数:65,代码来源:exynos-drd-switch.c


示例8: usb_receive_all_pkts

void usb_receive_all_pkts(struct rtl8190_priv *priv)
{
#ifdef CONFIG_USB_OTG_HOST_RTL8672
	usb_scan_async(priv->udev->bus, 1);
#else
#ifdef __LINUX_2_6__
	unsigned long		flags=0;

	struct usb_hcd *hcd=bus_to_hcd(priv->udev->bus);
	struct ehci_hcd *ehci=(struct ehci_hcd *)hcd->hcd_priv;

	spin_lock_irqsave (&ehci->lock, flags);
	ehci_irq(hcd);
	spin_unlock_irqrestore (&ehci->lock, flags);
#else
	struct usb_hcd *hcd=bus_to_hcd(priv->udev->bus);
	ehci_irq(hcd, NULL);
#endif
#endif
}
开发者ID:kyalipay,项目名称:rtl8192su,代码行数:20,代码来源:8190n_usb.c


示例9: usb_scan_async

void usb_scan_async(struct usb_bus *bus, unsigned wlan_close)
{
	unsigned long		flags;

	struct usb_hcd *hcd=bus_to_hcd(bus);
	
	dwc_otg_hcd_t *otg_hcd = (struct dwc_otg_hcd_t *)hcd->hcd_priv;
	spin_lock_irqsave (&otg_hcd->lock, flags);
	dwc_otg_async(otg_hcd, wlan_close);
	spin_unlock_irqrestore (&otg_hcd->lock, flags);
}
开发者ID:kyalipay,项目名称:rtl8192su,代码行数:11,代码来源:8190n_usb.c


示例10: usb_amd_resume_quirk

static int usb_amd_resume_quirk(struct usb_device *udev)
{
	struct usb_hcd *hcd;

	hcd = bus_to_hcd(udev->bus);
	/* The device should be attached directly to root hub */
	if (udev->level == 1 && hcd->amd_resume_bug == 1)
		return 1;

	return 0;
}
开发者ID:GuojianZhou,项目名称:linux-yocto-3.14,代码行数:11,代码来源:quirks.c


示例11: store_ehci_power

static ssize_t store_ehci_power(struct device *dev,
				struct device_attribute *attr,
				const char *buf, size_t count)
{
	struct usb_hcd *hcd = bus_to_hcd(dev_get_drvdata(dev));
	int power_on;
	int retval;

	if (sscanf(buf, "%d", &power_on) != 1)
		return -EINVAL;

	device_lock(dev);
	if (power_on == 0 && s5pv210_hcd != NULL) {
		printk(KERN_DEBUG "%s: EHCI turns off\n", __func__);
		usb_remove_hcd(hcd);
		s5pv210_stop_ehc();
		s5pv210_hcd = NULL;
		/*HSIC IPC control the ACTIVE_STATE*/
                #ifdef CONFIG_SAMSUNG_PHONE_SVNET
		mc_control_active_state(0);
                #endif
	} else if (power_on == 1) {
		printk(KERN_DEBUG "%s: EHCI turns on\n", __func__);
		if (s5pv210_hcd != NULL) {
			usb_remove_hcd(hcd);
			/*HSIC IPC control the ACTIVE_STATE*/
                        #ifdef CONFIG_SAMSUNG_PHONE_SVNET
			mc_control_active_state(0);
                        #endif
		}
		s5pv210_start_ehc();

#if defined(CONFIG_ARCH_S5PV310)
		writel(0x03C00000, hcd->regs + 0x90);
#endif

		retval = usb_add_hcd(hcd, IRQ_UHOST,
				IRQF_DISABLED | IRQF_SHARED);
		if (retval < 0) {
			dev_err(dev, "Power On Fail\n");
			goto exit;
		}
		/*HSIC IPC control the ACTIVE_STATE*/
                #ifdef CONFIG_SAMSUNG_PHONE_SVNET
		mc_control_active_state(1);
                #endif

		s5pv210_hcd = hcd;
	}
exit:
	device_unlock(dev);
	return count;
}
开发者ID:myfluxi,项目名称:xxKernel,代码行数:53,代码来源:ehci-s5pv210.c


示例12: msm_hsusb_start_host

static void msm_hsusb_start_host(struct usb_bus *bus, int start)
{
    struct usb_hcd *hcd = bus_to_hcd(bus);
    struct msmusb_hcd *mhcd = hcd_to_mhcd(hcd);

    mhcd->flags = start;
    if (in_interrupt())
        schedule_work(&mhcd->otg_work);
    else
        msm_hsusb_request_host((void *)mhcd, mhcd->flags);

}
开发者ID:weritos666,项目名称:ARCHOS_50_Platinum,代码行数:12,代码来源:ehci-msm72k.c


示例13: find_and_link_peer

/*
 * Find the peer port either via explicit platform firmware "location"
 * data, the peer hcd for root hubs, or the upstream peer relationship
 * for all other hubs.
 */
static void find_and_link_peer(struct usb_hub *hub, int port1)
{
	struct usb_port *port_dev = hub->ports[port1 - 1], *peer;
	struct usb_device *hdev = hub->hdev;
	struct usb_device *peer_hdev;
	struct usb_hub *peer_hub;

	/*
	 * If location data is available then we can only peer this port
	 * by a location match, not the default peer (lest we create a
	 * situation where we need to go back and undo a default peering
	 * when the port is later peered by location data)
	 */
	if (port_dev->location) {
		/* we link the peer in match_location() if found */
		usb_for_each_dev(port_dev, match_location);
		return;
	} else if (!hdev->parent) {
		struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
		struct usb_hcd *peer_hcd = hcd->shared_hcd;

		if (!peer_hcd)
			return;

		peer_hdev = peer_hcd->self.root_hub;
	} else {
		struct usb_port *upstream;
		struct usb_device *parent = hdev->parent;
		struct usb_hub *parent_hub = usb_hub_to_struct_hub(parent);

		if (!parent_hub)
			return;

		upstream = parent_hub->ports[hdev->portnum - 1];
		if (!upstream || !upstream->peer)
			return;

		peer_hdev = upstream->peer->child;
	}

	peer_hub = usb_hub_to_struct_hub(peer_hdev);
	if (!peer_hub || port1 > peer_hdev->maxchild)
		return;

	/*
	 * we found a valid default peer, last check is to make sure it
	 * does not have location data
	 */
	peer = peer_hub->ports[port1 - 1];
	if (peer && peer->location == 0)
		link_peers_report(port_dev, peer);
}
开发者ID:abhinav90,项目名称:linux,代码行数:57,代码来源:port.c


示例14: usb_release_dev

/**
 * usb_release_dev - free a usb device structure when all users of it are finished.
 * @dev: device that's been disconnected
 *
 * Will be called only by the device core when all users of this usb device are
 * done.
 */
static void usb_release_dev(struct device *dev)
{
	struct usb_device *udev;

	udev = to_usb_device(dev);

	usb_destroy_configuration(udev);
	usb_put_hcd(bus_to_hcd(udev->bus));
	kfree(udev->product);
	kfree(udev->manufacturer);
	kfree(udev->serial);
	kfree(udev);
}
开发者ID:vovan888,项目名称:p750-kernel,代码行数:20,代码来源:usb.c


示例15: exynos_drd_switch_is_host_off

/**
 * exynos_drd_switch_is_host_off - check host's PM status.
 *
 * @otg: Pointer to the usb_otg structure.
 *
 * Before peripheral can start two conditions must be met:
 * 1. Host's completely resumed after system sleep.
 * 2. Host is runtime suspended.
 */
static bool exynos_drd_switch_is_host_off(struct usb_otg *otg)
{
    struct usb_hcd *hcd;
    struct device *dev;

    if (!otg->host)
        /* REVISIT: what should we return here? */
        return true;

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

    return pm_runtime_suspended(dev);
}
开发者ID:halaszk,项目名称:android_kernel_samsung_lt03,代码行数:23,代码来源:exynos-drd-switch.c


示例16: dwc3_otg_start_host

/**
 * dwc3_otg_start_host -  helper function for starting/stoping the host controller driver.
 *
 * @otg: Pointer to the otg_transceiver structure.
 * @on: start / stop the host controller driver.
 *
 * Returns 0 on success otherwise negative errno.
 */
static int dwc3_otg_start_host(struct usb_otg *otg, int on)
{
	struct dwc3_otg *dotg = container_of(otg, struct dwc3_otg, otg);
	struct usb_hcd *hcd;
	struct xhci_hcd *xhci;
	int ret = 0;

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

	hcd = bus_to_hcd(otg->host);
	xhci = hcd_to_xhci(hcd);
	if (on) {
		dev_dbg(otg->phy->dev, "%s: turn on host %s\n",
					__func__, otg->host->bus_name);
		dwc3_otg_set_host_regs(dotg);

		/*
		 * This should be revisited for more testing post-silicon.
		 * In worst case we may need to disconnect the root hub
		 * before stopping the controller so that it does not
		 * interfere with runtime pm/system pm.
		 * We can also consider registering and unregistering xhci
		 * platform device. It is almost similar to add_hcd and
		 * remove_hcd, But we may not use standard set_host method
		 * anymore.
		 */
		ret = hcd->driver->start(hcd);
		if (ret) {
			dev_err(otg->phy->dev,
				"%s: failed to start primary hcd, ret=%d\n",
				__func__, ret);
			return ret;
		}

		ret = xhci->shared_hcd->driver->start(xhci->shared_hcd);
		if (ret) {
			dev_err(otg->phy->dev,
				"%s: failed to start secondary hcd, ret=%d\n",
				__func__, ret);
			return ret;
		}
	} else {
		dev_dbg(otg->phy->dev, "%s: turn off host %s\n",
					__func__, otg->host->bus_name);
		hcd->driver->stop(hcd);
	}

	return 0;
}
开发者ID:404992361,项目名称:mi1_kernel,代码行数:58,代码来源:dwc3_otg.c


示例17: usb_release_dev

/**
 * usb_release_dev - free a usb device structure when all users of it are finished.
 * @dev: device that's been disconnected
 *
 * Will be called only by the device core when all users of this usb device are
 * done.
 */
static void usb_release_dev(struct device *dev)
{
	struct usb_device *udev;
	struct usb_hcd *hcd;

	udev = to_usb_device(dev);
	hcd = bus_to_hcd(udev->bus);

	usb_destroy_configuration(udev);
	usb_release_bos_descriptor(udev);
	usb_put_hcd(hcd);
	kfree(udev->product);
	kfree(udev->manufacturer);
	kfree(udev->serial);
	kfree(udev);
}
开发者ID:Svard73,项目名称:SM-T700-T705-Kernel,代码行数:23,代码来源:usb.c


示例18: mv_otg_start_host

static void mv_otg_start_host(struct mv_otg *mvotg, int on)
{
	struct otg_transceiver *otg = &mvotg->otg;
	struct usb_hcd *hcd;

	if (!otg->host)
		return;

	hcd = bus_to_hcd(otg->host);

	dev_info(&mvotg->dev->dev, "%s host\n", on ? "start" : "stop");

	if (on)
		usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
	else
		usb_remove_hcd(hcd);
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.kernel,代码行数:17,代码来源:mv_otg.c


示例19: msm_otg_set_host

static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
{
	struct msm_otg *motg = container_of(otg->usb_phy, struct msm_otg, phy);
	struct usb_hcd *hcd;

	/*
	 * Fail host registration if this board can support
	 * only peripheral configuration.
	 */
	if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL) {
		dev_info(otg->usb_phy->dev, "Host mode is not supported\n");
		return -ENODEV;
	}

	if (!host) {
		if (otg->state == OTG_STATE_A_HOST) {
			pm_runtime_get_sync(otg->usb_phy->dev);
			msm_otg_start_host(otg->usb_phy, 0);
			otg->host = NULL;
			otg->state = OTG_STATE_UNDEFINED;
			schedule_work(&motg->sm_work);
		} else {
			otg->host = NULL;
		}

		return 0;
	}

	hcd = bus_to_hcd(host);
	hcd->power_budget = motg->pdata->power_budget;

	otg->host = host;
	dev_dbg(otg->usb_phy->dev, "host driver registered w/ tranceiver\n");

	/*
	 * Kick the state machine work, if peripheral is not supported
	 * or peripheral is already registered with us.
	 */
	if (motg->pdata->mode == USB_DR_MODE_HOST ||
			motg->pdata->mode == USB_DR_MODE_OTG || otg->gadget) {
		pm_runtime_get_sync(otg->usb_phy->dev);
		schedule_work(&motg->sm_work);
	}

	return 0;
}
开发者ID:guanhe0,项目名称:kernel,代码行数:46,代码来源:phy-msm-usb.c


示例20: xhci_slot_context_show

static int xhci_slot_context_show(struct seq_file *s, void *unused)
{
	struct xhci_hcd		*xhci;
	struct xhci_slot_ctx	*slot_ctx;
	struct xhci_slot_priv	*priv = s->private;
	struct xhci_virt_device	*dev = priv->dev;

	xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus));
	slot_ctx = xhci_get_slot_ctx(xhci, dev->out_ctx);
	seq_printf(s, "%pad: %s\n", &dev->out_ctx->dma,
		   xhci_decode_slot_context(slot_ctx->dev_info,
					    slot_ctx->dev_info2,
					    slot_ctx->tt_info,
					    slot_ctx->dev_state));

	return 0;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:17,代码来源:xhci-debugfs.c



注:本文中的bus_to_hcd函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ bus_unregister函数代码示例发布时间:2022-05-30
下一篇:
C++ bus_teardown_intr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap