Commit a9746e40 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'usb-4.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB/PHY fixes from Greg KH:
 "Here are a number of small USB and PHY driver fixes for 4.15-rc6.

  Nothing major, but there are a number of regression fixes in here that
  resolve issues that have been reported a bunch. There are also the
  usual xhci fixes as well as a number of new usb serial device ids.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'usb-4.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  usb: xhci: Add XHCI_TRUST_TX_LENGTH for Renesas uPD720201
  xhci: Fix use-after-free in xhci debugfs
  xhci: Fix xhci debugfs NULL pointer dereference in resume from hibernate
  USB: serial: ftdi_sio: add id for Airbus DS P8GR
  usb: Add device quirk for Logitech HD Pro Webcam C925e
  usb: add RESET_RESUME for ELSA MicroLink 56K
  usbip: fix usbip bind writing random string after command in match_busid
  usbip: stub_rx: fix static checker warning on unnecessary checks
  usbip: prevent leaking socket pointer address in messages
  usbip: stub: stop printing kernel pointer addresses in messages
  usbip: vhci: stop printing kernel pointer addresses in messages
  USB: Fix off by one in type-specific length check of BOS SSP capability
  USB: serial: option: adding support for YUGA CLM920-NC5
  phy: rcar-gen3-usb2: select USB_COMMON
  phy: rockchip-typec: add pm_runtime_disable in err case
  phy: cpcap-usb: Fix platform_get_irq_byname's error checking.
  phy: tegra: fix device-tree node lookups
  USB: serial: qcserial: add Sierra Wireless EM7565
  USB: serial: option: add support for Telit ME910 PID 0x1101
  USB: chipidea: msm: fix ulpi-node lookup
parents c0b23903 da997066
...@@ -310,7 +310,7 @@ static int cpcap_usb_init_irq(struct platform_device *pdev, ...@@ -310,7 +310,7 @@ static int cpcap_usb_init_irq(struct platform_device *pdev,
int irq, error; int irq, error;
irq = platform_get_irq_byname(pdev, name); irq = platform_get_irq_byname(pdev, name);
if (!irq) if (irq < 0)
return -ENODEV; return -ENODEV;
error = devm_request_threaded_irq(ddata->dev, irq, NULL, error = devm_request_threaded_irq(ddata->dev, irq, NULL,
......
...@@ -12,7 +12,9 @@ config PHY_RCAR_GEN3_USB2 ...@@ -12,7 +12,9 @@ config PHY_RCAR_GEN3_USB2
tristate "Renesas R-Car generation 3 USB 2.0 PHY driver" tristate "Renesas R-Car generation 3 USB 2.0 PHY driver"
depends on ARCH_RENESAS depends on ARCH_RENESAS
depends on EXTCON depends on EXTCON
depends on USB_SUPPORT
select GENERIC_PHY select GENERIC_PHY
select USB_COMMON
help help
Support for USB 2.0 PHY found on Renesas R-Car generation 3 SoCs. Support for USB 2.0 PHY found on Renesas R-Car generation 3 SoCs.
......
...@@ -1137,6 +1137,7 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev) ...@@ -1137,6 +1137,7 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
if (IS_ERR(phy)) { if (IS_ERR(phy)) {
dev_err(dev, "failed to create phy: %s\n", dev_err(dev, "failed to create phy: %s\n",
child_np->name); child_np->name);
pm_runtime_disable(dev);
return PTR_ERR(phy); return PTR_ERR(phy);
} }
...@@ -1146,6 +1147,7 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev) ...@@ -1146,6 +1147,7 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
if (IS_ERR(phy_provider)) { if (IS_ERR(phy_provider)) {
dev_err(dev, "Failed to register phy provider\n"); dev_err(dev, "Failed to register phy provider\n");
pm_runtime_disable(dev);
return PTR_ERR(phy_provider); return PTR_ERR(phy_provider);
} }
......
...@@ -75,14 +75,14 @@ MODULE_DEVICE_TABLE(of, tegra_xusb_padctl_of_match); ...@@ -75,14 +75,14 @@ MODULE_DEVICE_TABLE(of, tegra_xusb_padctl_of_match);
static struct device_node * static struct device_node *
tegra_xusb_find_pad_node(struct tegra_xusb_padctl *padctl, const char *name) tegra_xusb_find_pad_node(struct tegra_xusb_padctl *padctl, const char *name)
{ {
/* struct device_node *pads, *np;
* of_find_node_by_name() drops a reference, so make sure to grab one.
*/
struct device_node *np = of_node_get(padctl->dev->of_node);
np = of_find_node_by_name(np, "pads"); pads = of_get_child_by_name(padctl->dev->of_node, "pads");
if (np) if (!pads)
np = of_find_node_by_name(np, name); return NULL;
np = of_get_child_by_name(pads, name);
of_node_put(pads);
return np; return np;
} }
...@@ -90,16 +90,16 @@ tegra_xusb_find_pad_node(struct tegra_xusb_padctl *padctl, const char *name) ...@@ -90,16 +90,16 @@ tegra_xusb_find_pad_node(struct tegra_xusb_padctl *padctl, const char *name)
static struct device_node * static struct device_node *
tegra_xusb_pad_find_phy_node(struct tegra_xusb_pad *pad, unsigned int index) tegra_xusb_pad_find_phy_node(struct tegra_xusb_pad *pad, unsigned int index)
{ {
/* struct device_node *np, *lanes;
* of_find_node_by_name() drops a reference, so make sure to grab one.
*/
struct device_node *np = of_node_get(pad->dev.of_node);
np = of_find_node_by_name(np, "lanes"); lanes = of_get_child_by_name(pad->dev.of_node, "lanes");
if (!np) if (!lanes)
return NULL; return NULL;
return of_find_node_by_name(np, pad->soc->lanes[index].name); np = of_get_child_by_name(lanes, pad->soc->lanes[index].name);
of_node_put(lanes);
return np;
} }
static int static int
...@@ -195,7 +195,7 @@ int tegra_xusb_pad_register(struct tegra_xusb_pad *pad, ...@@ -195,7 +195,7 @@ int tegra_xusb_pad_register(struct tegra_xusb_pad *pad,
unsigned int i; unsigned int i;
int err; int err;
children = of_find_node_by_name(pad->dev.of_node, "lanes"); children = of_get_child_by_name(pad->dev.of_node, "lanes");
if (!children) if (!children)
return -ENODEV; return -ENODEV;
...@@ -444,21 +444,21 @@ static struct device_node * ...@@ -444,21 +444,21 @@ static struct device_node *
tegra_xusb_find_port_node(struct tegra_xusb_padctl *padctl, const char *type, tegra_xusb_find_port_node(struct tegra_xusb_padctl *padctl, const char *type,
unsigned int index) unsigned int index)
{ {
/* struct device_node *ports, *np;
* of_find_node_by_name() drops a reference, so make sure to grab one.
*/
struct device_node *np = of_node_get(padctl->dev->of_node);
np = of_find_node_by_name(np, "ports");
if (np) {
char *name; char *name;
ports = of_get_child_by_name(padctl->dev->of_node, "ports");
if (!ports)
return NULL;
name = kasprintf(GFP_KERNEL, "%s-%u", type, index); name = kasprintf(GFP_KERNEL, "%s-%u", type, index);
if (!name) if (!name) {
of_node_put(ports);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
np = of_find_node_by_name(np, name);
kfree(name);
} }
np = of_get_child_by_name(ports, name);
kfree(name);
of_node_put(ports);
return np; return np;
} }
...@@ -847,7 +847,7 @@ static void tegra_xusb_remove_ports(struct tegra_xusb_padctl *padctl) ...@@ -847,7 +847,7 @@ static void tegra_xusb_remove_ports(struct tegra_xusb_padctl *padctl)
static int tegra_xusb_padctl_probe(struct platform_device *pdev) static int tegra_xusb_padctl_probe(struct platform_device *pdev)
{ {
struct device_node *np = of_node_get(pdev->dev.of_node); struct device_node *np = pdev->dev.of_node;
const struct tegra_xusb_padctl_soc *soc; const struct tegra_xusb_padctl_soc *soc;
struct tegra_xusb_padctl *padctl; struct tegra_xusb_padctl *padctl;
const struct of_device_id *match; const struct of_device_id *match;
...@@ -855,7 +855,7 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev) ...@@ -855,7 +855,7 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
int err; int err;
/* for backwards compatibility with old device trees */ /* for backwards compatibility with old device trees */
np = of_find_node_by_name(np, "pads"); np = of_get_child_by_name(np, "pads");
if (!np) { if (!np) {
dev_warn(&pdev->dev, "deprecated DT, using legacy driver\n"); dev_warn(&pdev->dev, "deprecated DT, using legacy driver\n");
return tegra_xusb_padctl_legacy_probe(pdev); return tegra_xusb_padctl_legacy_probe(pdev);
......
...@@ -247,7 +247,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) ...@@ -247,7 +247,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
if (ret) if (ret)
goto err_mux; goto err_mux;
ulpi_node = of_find_node_by_name(of_node_get(pdev->dev.of_node), "ulpi"); ulpi_node = of_get_child_by_name(pdev->dev.of_node, "ulpi");
if (ulpi_node) { if (ulpi_node) {
phy_node = of_get_next_available_child(ulpi_node, NULL); phy_node = of_get_next_available_child(ulpi_node, NULL);
ci->hsic = of_device_is_compatible(phy_node, "qcom,usb-hsic-phy"); ci->hsic = of_device_is_compatible(phy_node, "qcom,usb-hsic-phy");
......
...@@ -1007,7 +1007,7 @@ int usb_get_bos_descriptor(struct usb_device *dev) ...@@ -1007,7 +1007,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
case USB_SSP_CAP_TYPE: case USB_SSP_CAP_TYPE:
ssp_cap = (struct usb_ssp_cap_descriptor *)buffer; ssp_cap = (struct usb_ssp_cap_descriptor *)buffer;
ssac = (le32_to_cpu(ssp_cap->bmAttributes) & ssac = (le32_to_cpu(ssp_cap->bmAttributes) &
USB_SSP_SUBLINK_SPEED_ATTRIBS) + 1; USB_SSP_SUBLINK_SPEED_ATTRIBS);
if (length >= USB_DT_USB_SSP_CAP_SIZE(ssac)) if (length >= USB_DT_USB_SSP_CAP_SIZE(ssac))
dev->bos->ssp_cap = ssp_cap; dev->bos->ssp_cap = ssp_cap;
break; break;
......
...@@ -52,10 +52,11 @@ static const struct usb_device_id usb_quirk_list[] = { ...@@ -52,10 +52,11 @@ static const struct usb_device_id usb_quirk_list[] = {
/* Microsoft LifeCam-VX700 v2.0 */ /* Microsoft LifeCam-VX700 v2.0 */
{ USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME },
/* Logitech HD Pro Webcams C920, C920-C and C930e */ /* Logitech HD Pro Webcams C920, C920-C, C925e and C930e */
{ USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT },
{ USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT }, { USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT },
{ USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT }, { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT },
{ USB_DEVICE(0x046d, 0x085b), .driver_info = USB_QUIRK_DELAY_INIT },
/* Logitech ConferenceCam CC3000e */ /* Logitech ConferenceCam CC3000e */
{ USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT }, { USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT },
...@@ -149,6 +150,9 @@ static const struct usb_device_id usb_quirk_list[] = { ...@@ -149,6 +150,9 @@ static const struct usb_device_id usb_quirk_list[] = {
/* Genesys Logic hub, internally used by KY-688 USB 3.1 Type-C Hub */ /* Genesys Logic hub, internally used by KY-688 USB 3.1 Type-C Hub */
{ USB_DEVICE(0x05e3, 0x0612), .driver_info = USB_QUIRK_NO_LPM }, { USB_DEVICE(0x05e3, 0x0612), .driver_info = USB_QUIRK_NO_LPM },
/* ELSA MicroLink 56K */
{ USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_RESET_RESUME },
/* Genesys Logic hub, internally used by Moshi USB to Ethernet Adapter */ /* Genesys Logic hub, internally used by Moshi USB to Ethernet Adapter */
{ USB_DEVICE(0x05e3, 0x0616), .driver_info = USB_QUIRK_NO_LPM }, { USB_DEVICE(0x05e3, 0x0616), .driver_info = USB_QUIRK_NO_LPM },
......
...@@ -162,7 +162,7 @@ static void xhci_debugfs_extcap_regset(struct xhci_hcd *xhci, int cap_id, ...@@ -162,7 +162,7 @@ static void xhci_debugfs_extcap_regset(struct xhci_hcd *xhci, int cap_id,
static int xhci_ring_enqueue_show(struct seq_file *s, void *unused) static int xhci_ring_enqueue_show(struct seq_file *s, void *unused)
{ {
dma_addr_t dma; dma_addr_t dma;
struct xhci_ring *ring = s->private; struct xhci_ring *ring = *(struct xhci_ring **)s->private;
dma = xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue); dma = xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue);
seq_printf(s, "%pad\n", &dma); seq_printf(s, "%pad\n", &dma);
...@@ -173,7 +173,7 @@ static int xhci_ring_enqueue_show(struct seq_file *s, void *unused) ...@@ -173,7 +173,7 @@ static int xhci_ring_enqueue_show(struct seq_file *s, void *unused)
static int xhci_ring_dequeue_show(struct seq_file *s, void *unused) static int xhci_ring_dequeue_show(struct seq_file *s, void *unused)
{ {
dma_addr_t dma; dma_addr_t dma;
struct xhci_ring *ring = s->private; struct xhci_ring *ring = *(struct xhci_ring **)s->private;
dma = xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue); dma = xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue);
seq_printf(s, "%pad\n", &dma); seq_printf(s, "%pad\n", &dma);
...@@ -183,7 +183,7 @@ static int xhci_ring_dequeue_show(struct seq_file *s, void *unused) ...@@ -183,7 +183,7 @@ static int xhci_ring_dequeue_show(struct seq_file *s, void *unused)
static int xhci_ring_cycle_show(struct seq_file *s, void *unused) static int xhci_ring_cycle_show(struct seq_file *s, void *unused)
{ {
struct xhci_ring *ring = s->private; struct xhci_ring *ring = *(struct xhci_ring **)s->private;
seq_printf(s, "%d\n", ring->cycle_state); seq_printf(s, "%d\n", ring->cycle_state);
...@@ -346,7 +346,7 @@ static void xhci_debugfs_create_files(struct xhci_hcd *xhci, ...@@ -346,7 +346,7 @@ static void xhci_debugfs_create_files(struct xhci_hcd *xhci,
} }
static struct dentry *xhci_debugfs_create_ring_dir(struct xhci_hcd *xhci, static struct dentry *xhci_debugfs_create_ring_dir(struct xhci_hcd *xhci,
struct xhci_ring *ring, struct xhci_ring **ring,
const char *name, const char *name,
struct dentry *parent) struct dentry *parent)
{ {
...@@ -387,7 +387,7 @@ void xhci_debugfs_create_endpoint(struct xhci_hcd *xhci, ...@@ -387,7 +387,7 @@ void xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
snprintf(epriv->name, sizeof(epriv->name), "ep%02d", ep_index); snprintf(epriv->name, sizeof(epriv->name), "ep%02d", ep_index);
epriv->root = xhci_debugfs_create_ring_dir(xhci, epriv->root = xhci_debugfs_create_ring_dir(xhci,
dev->eps[ep_index].new_ring, &dev->eps[ep_index].new_ring,
epriv->name, epriv->name,
spriv->root); spriv->root);
spriv->eps[ep_index] = epriv; spriv->eps[ep_index] = epriv;
...@@ -423,7 +423,7 @@ void xhci_debugfs_create_slot(struct xhci_hcd *xhci, int slot_id) ...@@ -423,7 +423,7 @@ void xhci_debugfs_create_slot(struct xhci_hcd *xhci, int slot_id)
priv->dev = dev; priv->dev = dev;
dev->debugfs_private = priv; dev->debugfs_private = priv;
xhci_debugfs_create_ring_dir(xhci, dev->eps[0].ring, xhci_debugfs_create_ring_dir(xhci, &dev->eps[0].ring,
"ep00", priv->root); "ep00", priv->root);
xhci_debugfs_create_context_files(xhci, priv->root, slot_id); xhci_debugfs_create_context_files(xhci, priv->root, slot_id);
...@@ -488,11 +488,11 @@ void xhci_debugfs_init(struct xhci_hcd *xhci) ...@@ -488,11 +488,11 @@ void xhci_debugfs_init(struct xhci_hcd *xhci)
ARRAY_SIZE(xhci_extcap_dbc), ARRAY_SIZE(xhci_extcap_dbc),
"reg-ext-dbc"); "reg-ext-dbc");
xhci_debugfs_create_ring_dir(xhci, xhci->cmd_ring, xhci_debugfs_create_ring_dir(xhci, &xhci->cmd_ring,
"command-ring", "command-ring",
xhci->debugfs_root); xhci->debugfs_root);
xhci_debugfs_create_ring_dir(xhci, xhci->event_ring, xhci_debugfs_create_ring_dir(xhci, &xhci->event_ring,
"event-ring", "event-ring",
xhci->debugfs_root); xhci->debugfs_root);
......
...@@ -177,6 +177,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) ...@@ -177,6 +177,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
xhci->quirks |= XHCI_TRUST_TX_LENGTH; xhci->quirks |= XHCI_TRUST_TX_LENGTH;
xhci->quirks |= XHCI_BROKEN_STREAMS; xhci->quirks |= XHCI_BROKEN_STREAMS;
} }
if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
pdev->device == 0x0014)
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
if (pdev->vendor == PCI_VENDOR_ID_RENESAS && if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
pdev->device == 0x0015) pdev->device == 0x0015)
xhci->quirks |= XHCI_RESET_ON_RESUME; xhci->quirks |= XHCI_RESET_ON_RESUME;
......
...@@ -3525,8 +3525,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) ...@@ -3525,8 +3525,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
struct xhci_slot_ctx *slot_ctx; struct xhci_slot_ctx *slot_ctx;
int i, ret; int i, ret;
xhci_debugfs_remove_slot(xhci, udev->slot_id);
#ifndef CONFIG_USB_DEFAULT_PERSIST #ifndef CONFIG_USB_DEFAULT_PERSIST
/* /*
* We called pm_runtime_get_noresume when the device was attached. * We called pm_runtime_get_noresume when the device was attached.
...@@ -3555,8 +3553,10 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) ...@@ -3555,8 +3553,10 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
} }
ret = xhci_disable_slot(xhci, udev->slot_id); ret = xhci_disable_slot(xhci, udev->slot_id);
if (ret) if (ret) {
xhci_debugfs_remove_slot(xhci, udev->slot_id);
xhci_free_virt_device(xhci, udev->slot_id); xhci_free_virt_device(xhci, udev->slot_id);
}
} }
int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id)
......
...@@ -1013,6 +1013,7 @@ static const struct usb_device_id id_table_combined[] = { ...@@ -1013,6 +1013,7 @@ static const struct usb_device_id id_table_combined[] = {
.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
{ USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_BT_USB_PID) }, { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_BT_USB_PID) },
{ USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_WL_USB_PID) }, { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_WL_USB_PID) },
{ USB_DEVICE(AIRBUS_DS_VID, AIRBUS_DS_P8GR) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
......
...@@ -914,6 +914,12 @@ ...@@ -914,6 +914,12 @@
#define ICPDAS_I7561U_PID 0x0104 #define ICPDAS_I7561U_PID 0x0104
#define ICPDAS_I7563U_PID 0x0105 #define ICPDAS_I7563U_PID 0x0105
/*
* Airbus Defence and Space
*/
#define AIRBUS_DS_VID 0x1e8e /* Vendor ID */
#define AIRBUS_DS_P8GR 0x6001 /* Tetra P8GR */
/* /*
* RT Systems programming cables for various ham radios * RT Systems programming cables for various ham radios
*/ */
......
...@@ -233,6 +233,8 @@ static void option_instat_callback(struct urb *urb); ...@@ -233,6 +233,8 @@ static void option_instat_callback(struct urb *urb);
/* These Quectel products use Qualcomm's vendor ID */ /* These Quectel products use Qualcomm's vendor ID */
#define QUECTEL_PRODUCT_UC20 0x9003 #define QUECTEL_PRODUCT_UC20 0x9003
#define QUECTEL_PRODUCT_UC15 0x9090 #define QUECTEL_PRODUCT_UC15 0x9090
/* These Yuga products use Qualcomm's vendor ID */
#define YUGA_PRODUCT_CLM920_NC5 0x9625
#define QUECTEL_VENDOR_ID 0x2c7c #define QUECTEL_VENDOR_ID 0x2c7c
/* These Quectel products use Quectel's vendor ID */ /* These Quectel products use Quectel's vendor ID */
...@@ -280,6 +282,7 @@ static void option_instat_callback(struct urb *urb); ...@@ -280,6 +282,7 @@ static void option_instat_callback(struct urb *urb);
#define TELIT_PRODUCT_LE922_USBCFG3 0x1043 #define TELIT_PRODUCT_LE922_USBCFG3 0x1043
#define TELIT_PRODUCT_LE922_USBCFG5 0x1045 #define TELIT_PRODUCT_LE922_USBCFG5 0x1045
#define TELIT_PRODUCT_ME910 0x1100 #define TELIT_PRODUCT_ME910 0x1100
#define TELIT_PRODUCT_ME910_DUAL_MODEM 0x1101
#define TELIT_PRODUCT_LE920 0x1200 #define TELIT_PRODUCT_LE920 0x1200
#define TELIT_PRODUCT_LE910 0x1201 #define TELIT_PRODUCT_LE910 0x1201
#define TELIT_PRODUCT_LE910_USBCFG4 0x1206 #define TELIT_PRODUCT_LE910_USBCFG4 0x1206
...@@ -645,6 +648,11 @@ static const struct option_blacklist_info telit_me910_blacklist = { ...@@ -645,6 +648,11 @@ static const struct option_blacklist_info telit_me910_blacklist = {
.reserved = BIT(1) | BIT(3), .reserved = BIT(1) | BIT(3),
}; };
static const struct option_blacklist_info telit_me910_dual_modem_blacklist = {
.sendsetup = BIT(0),
.reserved = BIT(3),
};
static const struct option_blacklist_info telit_le910_blacklist = { static const struct option_blacklist_info telit_le910_blacklist = {
.sendsetup = BIT(0), .sendsetup = BIT(0),
.reserved = BIT(1) | BIT(2), .reserved = BIT(1) | BIT(2),
...@@ -674,6 +682,10 @@ static const struct option_blacklist_info cinterion_rmnet2_blacklist = { ...@@ -674,6 +682,10 @@ static const struct option_blacklist_info cinterion_rmnet2_blacklist = {
.reserved = BIT(4) | BIT(5), .reserved = BIT(4) | BIT(5),
}; };
static const struct option_blacklist_info yuga_clm920_nc5_blacklist = {
.reserved = BIT(1) | BIT(4),
};
static const struct usb_device_id option_ids[] = { static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
...@@ -1178,6 +1190,9 @@ static const struct usb_device_id option_ids[] = { ...@@ -1178,6 +1190,9 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)}, { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)},
{ USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20), { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20),
.driver_info = (kernel_ulong_t)&net_intf4_blacklist }, .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
/* Yuga products use Qualcomm vendor ID */
{ USB_DEVICE(QUALCOMM_VENDOR_ID, YUGA_PRODUCT_CLM920_NC5),
.driver_info = (kernel_ulong_t)&yuga_clm920_nc5_blacklist },
/* Quectel products using Quectel vendor ID */ /* Quectel products using Quectel vendor ID */
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21), { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
.driver_info = (kernel_ulong_t)&net_intf4_blacklist }, .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
...@@ -1244,6 +1259,8 @@ static const struct usb_device_id option_ids[] = { ...@@ -1244,6 +1259,8 @@ static const struct usb_device_id option_ids[] = {
.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 }, .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910),
.driver_info = (kernel_ulong_t)&telit_me910_blacklist }, .driver_info = (kernel_ulong_t)&telit_me910_blacklist },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
.driver_info = (kernel_ulong_t)&telit_me910_dual_modem_blacklist },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
.driver_info = (kernel_ulong_t)&telit_le910_blacklist }, .driver_info = (kernel_ulong_t)&telit_le910_blacklist },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),
......
...@@ -162,6 +162,8 @@ static const struct usb_device_id id_table[] = { ...@@ -162,6 +162,8 @@ static const struct usb_device_id id_table[] = {
{DEVICE_SWI(0x1199, 0x9079)}, /* Sierra Wireless EM74xx */ {DEVICE_SWI(0x1199, 0x9079)}, /* Sierra Wireless EM74xx */
{DEVICE_SWI(0x1199, 0x907a)}, /* Sierra Wireless EM74xx QDL */ {DEVICE_SWI(0x1199, 0x907a)}, /* Sierra Wireless EM74xx QDL */
{DEVICE_SWI(0x1199, 0x907b)}, /* Sierra Wireless EM74xx */ {DEVICE_SWI(0x1199, 0x907b)}, /* Sierra Wireless EM74xx */
{DEVICE_SWI(0x1199, 0x9090)}, /* Sierra Wireless EM7565 QDL */
{DEVICE_SWI(0x1199, 0x9091)}, /* Sierra Wireless EM7565 */
{DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */
{DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ {DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */
{DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
...@@ -342,6 +344,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) ...@@ -342,6 +344,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
break; break;
case 2: case 2:
dev_dbg(dev, "NMEA GPS interface found\n"); dev_dbg(dev, "NMEA GPS interface found\n");
sendsetup = true;
break; break;
case 3: case 3:
dev_dbg(dev, "Modem port found\n"); dev_dbg(dev, "Modem port found\n");
......
...@@ -149,8 +149,7 @@ static void stub_shutdown_connection(struct usbip_device *ud) ...@@ -149,8 +149,7 @@ static void stub_shutdown_connection(struct usbip_device *ud)
* step 1? * step 1?
*/ */
if (ud->tcp_socket) { if (ud->tcp_socket) {
dev_dbg(&sdev->udev->dev, "shutdown tcp_socket %p\n", dev_dbg(&sdev->udev->dev, "shutdown sockfd %d\n", ud->sockfd);
ud->tcp_socket);
kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR); kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR);
} }
......
...@@ -237,11 +237,12 @@ void stub_device_cleanup_urbs(struct stub_device *sdev) ...@@ -237,11 +237,12 @@ void stub_device_cleanup_urbs(struct stub_device *sdev)
struct stub_priv *priv; struct stub_priv *priv;
struct urb *urb; struct urb *urb;
dev_dbg(&sdev->udev->dev, "free sdev %p\n", sdev); dev_dbg(&sdev->udev->dev, "Stub device cleaning up urbs\n");
while ((priv = stub_priv_pop(sdev))) { while ((priv = stub_priv_pop(sdev))) {
urb = priv->urb; urb = priv->urb;
dev_dbg(&sdev->udev->dev, "free urb %p\n", urb); dev_dbg(&sdev->udev->dev, "free urb seqnum %lu\n",
priv->seqnum);
usb_kill_urb(urb); usb_kill_urb(urb);
kmem_cache_free(stub_priv_cache, priv); kmem_cache_free(stub_priv_cache, priv);
......
...@@ -211,9 +211,6 @@ static int stub_recv_cmd_unlink(struct stub_device *sdev, ...@@ -211,9 +211,6 @@ static int stub_recv_cmd_unlink(struct stub_device *sdev,
if (priv->seqnum != pdu->u.cmd_unlink.seqnum) if (priv->seqnum != pdu->u.cmd_unlink.seqnum)
continue; continue;
dev_info(&priv->urb->dev->dev, "unlink urb %p\n",
priv->urb);
/* /*
* This matched urb is not completed yet (i.e., be in * This matched urb is not completed yet (i.e., be in
* flight in usb hcd hardware/driver). Now we are * flight in usb hcd hardware/driver). Now we are
...@@ -252,8 +249,8 @@ static int stub_recv_cmd_unlink(struct stub_device *sdev, ...@@ -252,8 +249,8 @@ static int stub_recv_cmd_unlink(struct stub_device *sdev,
ret = usb_unlink_urb(priv->urb); ret = usb_unlink_urb(priv->urb);
if (ret != -EINPROGRESS) if (ret != -EINPROGRESS)
dev_err(&priv->urb->dev->dev, dev_err(&priv->urb->dev->dev,
"failed to unlink a urb %p, ret %d\n", "failed to unlink a urb # %lu, ret %d\n",
priv->urb, ret); priv->seqnum, ret);
return 0; return 0;
} }
...@@ -342,14 +339,6 @@ static int get_pipe(struct stub_device *sdev, struct usbip_header *pdu) ...@@ -342,14 +339,6 @@ static int get_pipe(struct stub_device *sdev, struct usbip_header *pdu)
epd = &ep->desc; epd = &ep->desc;
/* validate transfer_buffer_length */
if (pdu->u.cmd_submit.transfer_buffer_length > INT_MAX) {
dev_err(&sdev->udev->dev,
"CMD_SUBMIT: -EMSGSIZE transfer_buffer_length %d\n",
pdu->u.cmd_submit.transfer_buffer_length);
return -1;
}
if (usb_endpoint_xfer_control(epd)) { if (usb_endpoint_xfer_control(epd)) {
if (dir == USBIP_DIR_OUT) if (dir == USBIP_DIR_OUT)
return usb_sndctrlpipe(udev, epnum); return usb_sndctrlpipe(udev, epnum);
...@@ -482,8 +471,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, ...@@ -482,8 +471,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
} }
/* allocate urb transfer buffer, if needed */ /* allocate urb transfer buffer, if needed */
if (pdu->u.cmd_submit.transfer_buffer_length > 0 && if (pdu->u.cmd_submit.transfer_buffer_length > 0) {
pdu->u.cmd_submit.transfer_buffer_length <= INT_MAX) {
priv->urb->transfer_buffer = priv->urb->transfer_buffer =
kzalloc(pdu->u.cmd_submit.transfer_buffer_length, kzalloc(pdu->u.cmd_submit.transfer_buffer_length,
GFP_KERNEL); GFP_KERNEL);
......
...@@ -88,7 +88,7 @@ void stub_complete(struct urb *urb) ...@@ -88,7 +88,7 @@ void stub_complete(struct urb *urb)
/* link a urb to the queue of tx. */ /* link a urb to the queue of tx. */
spin_lock_irqsave(&sdev->priv_lock, flags); spin_lock_irqsave(&sdev->priv_lock, flags);
if (sdev->ud.tcp_socket == NULL) { if (sdev->ud.tcp_socket == NULL) {
usbip_dbg_stub_tx("ignore urb for closed connection %p", urb); usbip_dbg_stub_tx("ignore urb for closed connection\n");
/* It will be freed in stub_device_cleanup_urbs(). */ /* It will be freed in stub_device_cleanup_urbs(). */
} else if (priv->unlinking) { } else if (priv->unlinking) {
stub_enqueue_ret_unlink(sdev, priv->seqnum, urb->status); stub_enqueue_ret_unlink(sdev, priv->seqnum, urb->status);
...@@ -190,8 +190,8 @@ static int stub_send_ret_submit(struct stub_device *sdev) ...@@ -190,8 +190,8 @@ static int stub_send_ret_submit(struct stub_device *sdev)
/* 1. setup usbip_header */ /* 1. setup usbip_header */
setup_ret_submit_pdu(&pdu_header, urb); setup_ret_submit_pdu(&pdu_header, urb);
usbip_dbg_stub_tx("setup txdata seqnum: %d urb: %p\n", usbip_dbg_stub_tx("setup txdata seqnum: %d\n",
pdu_header.base.seqnum, urb); pdu_header.base.seqnum);
usbip_header_correct_endian(&pdu_header, 1); usbip_header_correct_endian(&pdu_header, 1);
iov[iovnum].iov_base = &pdu_header; iov[iovnum].iov_base = &pdu_header;
......
...@@ -317,26 +317,20 @@ int usbip_recv(struct socket *sock, void *buf, int size) ...@@ -317,26 +317,20 @@ int usbip_recv(struct socket *sock, void *buf, int size)
struct msghdr msg = {.msg_flags = MSG_NOSIGNAL}; struct msghdr msg = {.msg_flags = MSG_NOSIGNAL};
int total = 0; int total = 0;
if (!sock || !buf || !size)
return -EINVAL;
iov_iter_kvec(&msg.msg_iter, READ|ITER_KVEC, &iov, 1, size); iov_iter_kvec(&msg.msg_iter, READ|ITER_KVEC, &iov, 1, size);
usbip_dbg_xmit("enter\n"); usbip_dbg_xmit("enter\n");
if (!sock || !buf || !size) {
pr_err("invalid arg, sock %p buff %p size %d\n", sock, buf,
size);
return -EINVAL;
}
do { do {
int sz = msg_data_left(&msg); msg_data_left(&msg);
sock->sk->sk_allocation = GFP_NOIO; sock->sk->sk_allocation = GFP_NOIO;
result = sock_recvmsg(sock, &msg, MSG_WAITALL); result = sock_recvmsg(sock, &msg, MSG_WAITALL);
if (result <= 0) { if (result <= 0)
pr_debug("receive sock %p buf %p size %u ret %d total %d\n",
sock, buf + total, sz, result, total);
goto err; goto err;
}
total += result; total += result;
} while (msg_data_left(&msg)); } while (msg_data_left(&msg));
......
...@@ -656,9 +656,6 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag ...@@ -656,9 +656,6 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
struct vhci_device *vdev; struct vhci_device *vdev;
unsigned long flags; unsigned long flags;
usbip_dbg_vhci_hc("enter, usb_hcd %p urb %p mem_flags %d\n",
hcd, urb, mem_flags);
if (portnum > VHCI_HC_PORTS) { if (portnum > VHCI_HC_PORTS) {
pr_err("invalid port number %d\n", portnum); pr_err("invalid port number %d\n", portnum);
return -ENODEV; return -ENODEV;
...@@ -822,8 +819,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) ...@@ -822,8 +819,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
struct vhci_device *vdev; struct vhci_device *vdev;
unsigned long flags; unsigned long flags;
pr_info("dequeue a urb %p\n", urb);
spin_lock_irqsave(&vhci->lock, flags); spin_lock_irqsave(&vhci->lock, flags);
priv = urb->hcpriv; priv = urb->hcpriv;
...@@ -851,7 +846,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) ...@@ -851,7 +846,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
/* tcp connection is closed */ /* tcp connection is closed */
spin_lock(&vdev->priv_lock); spin_lock(&vdev->priv_lock);
pr_info("device %p seems to be disconnected\n", vdev);
list_del(&priv->list); list_del(&priv->list);
kfree(priv); kfree(priv);
urb->hcpriv = NULL; urb->hcpriv = NULL;
...@@ -863,8 +857,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) ...@@ -863,8 +857,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
* vhci_rx will receive RET_UNLINK and give back the URB. * vhci_rx will receive RET_UNLINK and give back the URB.
* Otherwise, we give back it here. * Otherwise, we give back it here.
*/ */
pr_info("gives back urb %p\n", urb);
usb_hcd_unlink_urb_from_ep(hcd, urb); usb_hcd_unlink_urb_from_ep(hcd, urb);
spin_unlock_irqrestore(&vhci->lock, flags); spin_unlock_irqrestore(&vhci->lock, flags);
...@@ -892,8 +884,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) ...@@ -892,8 +884,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
unlink->unlink_seqnum = priv->seqnum; unlink->unlink_seqnum = priv->seqnum;
pr_info("device %p seems to be still connected\n", vdev);
/* send cmd_unlink and try to cancel the pending URB in the /* send cmd_unlink and try to cancel the pending URB in the
* peer */ * peer */
list_add_tail(&unlink->list, &vdev->unlink_tx); list_add_tail(&unlink->list, &vdev->unlink_tx);
...@@ -975,7 +965,7 @@ static void vhci_shutdown_connection(struct usbip_device *ud) ...@@ -975,7 +965,7 @@ static void vhci_shutdown_connection(struct usbip_device *ud)
/* need this? see stub_dev.c */ /* need this? see stub_dev.c */
if (ud->tcp_socket) { if (ud->tcp_socket) {
pr_debug("shutdown tcp_socket %p\n", ud->tcp_socket); pr_debug("shutdown tcp_socket %d\n", ud->sockfd);
kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR); kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR);
} }
......
...@@ -23,24 +23,23 @@ struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, __u32 seqnum) ...@@ -23,24 +23,23 @@ struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, __u32 seqnum)
urb = priv->urb; urb = priv->urb;
status = urb->status; status = urb->status;
usbip_dbg_vhci_rx("find urb %p vurb %p seqnum %u\n", usbip_dbg_vhci_rx("find urb seqnum %u\n", seqnum);
urb, priv, seqnum);
switch (status) { switch (status) {
case -ENOENT: case -ENOENT:
/* fall through */ /* fall through */
case -ECONNRESET: case -ECONNRESET:
dev_info(&urb->dev->dev, dev_dbg(&urb->dev->dev,
"urb %p was unlinked %ssynchronuously.\n", urb, "urb seq# %u was unlinked %ssynchronuously\n",
status == -ENOENT ? "" : "a"); seqnum, status == -ENOENT ? "" : "a");
break; break;
case -EINPROGRESS: case -EINPROGRESS:
/* no info output */ /* no info output */
break; break;
default: default:
dev_info(&urb->dev->dev, dev_dbg(&urb->dev->dev,
"urb %p may be in a error, status %d\n", urb, "urb seq# %u may be in a error, status %d\n",
status); seqnum, status);
} }
list_del(&priv->list); list_del(&priv->list);
...@@ -67,8 +66,8 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, ...@@ -67,8 +66,8 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev,
spin_unlock_irqrestore(&vdev->priv_lock, flags); spin_unlock_irqrestore(&vdev->priv_lock, flags);
if (!urb) { if (!urb) {
pr_err("cannot find a urb of seqnum %u\n", pdu->base.seqnum); pr_err("cannot find a urb of seqnum %u max seqnum %d\n",
pr_info("max seqnum %d\n", pdu->base.seqnum,
atomic_read(&vhci_hcd->seqnum)); atomic_read(&vhci_hcd->seqnum));
usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
return; return;
...@@ -91,7 +90,7 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, ...@@ -91,7 +90,7 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev,
if (usbip_dbg_flag_vhci_rx) if (usbip_dbg_flag_vhci_rx)
usbip_dump_urb(urb); usbip_dump_urb(urb);
usbip_dbg_vhci_rx("now giveback urb %p\n", urb); usbip_dbg_vhci_rx("now giveback urb %u\n", pdu->base.seqnum);
spin_lock_irqsave(&vhci->lock, flags); spin_lock_irqsave(&vhci->lock, flags);
usb_hcd_unlink_urb_from_ep(vhci_hcd_to_hcd(vhci_hcd), urb); usb_hcd_unlink_urb_from_ep(vhci_hcd_to_hcd(vhci_hcd), urb);
...@@ -158,7 +157,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, ...@@ -158,7 +157,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,
pr_info("the urb (seqnum %d) was already given back\n", pr_info("the urb (seqnum %d) was already given back\n",
pdu->base.seqnum); pdu->base.seqnum);
} else { } else {
usbip_dbg_vhci_rx("now giveback urb %p\n", urb); usbip_dbg_vhci_rx("now giveback urb %d\n", pdu->base.seqnum);
/* If unlink is successful, status is -ECONNRESET */ /* If unlink is successful, status is -ECONNRESET */
urb->status = pdu->u.ret_unlink.status; urb->status = pdu->u.ret_unlink.status;
......
...@@ -69,7 +69,8 @@ static int vhci_send_cmd_submit(struct vhci_device *vdev) ...@@ -69,7 +69,8 @@ static int vhci_send_cmd_submit(struct vhci_device *vdev)
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
memset(&iov, 0, sizeof(iov)); memset(&iov, 0, sizeof(iov));
usbip_dbg_vhci_tx("setup txdata urb %p\n", urb); usbip_dbg_vhci_tx("setup txdata urb seqnum %lu\n",
priv->seqnum);
/* 1. setup usbip_header */ /* 1. setup usbip_header */
setup_cmd_submit_pdu(&pdu_header, urb); setup_cmd_submit_pdu(&pdu_header, urb);
......
...@@ -30,6 +30,7 @@ int modify_match_busid(char *busid, int add) ...@@ -30,6 +30,7 @@ int modify_match_busid(char *busid, int add)
char command[SYSFS_BUS_ID_SIZE + 4]; char command[SYSFS_BUS_ID_SIZE + 4];
char match_busid_attr_path[SYSFS_PATH_MAX]; char match_busid_attr_path[SYSFS_PATH_MAX];
int rc; int rc;
int cmd_size;
snprintf(match_busid_attr_path, sizeof(match_busid_attr_path), snprintf(match_busid_attr_path, sizeof(match_busid_attr_path),
"%s/%s/%s/%s/%s/%s", SYSFS_MNT_PATH, SYSFS_BUS_NAME, "%s/%s/%s/%s/%s/%s", SYSFS_MNT_PATH, SYSFS_BUS_NAME,
...@@ -37,12 +38,14 @@ int modify_match_busid(char *busid, int add) ...@@ -37,12 +38,14 @@ int modify_match_busid(char *busid, int add)
attr_name); attr_name);
if (add) if (add)
snprintf(command, SYSFS_BUS_ID_SIZE + 4, "add %s", busid); cmd_size = snprintf(command, SYSFS_BUS_ID_SIZE + 4, "add %s",
busid);
else else
snprintf(command, SYSFS_BUS_ID_SIZE + 4, "del %s", busid); cmd_size = snprintf(command, SYSFS_BUS_ID_SIZE + 4, "del %s",
busid);
rc = write_sysfs_attribute(match_busid_attr_path, command, rc = write_sysfs_attribute(match_busid_attr_path, command,
sizeof(command)); cmd_size);
if (rc < 0) { if (rc < 0) {
dbg("failed to write match_busid: %s", strerror(errno)); dbg("failed to write match_busid: %s", strerror(errno));
return -1; return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment