Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

orinoco: use cfg80211 ethtool ops

Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

David Kilroy and committed by
John W. Linville
3414fc3f 6226811f

+32 -38
+24 -9
drivers/net/wireless/orinoco/hw.c
··· 60 60 /* Set priv->firmware type, determine firmware properties 61 61 * This function can be called before we have registerred with netdev, 62 62 * so all errors go out with dev_* rather than printk 63 + * 64 + * If non-NULL stores a firmware description in fw_name. 65 + * If non-NULL stores a HW version in hw_ver 66 + * 67 + * These are output via generic cfg80211 ethtool support. 63 68 */ 64 - int determine_fw_capabilities(struct orinoco_private *priv) 69 + int determine_fw_capabilities(struct orinoco_private *priv, 70 + char *fw_name, size_t fw_name_len, 71 + u32 *hw_ver) 65 72 { 66 73 struct device *dev = priv->dev; 67 74 hermes_t *hw = &priv->hw; ··· 91 84 le16_to_cpus(&nic_id.minor); 92 85 dev_info(dev, "Hardware identity %04x:%04x:%04x:%04x\n", 93 86 nic_id.id, nic_id.variant, nic_id.major, nic_id.minor); 87 + 88 + if (hw_ver) 89 + *hw_ver = (((nic_id.id & 0xff) << 24) | 90 + ((nic_id.variant & 0xff) << 16) | 91 + ((nic_id.major & 0xff) << 8) | 92 + (nic_id.minor & 0xff)); 94 93 95 94 priv->firmware_type = determine_firmware_type(&nic_id); 96 95 ··· 148 135 case FIRMWARE_TYPE_AGERE: 149 136 /* Lucent Wavelan IEEE, Lucent Orinoco, Cabletron RoamAbout, 150 137 ELSA, Melco, HP, IBM, Dell 1150, Compaq 110/210 */ 151 - snprintf(priv->fw_name, sizeof(priv->fw_name) - 1, 152 - "Lucent/Agere %d.%02d", sta_id.major, sta_id.minor); 138 + if (fw_name) 139 + snprintf(fw_name, fw_name_len, "Lucent/Agere %d.%02d", 140 + sta_id.major, sta_id.minor); 153 141 154 142 firmver = ((unsigned long)sta_id.major << 16) | sta_id.minor; 155 143 ··· 199 185 tmp[SYMBOL_MAX_VER_LEN] = '\0'; 200 186 } 201 187 202 - snprintf(priv->fw_name, sizeof(priv->fw_name) - 1, 203 - "Symbol %s", tmp); 188 + if (fw_name) 189 + snprintf(fw_name, fw_name_len, "Symbol %s", tmp); 204 190 205 191 priv->has_ibss = (firmver >= 0x20000); 206 192 priv->has_wep = (firmver >= 0x15012); ··· 238 224 * different and less well tested */ 239 225 /* D-Link MAC : 00:40:05:* */ 240 226 /* Addtron MAC : 00:90:D1:* */ 241 - snprintf(priv->fw_name, sizeof(priv->fw_name) - 1, 242 - "Intersil %d.%d.%d", sta_id.major, sta_id.minor, 243 - sta_id.variant); 227 + if (fw_name) 228 + snprintf(fw_name, fw_name_len, "Intersil %d.%d.%d", 229 + sta_id.major, sta_id.minor, sta_id.variant); 244 230 245 231 firmver = ((unsigned long)sta_id.major << 16) | 246 232 ((unsigned long)sta_id.minor << 8) | sta_id.variant; ··· 259 245 } 260 246 break; 261 247 } 262 - dev_info(dev, "Firmware determined as %s\n", priv->fw_name); 248 + if (fw_name) 249 + dev_info(dev, "Firmware determined as %s\n", fw_name); 263 250 264 251 return 0; 265 252 }
+2 -1
drivers/net/wireless/orinoco/hw.h
··· 24 24 struct orinoco_private; 25 25 struct dev_addr_list; 26 26 27 - int determine_fw_capabilities(struct orinoco_private *priv); 27 + int determine_fw_capabilities(struct orinoco_private *priv, char *fw_name, 28 + size_t fw_name_len, u32 *hw_ver); 28 29 int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr); 29 30 int orinoco_hw_allocate_fid(struct orinoco_private *priv); 30 31 int orinoco_get_bitratemode(int bitrate, int automatic);
+6 -27
drivers/net/wireless/orinoco/main.c
··· 83 83 #include <linux/device.h> 84 84 #include <linux/netdevice.h> 85 85 #include <linux/etherdevice.h> 86 - #include <linux/ethtool.h> 87 86 #include <linux/suspend.h> 88 87 #include <linux/if_arp.h> 89 88 #include <linux/wireless.h> ··· 160 161 | HERMES_EV_TX | HERMES_EV_TXEXC \ 161 162 | HERMES_EV_WTERR | HERMES_EV_INFO \ 162 163 | HERMES_EV_INFDROP) 163 - 164 - static const struct ethtool_ops orinoco_ethtool_ops; 165 164 166 165 /********************************************************************/ 167 166 /* Data types */ ··· 1991 1994 goto out; 1992 1995 } 1993 1996 1994 - err = determine_fw_capabilities(priv); 1997 + err = determine_fw_capabilities(priv, wiphy->fw_version, 1998 + sizeof(wiphy->fw_version), 1999 + &wiphy->hw_version); 1995 2000 if (err != 0) { 1996 2001 dev_err(dev, "Incompatible firmware, aborting\n"); 1997 2002 goto out; ··· 2009 2010 priv->do_fw_download = 0; 2010 2011 2011 2012 /* Check firmware version again */ 2012 - err = determine_fw_capabilities(priv); 2013 + err = determine_fw_capabilities(priv, wiphy->fw_version, 2014 + sizeof(wiphy->fw_version), 2015 + &wiphy->hw_version); 2013 2016 if (err != 0) { 2014 2017 dev_err(dev, "Incompatible firmware, aborting\n"); 2015 2018 goto out; ··· 2213 2212 dev->ieee80211_ptr = wdev; 2214 2213 dev->netdev_ops = &orinoco_netdev_ops; 2215 2214 dev->watchdog_timeo = HZ; /* 1 second timeout */ 2216 - dev->ethtool_ops = &orinoco_ethtool_ops; 2217 2215 dev->wireless_handlers = &orinoco_handler_def; 2218 2216 #ifdef WIRELESS_SPY 2219 2217 dev->wireless_data = &priv->wireless_data; ··· 2348 2348 spin_unlock_irqrestore(&priv->lock, flags); 2349 2349 } 2350 2350 EXPORT_SYMBOL(orinoco_down); 2351 - 2352 - static void orinoco_get_drvinfo(struct net_device *dev, 2353 - struct ethtool_drvinfo *info) 2354 - { 2355 - struct orinoco_private *priv = ndev_priv(dev); 2356 - 2357 - strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1); 2358 - strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1); 2359 - strncpy(info->fw_version, priv->fw_name, sizeof(info->fw_version) - 1); 2360 - if (dev->dev.parent) 2361 - strncpy(info->bus_info, dev_name(dev->dev.parent), 2362 - sizeof(info->bus_info) - 1); 2363 - else 2364 - snprintf(info->bus_info, sizeof(info->bus_info) - 1, 2365 - "PCMCIA %p", priv->hw.iobase); 2366 - } 2367 - 2368 - static const struct ethtool_ops orinoco_ethtool_ops = { 2369 - .get_drvinfo = orinoco_get_drvinfo, 2370 - .get_link = ethtool_op_get_link, 2371 - }; 2372 2351 2373 2352 /********************************************************************/ 2374 2353 /* Module initialization */
-1
drivers/net/wireless/orinoco/orinoco.h
··· 93 93 94 94 /* Capabilities of the hardware/firmware */ 95 95 fwtype_t firmware_type; 96 - char fw_name[32]; 97 96 int ibss_port; 98 97 int nicbuf_size; 99 98 u16 channel_mask;