static int __devinit 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_device *udev; int i; int status = 0; int numends; unsigned int iface_num; iface_num = iface->cur_altsetting->desc.bInterfaceNumber; 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); if (!test_bit(iface_num, &id->driver_info)) return -ENODEV; numends = iface->cur_altsetting->desc.bNumEndpoints; for (i = 0; i < numends; i++) { endpoint = iface->cur_altsetting->endpoint + i; if (!endpoint) { dev_err(&udev->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(&udev->dev, "%s: invalid endpoints\n", __func__); status = -EINVAL; goto out; } status = data_bridge_probe(iface, bulk_in, bulk_out, ch_id); if (status < 0) { dev_err(&udev->dev, "data_bridge_probe failed %d\n", status); goto out; } status = ctrl_bridge_probe(iface, int_in, ch_id); if (status < 0) { dev_err(&udev->dev, "ctrl_bridge_probe failed %d\n", status); goto free_data_bridge; } ch_id++; return 0; free_data_bridge: platform_device_del(__dev[ch_id]->pdev); usb_set_intfdata(iface, NULL); kfree(__dev[ch_id]); __dev[ch_id] = NULL; out: usb_put_dev(udev); return status; }
static int __devinit 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_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; }
static int __devinit 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_device *udev; int i; int status = 0; int numends; int ch_id; char **bname = (char **)id->driver_info; unsigned int iface_num; iface_num = iface->cur_altsetting->desc.bInterfaceNumber; 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); printk(KERN_INFO "%s: iface_num:%d\n", __func__, iface_num); if (!usb_diag_enable && iface_num == DUN_IFC_NUM && (board_mfg_mode() == 8 || board_mfg_mode() == 6 || board_mfg_mode() == 2)) { printk(KERN_INFO "%s DUN channel is NOT enumed as bridge interface!!! MAY be switched to TTY interface!!!", __func__); return -ENODEV; } 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; } 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; }
static 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; }
static int __devinit 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_device *udev; int i; int status = 0; int numends; unsigned int iface_num; iface_num = iface->cur_altsetting->desc.bInterfaceNumber; if (iface->num_altsetting != 1) { err("%s invalid num_altsetting %u\n", __func__, iface->num_altsetting); return -EINVAL; } if (!test_bit(iface_num, &id->driver_info)) return -ENODEV; udev = interface_to_usbdev(iface); usb_get_dev(udev); /* ++SSD_RIL: If the radio flag 20000 is not set, switch the DUN to TTY interface */ printk(KERN_INFO "%s: iface number is %d", __func__, iface_num); if (!usb_diag_enable && iface_num == DUN_IFC_NUM && (board_mfg_mode() == 8 || board_mfg_mode() == 6 || board_mfg_mode() == 2)) { printk(KERN_INFO "%s DUN channel is NOT enumed as bridge interface!!! MAY be switched to TTY interface!!!", __func__); return -ENODEV; } /* --SSD_RIL */ 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; } status = data_bridge_probe(iface, bulk_in, bulk_out, 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, ch_id); if (status < 0) { dev_err(&iface->dev, "ctrl_bridge_probe failed %d\n", status); goto free_data_bridge; } ch_id++; return 0; free_data_bridge: platform_device_unregister(__dev[ch_id]->pdev); usb_set_intfdata(iface, NULL); kfree(__dev[ch_id]); __dev[ch_id] = NULL; out: usb_put_dev(udev); return status; }