Commit 65d2897c0f1b240420d657f41e561239fa10ba94

Authored by Ben Hutchings
Committed by David S. Miller
1 parent 406636340c

caif_usb: Make the driver name check more efficient

Use the device model to get just the name, rather than using the
ethtool API to get all driver information.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 3 additions and 10 deletions Side-by-side Diff

... ... @@ -128,17 +128,10 @@
128 128 struct cflayer *layer, *link_support;
129 129 struct usbnet *usbnet;
130 130 struct usb_device *usbdev;
131   - struct ethtool_drvinfo drvinfo;
132 131  
133   - /*
134   - * Quirks: High-jack ethtool to find if we have a NCM device,
135   - * and find it's VID/PID.
136   - */
137   - if (dev->ethtool_ops == NULL || dev->ethtool_ops->get_drvinfo == NULL)
138   - return 0;
139   -
140   - dev->ethtool_ops->get_drvinfo(dev, &drvinfo);
141   - if (strncmp(drvinfo.driver, "cdc_ncm", 7) != 0)
  132 + /* Check whether we have a NCM device, and find its VID/PID. */
  133 + if (!(dev->dev.parent && dev->dev.parent->driver &&
  134 + strcmp(dev->dev.parent->driver->name, "cdc_ncm") == 0))
142 135 return 0;
143 136  
144 137 usbnet = netdev_priv(dev);