这篇教程C++ usb_put_dev函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中usb_put_dev函数的典型用法代码示例。如果您正苦于以下问题:C++ usb_put_dev函数的具体用法?C++ usb_put_dev怎么用?C++ usb_put_dev使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了usb_put_dev函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: i2400mu_probe/* * Probe a i2400m interface and register it * * @iface: USB interface to link to * @id: USB class/subclass/protocol id * @returns: 0 if ok, < 0 errno code on error. * * Alloc a net device, initialize the bus-specific details and then * calls the bus-generic initialization routine. That will register * the wimax and netdev devices, upload the firmware [using * _bus_bm_*()], call _bus_dev_start() to finalize the setup of the * communication with the device and then will start to talk to it to * finnish setting it up. */staticint i2400mu_probe(struct usb_interface *iface, const struct usb_device_id *id){ int result; struct net_device *net_dev; struct device *dev = &iface->dev; struct i2400m *i2400m; struct i2400mu *i2400mu; struct usb_device *usb_dev = interface_to_usbdev(iface); if (usb_dev->speed != USB_SPEED_HIGH) dev_err(dev, "device not connected as high speed/n"); /* Allocate instance [calls i2400m_netdev_setup() on it]. */ result = -ENOMEM; net_dev = alloc_netdev(sizeof(*i2400mu), "wmx%d", i2400mu_netdev_setup); if (net_dev == NULL) { dev_err(dev, "no memory for network device instance/n"); goto error_alloc_netdev; } SET_NETDEV_DEV(net_dev, dev); SET_NETDEV_DEVTYPE(net_dev, &i2400mu_type); i2400m = net_dev_to_i2400m(net_dev); i2400mu = container_of(i2400m, struct i2400mu, i2400m); i2400m->wimax_dev.net_dev = net_dev; i2400mu->usb_dev = usb_get_dev(usb_dev); i2400mu->usb_iface = iface; usb_set_intfdata(iface, i2400mu); i2400m->bus_tx_block_size = I2400MU_BLK_SIZE; i2400m->bus_pl_size_max = I2400MU_PL_SIZE_MAX; i2400m->bus_dev_start = i2400mu_bus_dev_start; i2400m->bus_dev_stop = i2400mu_bus_dev_stop; i2400m->bus_tx_kick = i2400mu_bus_tx_kick; i2400m->bus_reset = i2400mu_bus_reset; i2400m->bus_bm_retries = I2400M_BOOT_RETRIES; i2400m->bus_bm_cmd_send = i2400mu_bus_bm_cmd_send; i2400m->bus_bm_wait_for_ack = i2400mu_bus_bm_wait_for_ack; i2400m->bus_fw_names = i2400mu_bus_fw_names; i2400m->bus_bm_mac_addr_impaired = 0;#ifdef CONFIG_PM iface->needs_remote_wakeup = 1; /* autosuspend (15s delay) */ device_init_wakeup(dev, 1); usb_autopm_enable(i2400mu->usb_iface); usb_dev->autosuspend_delay = 15 * HZ; usb_dev->autosuspend_disabled = 0;#endif result = i2400m_setup(i2400m, I2400M_BRI_MAC_REINIT); if (result < 0) { dev_err(dev, "cannot setup device: %d/n", result); goto error_setup; } result = i2400mu_debugfs_add(i2400mu); if (result < 0) { dev_err(dev, "Can't register i2400mu's debugfs: %d/n", result); goto error_debugfs_add; } return 0;error_debugfs_add: i2400m_release(i2400m);error_setup: usb_set_intfdata(iface, NULL); usb_put_dev(i2400mu->usb_dev); free_netdev(net_dev);error_alloc_netdev: return result;}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:86,
示例2: ath6kl_usb_probe/* ath6kl usb driver registered functions */static int ath6kl_usb_probe(struct usb_interface *interface, const struct usb_device_id *id){ struct usb_device *dev = interface_to_usbdev(interface); struct ath6kl *ar; struct ath6kl_usb *ar_usb = NULL; int vendor_id, product_id; int ret = 0; usb_get_dev(dev); vendor_id = le16_to_cpu(dev->descriptor.idVendor); product_id = le16_to_cpu(dev->descriptor.idProduct); ath6kl_dbg(ATH6KL_DBG_USB, "vendor_id = %04x/n", vendor_id); ath6kl_dbg(ATH6KL_DBG_USB, "product_id = %04x/n", product_id); if (interface->cur_altsetting) ath6kl_dbg(ATH6KL_DBG_USB, "USB Interface %d/n", interface->cur_altsetting->desc.bInterfaceNumber); if (dev->speed == USB_SPEED_HIGH) ath6kl_dbg(ATH6KL_DBG_USB, "USB 2.0 Host/n"); else ath6kl_dbg(ATH6KL_DBG_USB, "USB 1.1 Host/n"); ar_usb = ath6kl_usb_create(interface); if (ar_usb == NULL) { ret = -ENOMEM; goto err_usb_put; } ar = ath6kl_core_create(&ar_usb->udev->dev); if (ar == NULL) { ath6kl_err("Failed to alloc ath6kl core/n"); ret = -ENOMEM; goto err_usb_destroy; } ar->hif_priv = ar_usb; ar->hif_type = ATH6KL_HIF_TYPE_USB; ar->hif_ops = &ath6kl_usb_ops; ar->mbox_info.block_size = 16; ar->bmi.max_data_size = 252; ar_usb->ar = ar; ret = ath6kl_core_init(ar); if (ret) { ath6kl_err("Failed to init ath6kl core: %d/n", ret); goto err_core_free; } return ret;err_core_free: ath6kl_core_destroy(ar);err_usb_destroy: ath6kl_usb_destroy(ar_usb);err_usb_put: usb_put_dev(dev); return ret;}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:67,
示例3: gigaset_probe//.........这里部分代码省略......... dev_notice(&udev->dev, "unsupported interface class %d - skip", hostif->desc.bInterfaceClass); return -ENODEV; } dev_info(&udev->dev, "%s: Device matched ... !/n", __func__); /* allocate memory for our device state and intialize it */ cs = gigaset_initcs(driver, 1, 1, 0, cidmode, GIGASET_MODULENAME); if (!cs) return -ENODEV; ucs = cs->hw.usb; /* save off device structure ptrs for later use */ usb_get_dev(udev); ucs->udev = udev; ucs->interface = interface; cs->dev = &interface->dev; /* save address of controller structure */ usb_set_intfdata(interface, cs); // dev_set_drvdata(&interface->dev, cs); endpoint = &hostif->endpoint[0].desc; buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); ucs->bulk_out_size = buffer_size; ucs->bulk_out_endpointAddr = endpoint->bEndpointAddress; ucs->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL); if (!ucs->bulk_out_buffer) { dev_err(cs->dev, "Couldn't allocate bulk_out_buffer/n"); retval = -ENOMEM; goto error; } ucs->bulk_out_urb = usb_alloc_urb(0, GFP_KERNEL); if (!ucs->bulk_out_urb) { dev_err(cs->dev, "Couldn't allocate bulk_out_urb/n"); retval = -ENOMEM; goto error; } endpoint = &hostif->endpoint[1].desc; ucs->busy = 0; ucs->read_urb = usb_alloc_urb(0, GFP_KERNEL); if (!ucs->read_urb) { dev_err(cs->dev, "No free urbs available/n"); retval = -ENOMEM; goto error; } buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); ucs->rcvbuf_size = buffer_size; ucs->int_in_endpointAddr = endpoint->bEndpointAddress; cs->inbuf[0].rcvbuf = kmalloc(buffer_size, GFP_KERNEL); if (!cs->inbuf[0].rcvbuf) { dev_err(cs->dev, "Couldn't allocate rcvbuf/n"); retval = -ENOMEM; goto error; } /* Fill the interrupt urb and send it to the core */ usb_fill_int_urb(ucs->read_urb, udev, usb_rcvintpipe(udev, endpoint->bEndpointAddress & 0x0f), cs->inbuf[0].rcvbuf, buffer_size, gigaset_read_int_callback, cs->inbuf + 0, endpoint->bInterval); retval = usb_submit_urb(ucs->read_urb, GFP_KERNEL); if (retval) { dev_err(cs->dev, "Could not submit URB (error %d)/n", -retval); goto error; } /* tell common part that the device is ready */ if (startmode == SM_LOCKED) cs->mstate = MS_LOCKED; if (!gigaset_start(cs)) { tasklet_kill(&cs->write_tasklet); retval = -ENODEV; //FIXME goto error; } return 0;error: usb_kill_urb(ucs->read_urb); kfree(ucs->bulk_out_buffer); usb_free_urb(ucs->bulk_out_urb); kfree(cs->inbuf[0].rcvbuf); usb_free_urb(ucs->read_urb); usb_set_intfdata(interface, NULL); ucs->read_urb = ucs->bulk_out_urb = NULL; cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL; usb_put_dev(ucs->udev); ucs->udev = NULL; ucs->interface = NULL; gigaset_freecs(cs); return retval;}
开发者ID:274914765,项目名称:C,代码行数:101,
示例4: kevent//.........这里部分代码省略.........// precondition: never called in_interruptstaticvoid axusbnet_disconnect (struct usb_interface *intf){ struct usbnet *dev; struct usb_device *xdev; struct net_device *net; dev = usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); if (!dev) return; xdev = interface_to_usbdev (intf); if (netif_msg_probe (dev)) devinfo (dev, "unregister '%s' usb-%s-%s, %s", intf->dev.driver->name, xdev->bus->bus_name, xdev->devpath, dev->driver_info->description); net = dev->net; unregister_netdev (net); /* we don't hold rtnl here ... */ flush_scheduled_work (); if (dev->driver_info->unbind) dev->driver_info->unbind (dev, intf); free_netdev(net); usb_put_dev (xdev);}/*-------------------------------------------------------------------------*/// precondition: never called in_interruptstatic intaxusbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod){ struct usbnet *dev; struct net_device *net; struct usb_host_interface *interface; struct driver_info *info; struct usb_device *xdev; int status; const char *name; name = udev->dev.driver->name; info = (struct driver_info *) prod->driver_info; if (!info) { printk (KERN_ERR "blacklisted by %s/n", name); return -ENODEV; } xdev = interface_to_usbdev (udev); interface = udev->cur_altsetting; usb_get_dev (xdev); status = -ENOMEM; // set up our own records net = alloc_etherdev(sizeof(*dev));
开发者ID:linuxerwang,项目名称:HG20F9,代码行数:67,
示例5: pixcir_deletestatic void pixcir_delete(struct kref *kref){ struct pixcir_mt_usb *dev = to_pixcir_dev(kref); usb_put_dev(dev->udev); kfree(dev);}
开发者ID:unixjazz,项目名称:linux-mixtile,代码行数:6,
示例6: rausb_put_dev/*========================================================================Routine Description: Release a use of the usb device structure.Arguments: dev - the USB deviceReturn Value: NoneNote:========================================================================*/void rausb_put_dev(VOID *dev){ usb_put_dev((struct usb_device *)dev);}
开发者ID:AntonLytkin,项目名称:mt7601,代码行数:18,
示例7: line6_disconnect/* Line6 device disconnected.*/static void line6_disconnect(struct usb_interface *interface){ struct usb_line6 *line6; struct usb_device *usbdev; int interface_number; if (interface == NULL) return; usbdev = interface_to_usbdev(interface); if (usbdev == NULL) return; /* removal of additional special files should go here */ sysfs_remove_link(&interface->dev.kobj, "usb_device"); interface_number = interface->cur_altsetting->desc.bInterfaceNumber; line6 = usb_get_intfdata(interface); if (line6 != NULL) { if (line6->urb_listen != NULL) line6_stop_listen(line6); if (usbdev != line6->usbdev) dev_err(line6->ifcdev, "driver bug: inconsistent usb device/n"); switch (line6->usbdev->descriptor.idProduct) { case LINE6_DEVID_BASSPODXT: case LINE6_DEVID_BASSPODXTLIVE: case LINE6_DEVID_BASSPODXTPRO: case LINE6_DEVID_POCKETPOD: case LINE6_DEVID_PODX3: case LINE6_DEVID_PODX3LIVE: case LINE6_DEVID_PODXT: case LINE6_DEVID_PODXTPRO: line6_pod_disconnect(interface); break; case LINE6_DEVID_PODHD300: case LINE6_DEVID_PODHD500: line6_podhd_disconnect(interface); break; case LINE6_DEVID_PODXTLIVE: switch (interface_number) { case PODXTLIVE_INTERFACE_POD: line6_pod_disconnect(interface); break; case PODXTLIVE_INTERFACE_VARIAX: line6_variax_disconnect(interface); break; } break; case LINE6_DEVID_VARIAX: line6_variax_disconnect(interface); break; case LINE6_DEVID_PODSTUDIO_GX: case LINE6_DEVID_PODSTUDIO_UX1: case LINE6_DEVID_PODSTUDIO_UX2: case LINE6_DEVID_TONEPORT_GX: case LINE6_DEVID_TONEPORT_UX1: case LINE6_DEVID_TONEPORT_UX2: case LINE6_DEVID_GUITARPORT: line6_toneport_disconnect(interface); break; default: MISSING_CASE; } dev_info(&interface->dev, "Line6 %s now disconnected/n", line6->properties->name); } line6_destruct(interface); /* decrement reference counters: */ usb_put_intf(interface); usb_put_dev(usbdev);}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:88,
示例8: rausb_put_devvoid rausb_put_dev(struct usb_device *dev){ usb_put_dev(dev);}
开发者ID:jameshilliard,项目名称:stblinux-2.6.18_7405,代码行数:4,
示例9: ksb_usb_probestatic intksb_usb_probe(struct usb_interface *ifc, const struct usb_device_id *id){ __u8 ifc_num; struct usb_host_interface *ifc_desc; struct usb_endpoint_descriptor *ep_desc; int i; struct ks_bridge *ksb; ifc_num = ifc->cur_altsetting->desc.bInterfaceNumber; switch (id->idProduct) { case 0x9008: if (ifc_num != 0) return -ENODEV; ksb = __ksb[BOOT_BRIDGE_INDEX]; break; case 0x9048: case 0x904C: if (ifc_num != 2) return -ENODEV; ksb = __ksb[EFS_BRIDGE_INDEX]; break; default: return -ENODEV; } if (!ksb) { pr_err("ksb is not initialized"); return -ENODEV; } ksb->udev = usb_get_dev(interface_to_usbdev(ifc)); ksb->ifc = ifc; ifc_desc = ifc->cur_altsetting; for (i = 0; i < ifc_desc->desc.bNumEndpoints; i++) { ep_desc = &ifc_desc->endpoint[i].desc; if (!ksb->in_epAddr && usb_endpoint_is_bulk_in(ep_desc)) ksb->in_epAddr = ep_desc->bEndpointAddress; if (!ksb->out_epAddr && usb_endpoint_is_bulk_out(ep_desc)) ksb->out_epAddr = ep_desc->bEndpointAddress; } if (!(ksb->in_epAddr && ksb->out_epAddr)) { pr_err("could not find bulk in and bulk out endpoints"); usb_put_dev(ksb->udev); ksb->ifc = NULL; return -ENODEV; } ksb->in_pipe = usb_rcvbulkpipe(ksb->udev, ksb->in_epAddr); ksb->out_pipe = usb_sndbulkpipe(ksb->udev, ksb->out_epAddr); usb_set_intfdata(ifc, ksb); set_bit(USB_DEV_CONNECTED, &ksb->flags); dbg_log_event(ksb, "PID-ATT", id->idProduct, 0); ksb->fs_dev = (struct miscdevice *)id->driver_info; misc_register(ksb->fs_dev); ifc->needs_remote_wakeup = 1; usb_enable_autosuspend(ksb->udev); pr_debug("usb dev connected"); return 0;}
开发者ID:hiepgia,项目名称:android_kernel_lge_geeb,代码行数:71,
示例10: zfLnxProbestatic int zfLnxProbe(struct usb_interface *interface, const struct usb_device_id *id){ struct usb_device *dev = interface_to_usbdev(interface); struct net_device *net = NULL; struct usbdrv_private *macp = NULL; int vendor_id, product_id; int result = 0; usb_get_dev(dev); vendor_id = dev->descriptor.idVendor; product_id = dev->descriptor.idProduct;#ifdef HMAC_DEBUG printk(KERN_NOTICE "vendor_id = %04x/n", vendor_id); printk(KERN_NOTICE "product_id = %04x/n", product_id); if (dev->speed == USB_SPEED_HIGH) printk(KERN_NOTICE "USB 2.0 Host/n"); else printk(KERN_NOTICE "USB 1.1 Host/n");#endif if (!(macp = kmalloc(sizeof(struct usbdrv_private), GFP_KERNEL))) { printk(KERN_ERR "out of memory allocating device structure/n"); result = -ENOMEM; goto fail; } /* Zero the memory */ memset(macp, 0, sizeof(struct usbdrv_private)); net = alloc_etherdev(0); if (net == NULL) { printk(KERN_ERR "zfLnxProbe: Not able to alloc etherdev struct/n"); result = -ENOMEM; goto fail1; } strcpy(net->name, "ath%d"); net->ml_priv = macp; //kernel 2.6 macp->udev = dev; macp->device = net; /* set up the endpoint information */ /* check out the endpoints */ macp->interface = interface; //init_waitqueue_head(&macp->regSet_wait); //init_waitqueue_head(&macp->iorwRsp_wait); //init_waitqueue_head(&macp->term_wait); if (!zfLnxAllocAllUrbs(macp)) { result = -ENOMEM; goto fail2; } if (!zfLnxInitSetup(net, macp)) { result = -EIO; goto fail3; } else { usb_set_intfdata(interface, macp); SET_NETDEV_DEV(net, &interface->dev); if (register_netdev(net) != 0) { usb_set_intfdata(interface, NULL); goto fail3; } } netif_carrier_off(net); goto done;fail3: zfLnxFreeAllUrbs(macp);fail2: free_netdev(net); //kernel 2.6fail1: kfree(macp);fail: usb_put_dev(dev); macp = NULL;done: return result;}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:98,
示例11: i1480u_addstaticint i1480u_add(struct i1480u *i1480u, struct usb_interface *iface){ int result = -ENODEV; struct wlp *wlp = &i1480u->wlp; struct usb_device *usb_dev = interface_to_usbdev(iface); struct net_device *net_dev = i1480u->net_dev; struct uwb_rc *rc; struct uwb_dev *uwb_dev;#ifdef i1480u_FLOW_CONTROL struct usb_endpoint_descriptor *epd;#endif i1480u->usb_dev = usb_get_dev(usb_dev); i1480u->usb_iface = iface; rc = uwb_rc_get_by_grandpa(&i1480u->usb_dev->dev); if (rc == NULL) { dev_err(&iface->dev, "Cannot get associated UWB Radio " "Controller/n"); goto out; } wlp->xmit_frame = i1480u_xmit_frame; wlp->fill_device_info = i1480u_fill_device_info; wlp->stop_queue = i1480u_stop_queue; wlp->start_queue = i1480u_start_queue; result = wlp_setup(wlp, rc, net_dev); if (result < 0) { dev_err(&iface->dev, "Cannot setup WLP/n"); goto error_wlp_setup; } result = 0; ether_setup(net_dev); /* make it an etherdevice */ uwb_dev = &rc->uwb_dev; /* FIXME: hookup address change notifications? */ memcpy(net_dev->dev_addr, uwb_dev->mac_addr.data, sizeof(net_dev->dev_addr)); net_dev->hard_header_len = sizeof(struct untd_hdr_cmp) + sizeof(struct wlp_tx_hdr) + WLP_DATA_HLEN + ETH_HLEN; net_dev->mtu = 3500; net_dev->tx_queue_len = 20; /* FIXME: maybe use 1000? *//* net_dev->flags &= ~IFF_BROADCAST; FIXME: BUG in firmware */ /* FIXME: multicast disabled */ net_dev->flags &= ~IFF_MULTICAST; net_dev->features &= ~NETIF_F_SG; net_dev->features &= ~NETIF_F_FRAGLIST; /* All NETIF_F_*_CSUM disabled */ net_dev->features |= NETIF_F_HIGHDMA; net_dev->watchdog_timeo = 5*HZ; /* FIXME: a better default? */ net_dev->netdev_ops = &i1480u_netdev_ops;#ifdef i1480u_FLOW_CONTROL /* Notification endpoint setup (submitted when we open the device) */ i1480u->notif_urb = usb_alloc_urb(0, GFP_KERNEL); if (i1480u->notif_urb == NULL) { dev_err(&iface->dev, "Unable to allocate notification URB/n"); result = -ENOMEM; goto error_urb_alloc; } epd = &iface->cur_altsetting->endpoint[0].desc; usb_fill_int_urb(i1480u->notif_urb, usb_dev, usb_rcvintpipe(usb_dev, epd->bEndpointAddress), i1480u->notif_buffer, sizeof(i1480u->notif_buffer), i1480u_notif_cb, i1480u, epd->bInterval);#endif i1480u->tx_inflight.max = i1480u_TX_INFLIGHT_MAX; i1480u->tx_inflight.threshold = i1480u_TX_INFLIGHT_THRESHOLD; i1480u->tx_inflight.restart_ts = jiffies; usb_set_intfdata(iface, i1480u); return result;#ifdef i1480u_FLOW_CONTROLerror_urb_alloc:#endif wlp_remove(wlp);error_wlp_setup: uwb_rc_put(rc);out: usb_put_dev(i1480u->usb_dev); return result;}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:88,
示例12: go7007_loader_disconnectstatic void go7007_loader_disconnect(struct usb_interface *interface){ dev_info(&interface->dev, "disconnect/n"); usb_put_dev(interface_to_usbdev(interface)); usb_set_intfdata(interface, NULL);}
开发者ID:IDM350,项目名称:linux,代码行数:6,
示例13: rt2870_disconnect/*========================================================================Routine Description: Release allocated resources.Arguments: *dev Point to the PCI or USB device pAd driver control block pointerReturn Value: NoneNote:========================================================================*/static void rt2870_disconnect(struct usb_device *dev, VOID *pAd){ struct net_device *net_dev; DBGPRINT(RT_DEBUG_ERROR, ("rtusb_disconnect: unregister usbnet usb-%s-%s/n", dev->bus->bus_name, dev->devpath)); if (!pAd) {#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */ while(MOD_IN_USE > 0) { MOD_DEC_USE_COUNT; }#else usb_put_dev(dev);#endif /* LINUX_VERSION_CODE */ printk("rtusb_disconnect: pAd == NULL!/n"); return; }/* RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST); */ RTMP_DRIVER_NIC_NOT_EXIST_SET(pAd); /* for debug, wait to show some messages to /proc system */ udelay(1); RTMP_DRIVER_NET_DEV_GET(pAd, &net_dev); RtmpPhyNetDevExit(pAd, net_dev); /* FIXME: Shall we need following delay and flush the schedule?? */ udelay(1);#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */#else flush_scheduled_work();#endif /* LINUX_VERSION_CODE */ udelay(1);#ifdef CONFIG_HAS_EARLYSUSPEND RTMP_DRIVER_ADAPTER_UNREGISTER_EARLYSUSPEND(pAd);#endif#ifdef RT_CFG80211_SUPPORT RTMP_DRIVER_80211_UNREGISTER(pAd, net_dev);#endif /* RT_CFG80211_SUPPORT */ /* free the root net_device */// RtmpOSNetDevFree(net_dev); RtmpRaDevCtrlExit(pAd); /* free the root net_device */ RtmpOSNetDevFree(net_dev); /* release a use of the usb device structure */#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */ while(MOD_IN_USE > 0) { MOD_DEC_USE_COUNT; }#else usb_put_dev(dev);#endif /* LINUX_VERSION_CODE */ udelay(1); DBGPRINT(RT_DEBUG_ERROR, (" RTUSB disconnect successfully/n"));}
开发者ID:83GTIGuy,项目名称:openwrtSDN,代码行数:83,
示例14: go7007_loader_probestatic int go7007_loader_probe(struct usb_interface *interface, const struct usb_device_id *id){ struct usb_device *usbdev; const struct firmware *fw; u16 vendor, product; const char *fw1, *fw2; int ret; int i; usbdev = usb_get_dev(interface_to_usbdev(interface)); if (!usbdev) goto failed2; if (usbdev->descriptor.bNumConfigurations != 1) { dev_err(&interface->dev, "can't handle multiple config/n"); goto failed2; } vendor = le16_to_cpu(usbdev->descriptor.idVendor); product = le16_to_cpu(usbdev->descriptor.idProduct); for (i = 0; fw_configs[i].fw_name1; i++) if (fw_configs[i].vendor == vendor && fw_configs[i].product == product) break; /* Should never happen */ if (fw_configs[i].fw_name1 == NULL) goto failed2; fw1 = fw_configs[i].fw_name1; fw2 = fw_configs[i].fw_name2; dev_info(&interface->dev, "loading firmware %s/n", fw1); if (request_firmware(&fw, fw1, &usbdev->dev)) { dev_err(&interface->dev, "unable to load firmware from file /"%s/"/n", fw1); goto failed2; } ret = cypress_load_firmware(usbdev, fw, CYPRESS_FX2); release_firmware(fw); if (0 != ret) { dev_err(&interface->dev, "loader download failed/n"); goto failed2; } if (fw2 == NULL) return 0; if (request_firmware(&fw, fw2, &usbdev->dev)) { dev_err(&interface->dev, "unable to load firmware from file /"%s/"/n", fw2); goto failed2; } ret = cypress_load_firmware(usbdev, fw, CYPRESS_FX2); release_firmware(fw); if (0 != ret) { dev_err(&interface->dev, "firmware download failed/n"); goto failed2; } return 0;failed2: usb_put_dev(usbdev); dev_err(&interface->dev, "probe failed/n"); return -ENODEV;}
开发者ID:IDM350,项目名称:linux,代码行数:69,
示例15: i2400mu_probe//.........这里部分代码省略......... const struct usb_device_id *id){ int result; struct net_device *net_dev; struct device *dev = &iface->dev; struct i2400m *i2400m; struct i2400mu *i2400mu; struct usb_device *usb_dev = interface_to_usbdev(iface); if (usb_dev->speed != USB_SPEED_HIGH) dev_err(dev, "device not connected as high speed/n"); /* Allocate instance [calls i2400m_netdev_setup() on it]. */ result = -ENOMEM; net_dev = alloc_netdev(sizeof(*i2400mu), "wmx%d", i2400mu_netdev_setup); if (net_dev == NULL) { dev_err(dev, "no memory for network device instance/n"); goto error_alloc_netdev; } SET_NETDEV_DEV(net_dev, dev); SET_NETDEV_DEVTYPE(net_dev, &i2400mu_type); i2400m = net_dev_to_i2400m(net_dev); i2400mu = container_of(i2400m, struct i2400mu, i2400m); i2400m->wimax_dev.net_dev = net_dev; i2400mu->usb_dev = usb_get_dev(usb_dev); i2400mu->usb_iface = iface; usb_set_intfdata(iface, i2400mu); i2400m->bus_tx_block_size = I2400MU_BLK_SIZE; /* * Room required in the Tx queue for USB message to accommodate * a smallest payload while allocating header space is 16 bytes. * Adding this room for the new tx message increases the * possibilities of including any payload with size <= 16 bytes. */ i2400m->bus_tx_room_min = I2400MU_BLK_SIZE; i2400m->bus_pl_size_max = I2400MU_PL_SIZE_MAX; i2400m->bus_setup = NULL; i2400m->bus_dev_start = i2400mu_bus_dev_start; i2400m->bus_dev_stop = i2400mu_bus_dev_stop; i2400m->bus_release = NULL; i2400m->bus_tx_kick = i2400mu_bus_tx_kick; i2400m->bus_reset = i2400mu_bus_reset; i2400m->bus_bm_retries = I2400M_USB_BOOT_RETRIES; i2400m->bus_bm_cmd_send = i2400mu_bus_bm_cmd_send; i2400m->bus_bm_wait_for_ack = i2400mu_bus_bm_wait_for_ack; i2400m->bus_bm_mac_addr_impaired = 0; switch (id->idProduct) { case USB_DEVICE_ID_I6050: case USB_DEVICE_ID_I6050_2: case USB_DEVICE_ID_I6250: i2400mu->i6050 = 1; break; default: break; } if (i2400mu->i6050) { i2400m->bus_fw_names = i2400mu_bus_fw_names_6050; i2400mu->endpoint_cfg.bulk_out = 0; i2400mu->endpoint_cfg.notification = 3; i2400mu->endpoint_cfg.reset_cold = 2; i2400mu->endpoint_cfg.bulk_in = 1; } else { i2400m->bus_fw_names = i2400mu_bus_fw_names_5x50; i2400mu->endpoint_cfg.bulk_out = 0; i2400mu->endpoint_cfg.notification = 1; i2400mu->endpoint_cfg.reset_cold = 2; i2400mu->endpoint_cfg.bulk_in = 3; }#ifdef CONFIG_PM iface->needs_remote_wakeup = 1; /* autosuspend (15s delay) */ device_init_wakeup(dev, 1); pm_runtime_set_autosuspend_delay(&usb_dev->dev, 15000); usb_enable_autosuspend(usb_dev);#endif result = i2400m_setup(i2400m, I2400M_BRI_MAC_REINIT); if (result < 0) { dev_err(dev, "cannot setup device: %d/n", result); goto error_setup; } result = i2400mu_debugfs_add(i2400mu); if (result < 0) { dev_err(dev, "Can't register i2400mu's debugfs: %d/n", result); goto error_debugfs_add; } return 0;error_debugfs_add: i2400m_release(i2400m);error_setup: usb_set_intfdata(iface, NULL); usb_put_dev(i2400mu->usb_dev); free_netdev(net_dev);error_alloc_netdev: return result;}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:101,
示例16: smdhsic_disconnectstatic void smdhsic_disconnect(struct usb_interface *intf){ int devid; struct usb_interface *smd_intf; struct str_intf_priv *intfpriv; struct usb_device *device = NULL; pr_info("%s: Called/n", __func__); intfpriv = usb_get_intfdata(intf); if (!intfpriv) { pr_err("%s: intfpriv is NULL/n", __func__); goto err_get_intfdata; } device = get_usb_device(intfpriv); devid = GET_DEVID(intfpriv->devid); pr_debug("%s : devid : %d/n", __func__, devid); smd_intf = get_usb_intf(intfpriv); if (!smd_intf) { pr_err("smd_intf is NULL/n"); goto err_get_usb_intf; } if (smd_intf != intf) { pr_err("smd_intf is not same intf/n"); goto err_mismatched_intf; } usb_driver_release_interface(get_usb_driver(intf), smd_intf); if (!device) usb_put_dev(device); switch (devid) { case FMT_DEV_ID: pm_runtime_disable(&device->dev); if (g_usbdev.hsic) cancel_delayed_work(&g_usbdev.hsic->pm_runtime_work); smdctl_request_connection_recover(true); case RAW_DEV_ID: case RFS_DEV_ID: case CMD_DEV_ID: case DOWN_DEV_ID: if (emu_discon_func[devid]) emu_discon_func[devid](g_usbdev.smd_device[devid]); else kfree(intfpriv->data); break; default: pr_warn("%s:Undefined Callback Function/n", __func__); } /* Power on/off kernel-panic workaround, * if USB suspend cmd was queued in power.work before disconnect, * reset the runtime PM request value to PM_REQ_NONE */ device->dev.power.request = RPM_REQ_NONE; kfree(intfpriv); usb_set_intfdata(intf, NULL); g_usbdev.usbdev = NULL; g_usbdev.suspended = 0; g_usbdev.hsic = NULL; return;err_mismatched_intf:err_get_usb_intf: if (device) usb_put_dev(device);err_get_intfdata: pr_err("release(2) : %p/n", intf); usb_driver_release_interface(get_usb_driver(intf), intf); return;}
开发者ID:motley-git,项目名称:Kernel-GT-P7310,代码行数:77,
示例17: tmsi_deletestatic void tmsi_delete(struct kref *kref) { struct tmsi_data* dev = container_of(kref, struct tmsi_data, kref); usb_put_dev(dev->udev); kfree(dev); info("Tmsi device deleted");}
开发者ID:niklasrogers,项目名称:openbci,代码行数:6,
示例18: mephisto_probe//.........这里部分代码省略.........#ifndef init_MUTEX sema_init(dev->usb_semaphore, 1);#else init_MUTEX(dev->usb_semaphore);#endif /// Initialize variables. dev->dev = usb_get_dev(interface_to_usbdev(interface)); if(!dev->dev) { PERROR("Error while request for usb device./n"); err = -ENODEV; goto ERROR_2; } /// Initialize hardware usb_set_intfdata(interface, dev); /// Read serial number#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) tmp = (dev->dev->serial + strlen(dev->dev->serial)); serial_no = simple_strtoul(dev->dev->serial + 2, &tmp, 16);#else if (strict_strtoul(dev->dev->serial + 2, 16, &serial_no)) { serial_no = 0; }#endif dev->serial_no = serial_no; /// Hardware init mephisto_endpoints_reset(dev);/** Choice: a) New device connected. Add to device list. b) Old device reconected. Refresh device structure.*/ o_device = find_device_on_list(dev, ME_PLUGGED_ANY); if(o_device) { PDEBUG("Old device./n"); // Old device. if (o_device->bus.plugged == ME_PLUGGED_IN) { // Error device is already on list mark as active! PERROR("Device is already on list mark as active!/n"); o_device->me_device_disconnect(o_device); } } else { PDEBUG("New device./n"); } PINFO("CALLING %s constructor/n", "mephisto_constr"); n_device = mephisto_constr(dev, o_device); if (!n_device) { PERROR("Executing '%s()' failed./n", "mephisto_constr"); err = -ENODEV; goto ERROR_3; } else if (!o_device) { PINFO("Adding new entry to device list./n"); insert_to_device_list(n_device); } if (n_device->me_device_postinit) { if (n_device->me_device_postinit(n_device, NULL)) { PERROR("Error while calling me_device_postinit()./n"); /// This error can be ignored. } else { PDEBUG("me_device_postinit() was sucessful./n"); } } else { PERROR("me_device_postinit() not registred!/n"); } return 0;ERROR_3: usb_put_dev(interface_to_usbdev(interface));ERROR_2: kfree(dev->usb_semaphore);ERROR_1: kfree(dev);ERROR_0: return err;}
开发者ID:imrehg,项目名称:meids,代码行数:101,
示例19: bridge_probestatic int bridge_probe(struct usb_interface *iface, const struct usb_device_id *id){ struct usb_host_endpoint *endpoint = NULL; struct usb_host_endpoint *bulk_in = NULL; struct usb_host_endpoint *bulk_out = NULL; struct usb_host_endpoint *int_in = NULL; struct usb_host_endpoint *data_int_in = NULL; struct usb_device *udev; int i; int status = 0; int numends; int ch_id; char **bname = (char **)id->driver_info; if (iface->num_altsetting != 1) { pr_err("%s invalid num_altsetting %u/n", __func__, iface->num_altsetting); return -EINVAL; } udev = interface_to_usbdev(iface); usb_get_dev(udev); numends = iface->cur_altsetting->desc.bNumEndpoints; for (i = 0; i < numends; i++) { endpoint = iface->cur_altsetting->endpoint + i; if (!endpoint) { dev_err(&iface->dev, "%s: invalid endpoint %u/n", __func__, i); status = -EINVAL; goto out; } if (usb_endpoint_is_bulk_in(&endpoint->desc)) bulk_in = endpoint; else if (usb_endpoint_is_bulk_out(&endpoint->desc)) bulk_out = endpoint; else if (usb_endpoint_is_int_in(&endpoint->desc)) { if (int_in != 0) data_int_in = endpoint; else int_in = endpoint; } } if (((numends == 3) && ((!bulk_in && !data_int_in) || !bulk_out || !int_in)) || ((numends == 1) && !bulk_in)) { dev_err(&iface->dev, "%s: invalid endpoints/n", __func__); status = -EINVAL; goto out; } ch_id = get_bridge_dev_idx(); if (ch_id < 0) { pr_err("%s all bridge channels claimed. Probe failed/n", __func__); return -ENODEV; } if (data_int_in) { __dev[ch_id]->use_int_in_pipe = true; __dev[ch_id]->period = data_int_in->desc.bInterval; status = data_bridge_probe(iface, data_int_in, bulk_out, bname[BRIDGE_DATA_IDX], ch_id); } else { status = data_bridge_probe(iface, bulk_in, bulk_out, bname[BRIDGE_DATA_IDX], ch_id); } if (status < 0) { dev_err(&iface->dev, "data_bridge_probe failed %d/n", status); goto out; } status = ctrl_bridge_probe(iface, int_in, bname[BRIDGE_CTRL_IDX], ch_id); if (status < 0) { dev_err(&iface->dev, "ctrl_bridge_probe failed %d/n", status); goto error; } return 0;error: platform_device_unregister(__dev[ch_id]->pdev); free_rx_urbs(__dev[ch_id]); usb_set_intfdata(iface, NULL);out: usb_put_dev(udev); return status;}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:93,
示例20: usbdev_trig_name_storestatic ssize_t usbdev_trig_name_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size){ struct led_classdev *led_cdev = dev_get_drvdata(dev); struct usbdev_trig_data *td = led_cdev->trigger_data; if (size < 0 || size >= DEV_BUS_ID_SIZE) return -EINVAL; write_lock(&td->lock); strcpy(td->device_name, buf); if (size > 0 && td->device_name[size - 1] == '/n') td->device_name[size - 1] = 0; if (td->device_name[0] != 0) { struct usbdev_trig_match match = { .device_name = td->device_name, }; /* check for existing device to update from */ usb_for_each_dev(&match, usbdev_trig_find_usb_dev); if (match.usb_dev) { if (td->usb_dev) usb_put_dev(td->usb_dev); td->usb_dev = match.usb_dev; td->last_urbnum = atomic_read(&match.usb_dev->urbnum); } /* updates LEDs, may start timers */ usbdev_trig_update_state(td); } write_unlock(&td->lock); return size;}static DEVICE_ATTR(device_name, 0644, usbdev_trig_name_show, usbdev_trig_name_store);static ssize_t usbdev_trig_interval_show(struct device *dev, struct device_attribute *attr, char *buf){ struct led_classdev *led_cdev = dev_get_drvdata(dev); struct usbdev_trig_data *td = led_cdev->trigger_data; read_lock(&td->lock); sprintf(buf, "%u/n", jiffies_to_msecs(td->interval)); read_unlock(&td->lock); return strlen(buf) + 1;}static ssize_t usbdev_trig_interval_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size){ struct led_classdev *led_cdev = dev_get_drvdata(dev); struct usbdev_trig_data *td = led_cdev->trigger_data; int ret = -EINVAL; char *after; unsigned long value = simple_strtoul(buf, &after, 10); size_t count = after - buf; if (*after && isspace(*after)) count++; if (count == size && value <= 10000) { write_lock(&td->lock); td->interval = msecs_to_jiffies(value); usbdev_trig_update_state(td); /* resets timer */ write_unlock(&td->lock); ret = count; } return ret;}static DEVICE_ATTR(activity_interval, 0644, usbdev_trig_interval_show, usbdev_trig_interval_store);static int usbdev_trig_notify(struct notifier_block *nb, unsigned long evt, void *data){ struct usb_device *usb_dev; struct usbdev_trig_data *td; if (evt != USB_DEVICE_ADD && evt != USB_DEVICE_REMOVE) return NOTIFY_DONE; usb_dev = data; td = container_of(nb, struct usbdev_trig_data, notifier); write_lock(&td->lock);//.........这里部分代码省略.........
开发者ID:CZ-NIC,项目名称:turris-os,代码行数:101,
示例21: bridge_probestatic int __devinitbridge_probe(struct usb_interface *iface, const struct usb_device_id *id){ struct usb_host_endpoint *endpoint = NULL; struct usb_host_endpoint *bulk_in = NULL; struct usb_host_endpoint *bulk_out = NULL; struct usb_host_endpoint *int_in = NULL; struct usb_device *udev; int i; int status = 0; int numends; int ch_id; char **bname = (char **)id->driver_info; if (iface->num_altsetting != 1) { err("%s invalid num_altsetting %u/n", __func__, iface->num_altsetting); return -EINVAL; } udev = interface_to_usbdev(iface); usb_get_dev(udev); numends = iface->cur_altsetting->desc.bNumEndpoints; for (i = 0; i < numends; i++) { endpoint = iface->cur_altsetting->endpoint + i; if (!endpoint) { dev_err(&iface->dev, "%s: invalid endpoint %u/n", __func__, i); status = -EINVAL; goto out; } if (usb_endpoint_is_bulk_in(&endpoint->desc)) bulk_in = endpoint; else if (usb_endpoint_is_bulk_out(&endpoint->desc)) bulk_out = endpoint; else if (usb_endpoint_is_int_in(&endpoint->desc)) int_in = endpoint; } if (!bulk_in || !bulk_out || !int_in) { dev_err(&iface->dev, "%s: invalid endpoints/n", __func__); status = -EINVAL; goto out; } ch_id = get_bridge_dev_idx(); if (ch_id < 0) { err("%s all bridge channels claimed. Probe failed/n", __func__); return -ENODEV; } status = data_bridge_probe(iface, bulk_in, bulk_out, bname[BRIDGE_DATA_IDX], ch_id); if (status < 0) { dev_err(&iface->dev, "data_bridge_probe failed %d/n", status); goto out; } status = ctrl_bridge_probe(iface, int_in, bname[BRIDGE_CTRL_IDX], ch_id); if (status < 0) { dev_err(&iface->dev, "ctrl_bridge_probe failed %d/n", status); goto error; }// ASUS_BSP+++ Wenli "tty device for AT command"#ifndef DISABLE_ASUS_DUN pr_info("%s: bridge probe success/n", __func__); if (ch_id == DUN_DATA_ID) { is_open_asus = false; is_open_usb = false; gdun_tty = NULL; ctrl_bridge_init_asus(); s_is_bridge_init = true; pr_info("%s: gdun connect/n", __func__); }#endif// ASUS_BSP--- Wenli "tty device for AT command" return 0;error: platform_device_unregister(__dev[ch_id]->pdev); free_rx_urbs(__dev[ch_id]); usb_set_intfdata(iface, NULL);out: usb_put_dev(udev); return status;}
开发者ID:msva,项目名称:android_kernel_asus_A80,代码行数:91,
示例22: ath6kl_usb_removestatic void ath6kl_usb_remove(struct usb_interface *interface){ usb_put_dev(interface_to_usbdev(interface)); ath6kl_usb_device_detached(interface);}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:5,
示例23: asus_oled_probe//.........这里部分代码省略......... if (!id) { /* Even possible? Just to make sure...*/ dev_err(&interface->dev, "No usb_device_id provided!/n"); return -ENODEV; } for (; dev_desc->idVendor; dev_desc++) { if (dev_desc->idVendor == id->idVendor && dev_desc->idProduct == id->idProduct) { dev_width = dev_desc->devWidth; desc = dev_desc->devDesc; pack_mode = dev_desc->packMode; break; } } if (!desc || dev_width < 1 || pack_mode == PACK_MODE_LAST) { dev_err(&interface->dev, "Missing or incomplete device description!/n"); return -ENODEV; } odev = kzalloc(sizeof(struct asus_oled_dev), GFP_KERNEL); if (odev == NULL) { dev_err(&interface->dev, "Out of memory/n"); return -ENOMEM; } odev->udev = usb_get_dev(udev); odev->pic_mode = ASUS_OLED_STATIC; odev->dev_width = dev_width; odev->pack_mode = pack_mode; odev->height = 0; odev->width = 0; odev->x_shift = 0; odev->y_shift = 0; odev->buf_offs = 0; odev->buf_size = 0; odev->last_val = 0; odev->buf = NULL; odev->enabled = 1; odev->dev = NULL; usb_set_intfdata(interface, odev); retval = device_create_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(enabled)); if (retval) goto err_files; retval = device_create_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(picture)); if (retval) goto err_files; odev->dev = device_create(oled_class, &interface->dev, MKDEV(0, 0), NULL, "oled_%d", ++oled_num); if (IS_ERR(odev->dev)) { retval = PTR_ERR(odev->dev); goto err_files; } dev_set_drvdata(odev->dev, odev); retval = device_create_file(odev->dev, &dev_attr_enabled); if (retval) goto err_class_enabled; retval = device_create_file(odev->dev, &dev_attr_picture); if (retval) goto err_class_picture; dev_info(&interface->dev, "Attached Asus OLED device: %s [width %u, pack_mode %d]/n", desc, odev->dev_width, odev->pack_mode); if (start_off) enable_oled(odev, 0); return 0;err_class_picture: device_remove_file(odev->dev, &dev_attr_picture);err_class_enabled: device_remove_file(odev->dev, &dev_attr_enabled); device_unregister(odev->dev);err_files: device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(enabled)); device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(picture)); usb_set_intfdata(interface, NULL); usb_put_dev(odev->udev); kfree(odev); return retval;}
开发者ID:kapoloclubs,项目名称:diana,代码行数:101,
示例24: p54u_probestatic int __devinit p54u_probe(struct usb_interface *intf, const struct usb_device_id *id){ struct usb_device *udev = interface_to_usbdev(intf); struct ieee80211_hw *dev; struct p54u_priv *priv; int err; unsigned int i, recognized_pipes; DECLARE_MAC_BUF(mac); dev = p54_init_common(sizeof(*priv)); if (!dev) { printk(KERN_ERR "prism54usb: ieee80211 alloc failed/n"); return -ENOMEM; } priv = dev->priv; SET_IEEE80211_DEV(dev, &intf->dev); usb_set_intfdata(intf, dev); priv->udev = udev; usb_get_dev(udev); /* really lazy and simple way of figuring out if we're a 3887 */ /* TODO: should just stick the identification in the device table */ i = intf->altsetting->desc.bNumEndpoints; recognized_pipes = 0; while (i--) { switch (intf->altsetting->endpoint[i].desc.bEndpointAddress) { case P54U_PIPE_DATA: case P54U_PIPE_MGMT: case P54U_PIPE_BRG: case P54U_PIPE_DEV: case P54U_PIPE_DATA | USB_DIR_IN: case P54U_PIPE_MGMT | USB_DIR_IN: case P54U_PIPE_BRG | USB_DIR_IN: case P54U_PIPE_DEV | USB_DIR_IN: case P54U_PIPE_INT | USB_DIR_IN: recognized_pipes++; } } priv->common.open = p54u_open; if (recognized_pipes < P54U_PIPE_NUMBER) { priv->hw_type = P54U_3887; priv->common.tx = p54u_tx_3887; } else { dev->extra_tx_headroom += sizeof(struct net2280_tx_hdr); priv->common.tx_hdr_len = sizeof(struct net2280_tx_hdr); priv->common.tx = p54u_tx_net2280; } priv->common.stop = p54u_stop; if (priv->hw_type) err = p54u_upload_firmware_3887(dev); else err = p54u_upload_firmware_net2280(dev); if (err) goto err_free_dev; err = p54u_read_eeprom(dev); if (err) goto err_free_dev; if (!is_valid_ether_addr(dev->wiphy->perm_addr)) { u8 perm_addr[ETH_ALEN]; printk(KERN_WARNING "prism54usb: Invalid hwaddr! Using randomly generated MAC addr/n"); random_ether_addr(perm_addr); SET_IEEE80211_PERM_ADDR(dev, perm_addr); } skb_queue_head_init(&priv->rx_queue); err = ieee80211_register_hw(dev); if (err) { printk(KERN_ERR "prism54usb: Cannot register netdevice/n"); goto err_free_dev; } printk(KERN_INFO "%s: hwaddr %s, isl38%02x/n", wiphy_name(dev->wiphy), print_mac(mac, dev->wiphy->perm_addr), priv->common.version); return 0; err_free_dev: ieee80211_free_hw(dev); usb_set_intfdata(intf, NULL); usb_put_dev(udev); return err;}
开发者ID:deepikateriar,项目名称:Onlive-Source-Backup,代码行数:94,
示例25: prism2sta_probe_usbstatic int prism2sta_probe_usb(struct usb_interface *interface, const struct usb_device_id *id){ struct usb_device *dev; wlandevice_t *wlandev = NULL; hfa384x_t *hw = NULL; int result = 0; dev = interface_to_usbdev(interface); wlandev = create_wlan(); if (!wlandev) { dev_err(&interface->dev, "Memory allocation failure./n"); result = -EIO; goto failed; } hw = wlandev->priv; if (wlan_setup(wlandev, &(interface->dev)) != 0) { dev_err(&interface->dev, "wlan_setup() failed./n"); result = -EIO; goto failed; } /* Initialize the hw data */ hfa384x_create(hw, dev); hw->wlandev = wlandev; /* Register the wlandev, this gets us a name and registers the * linux netdevice. */ SET_NETDEV_DEV(wlandev->netdev, &(interface->dev)); /* Do a chip-level reset on the MAC */ if (prism2_doreset) { result = hfa384x_corereset(hw, prism2_reset_holdtime, prism2_reset_settletime, 0); if (result != 0) { result = -EIO; dev_err(&interface->dev, "hfa384x_corereset() failed./n"); goto failed_reset; } } usb_get_dev(dev); wlandev->msdstate = WLAN_MSD_HWPRESENT; /* Try and load firmware, then enable card before we register */ prism2_fwtry(dev, wlandev); prism2sta_ifstate(wlandev, P80211ENUM_ifstate_enable); if (register_wlandev(wlandev) != 0) { dev_err(&interface->dev, "register_wlandev() failed./n"); result = -EIO; goto failed_register; } goto done;failed_register: usb_put_dev(dev);failed_reset: wlan_unsetup(wlandev);failed: kfree(wlandev); kfree(hw); wlandev = NULL;done: usb_set_intfdata(interface, wlandev); return result;}
开发者ID:020gzh,项目名称:linux,代码行数:75,
注:本文中的usb_put_dev函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ usb_put_hcd函数代码示例 C++ usb_pipein函数代码示例 |