···1814 u8 def_ant, tx_ant, ee_mode;1815 u32 sta_id1 = 0;18161817+ /* if channel is not initialized yet we can't set the antennas1818+ * so just store the mode. it will be set on the next reset */1819+ if (channel == NULL) {1820+ ah->ah_ant_mode = ant_mode;1821+ return;1822+ }1823+1824 def_ant = ah->ah_def_ant;18251826 ATH5K_TRACE(ah->ah_sc);
-9
drivers/net/wireless/hostap/hostap_hw.c
···2618 int events = 0;2619 u16 ev;26202621- /* Detect early interrupt before driver is fully configued */2622- if (!dev->base_addr) {2623- if (net_ratelimit()) {2624- printk(KERN_DEBUG "%s: Interrupt, but dev not configured\n",2625- dev->name);2626- }2627- return IRQ_HANDLED;2628- }2629-2630 iface = netdev_priv(dev);2631 local = iface->local;2632
···2618 int events = 0;2619 u16 ev;26200000000002621 iface = netdev_priv(dev);2622 local = iface->local;2623
···1484}148514860000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001487/******************************************************************************1488 *1489 * uCode download functions···2114 err = iwl_dbgfs_register(priv, DRV_NAME);2115 if (err)2116 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err);000000021172118 /* We have our copies now, allow OS release its copies */2119 release_firmware(ucode_raw);···34213422/*****************************************************************************3423 *3424- * sysfs attributes3425- *3426- *****************************************************************************/3427-3428-#ifdef CONFIG_IWLWIFI_DEBUG3429-3430-/*3431- * The following adds a new attribute to the sysfs representation3432- * of this device driver (i.e. a new file in /sys/class/net/wlan0/device/)3433- * used for controlling the debug level.3434- *3435- * See the level definitions in iwl for details.3436- *3437- * The debug_level being managed using sysfs below is a per device debug3438- * level that is used instead of the global debug level if it (the per3439- * device debug level) is set.3440- */3441-static ssize_t show_debug_level(struct device *d,3442- struct device_attribute *attr, char *buf)3443-{3444- struct iwl_priv *priv = dev_get_drvdata(d);3445- return sprintf(buf, "0x%08X\n", iwl_get_debug_level(priv));3446-}3447-static ssize_t store_debug_level(struct device *d,3448- struct device_attribute *attr,3449- const char *buf, size_t count)3450-{3451- struct iwl_priv *priv = dev_get_drvdata(d);3452- unsigned long val;3453- int ret;3454-3455- ret = strict_strtoul(buf, 0, &val);3456- if (ret)3457- IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf);3458- else {3459- priv->debug_level = val;3460- if (iwl_alloc_traffic_mem(priv))3461- IWL_ERR(priv,3462- "Not enough memory to generate traffic log\n");3463- }3464- return strnlen(buf, count);3465-}3466-3467-static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,3468- show_debug_level, store_debug_level);3469-3470-3471-#endif /* CONFIG_IWLWIFI_DEBUG */3472-3473-3474-static ssize_t show_temperature(struct device *d,3475- struct device_attribute *attr, char *buf)3476-{3477- struct iwl_priv *priv = dev_get_drvdata(d);3478-3479- if (!iwl_is_alive(priv))3480- return -EAGAIN;3481-3482- return sprintf(buf, "%d\n", priv->temperature);3483-}3484-3485-static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);3486-3487-static ssize_t show_tx_power(struct device *d,3488- struct device_attribute *attr, char *buf)3489-{3490- struct iwl_priv *priv = dev_get_drvdata(d);3491-3492- if (!iwl_is_ready_rf(priv))3493- return sprintf(buf, "off\n");3494- else3495- return sprintf(buf, "%d\n", priv->tx_power_user_lmt);3496-}3497-3498-static ssize_t store_tx_power(struct device *d,3499- struct device_attribute *attr,3500- const char *buf, size_t count)3501-{3502- struct iwl_priv *priv = dev_get_drvdata(d);3503- unsigned long val;3504- int ret;3505-3506- ret = strict_strtoul(buf, 10, &val);3507- if (ret)3508- IWL_INFO(priv, "%s is not in decimal form.\n", buf);3509- else {3510- ret = iwl_set_tx_power(priv, val, false);3511- if (ret)3512- IWL_ERR(priv, "failed setting tx power (0x%d).\n",3513- ret);3514- else3515- ret = count;3516- }3517- return ret;3518-}3519-3520-static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);3521-3522-static ssize_t show_rts_ht_protection(struct device *d,3523- struct device_attribute *attr, char *buf)3524-{3525- struct iwl_priv *priv = dev_get_drvdata(d);3526-3527- return sprintf(buf, "%s\n",3528- priv->cfg->use_rts_for_ht ? "RTS/CTS" : "CTS-to-self");3529-}3530-3531-static ssize_t store_rts_ht_protection(struct device *d,3532- struct device_attribute *attr,3533- const char *buf, size_t count)3534-{3535- struct iwl_priv *priv = dev_get_drvdata(d);3536- unsigned long val;3537- int ret;3538-3539- ret = strict_strtoul(buf, 10, &val);3540- if (ret)3541- IWL_INFO(priv, "Input is not in decimal form.\n");3542- else {3543- if (!iwl_is_associated(priv))3544- priv->cfg->use_rts_for_ht = val ? true : false;3545- else3546- IWL_ERR(priv, "Sta associated with AP - "3547- "Change protection mechanism is not allowed\n");3548- ret = count;3549- }3550- return ret;3551-}3552-3553-static DEVICE_ATTR(rts_ht_protection, S_IWUSR | S_IRUGO,3554- show_rts_ht_protection, store_rts_ht_protection);3555-3556-3557-/*****************************************************************************3558- *3559 * driver setup and teardown3560 *3561 *****************************************************************************/···3571 iwl_free_channel_map(priv);3572 kfree(priv->scan_cmd);3573}3574-3575-static struct attribute *iwl_sysfs_entries[] = {3576- &dev_attr_temperature.attr,3577- &dev_attr_tx_power.attr,3578- &dev_attr_rts_ht_protection.attr,3579-#ifdef CONFIG_IWLWIFI_DEBUG3580- &dev_attr_debug_level.attr,3581-#endif3582- NULL3583-};3584-3585-static struct attribute_group iwl_attribute_group = {3586- .name = NULL, /* put in device directory */3587- .attrs = iwl_sysfs_entries,3588-};35893590static struct ieee80211_ops iwl_hw_ops = {3591 .tx = iwl_mac_tx,···3757 IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq);3758 goto out_disable_msi;3759 }3760- err = sysfs_create_group(&pdev->dev.kobj, &iwl_attribute_group);3761- if (err) {3762- IWL_ERR(priv, "failed to create sysfs device attributes\n");3763- goto out_free_irq;3764- }37653766 iwl_setup_deferred_work(priv);3767 iwl_setup_rx_handlers(priv);···37903791 err = iwl_request_firmware(priv, true);3792 if (err)3793- goto out_remove_sysfs;37943795 return 0;37963797- out_remove_sysfs:3798 destroy_workqueue(priv->workqueue);3799 priv->workqueue = NULL;3800- sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group);3801- out_free_irq:3802 free_irq(priv->pci_dev->irq, priv);3803 iwl_free_isr_ict(priv);3804 out_disable_msi:
···1484}148514861487+/*****************************************************************************1488+ *1489+ * sysfs attributes1490+ *1491+ *****************************************************************************/1492+1493+#ifdef CONFIG_IWLWIFI_DEBUG1494+1495+/*1496+ * The following adds a new attribute to the sysfs representation1497+ * of this device driver (i.e. a new file in /sys/class/net/wlan0/device/)1498+ * used for controlling the debug level.1499+ *1500+ * See the level definitions in iwl for details.1501+ *1502+ * The debug_level being managed using sysfs below is a per device debug1503+ * level that is used instead of the global debug level if it (the per1504+ * device debug level) is set.1505+ */1506+static ssize_t show_debug_level(struct device *d,1507+ struct device_attribute *attr, char *buf)1508+{1509+ struct iwl_priv *priv = dev_get_drvdata(d);1510+ return sprintf(buf, "0x%08X\n", iwl_get_debug_level(priv));1511+}1512+static ssize_t store_debug_level(struct device *d,1513+ struct device_attribute *attr,1514+ const char *buf, size_t count)1515+{1516+ struct iwl_priv *priv = dev_get_drvdata(d);1517+ unsigned long val;1518+ int ret;1519+1520+ ret = strict_strtoul(buf, 0, &val);1521+ if (ret)1522+ IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf);1523+ else {1524+ priv->debug_level = val;1525+ if (iwl_alloc_traffic_mem(priv))1526+ IWL_ERR(priv,1527+ "Not enough memory to generate traffic log\n");1528+ }1529+ return strnlen(buf, count);1530+}1531+1532+static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,1533+ show_debug_level, store_debug_level);1534+1535+1536+#endif /* CONFIG_IWLWIFI_DEBUG */1537+1538+1539+static ssize_t show_temperature(struct device *d,1540+ struct device_attribute *attr, char *buf)1541+{1542+ struct iwl_priv *priv = dev_get_drvdata(d);1543+1544+ if (!iwl_is_alive(priv))1545+ return -EAGAIN;1546+1547+ return sprintf(buf, "%d\n", priv->temperature);1548+}1549+1550+static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);1551+1552+static ssize_t show_tx_power(struct device *d,1553+ struct device_attribute *attr, char *buf)1554+{1555+ struct iwl_priv *priv = dev_get_drvdata(d);1556+1557+ if (!iwl_is_ready_rf(priv))1558+ return sprintf(buf, "off\n");1559+ else1560+ return sprintf(buf, "%d\n", priv->tx_power_user_lmt);1561+}1562+1563+static ssize_t store_tx_power(struct device *d,1564+ struct device_attribute *attr,1565+ const char *buf, size_t count)1566+{1567+ struct iwl_priv *priv = dev_get_drvdata(d);1568+ unsigned long val;1569+ int ret;1570+1571+ ret = strict_strtoul(buf, 10, &val);1572+ if (ret)1573+ IWL_INFO(priv, "%s is not in decimal form.\n", buf);1574+ else {1575+ ret = iwl_set_tx_power(priv, val, false);1576+ if (ret)1577+ IWL_ERR(priv, "failed setting tx power (0x%d).\n",1578+ ret);1579+ else1580+ ret = count;1581+ }1582+ return ret;1583+}1584+1585+static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);1586+1587+static ssize_t show_rts_ht_protection(struct device *d,1588+ struct device_attribute *attr, char *buf)1589+{1590+ struct iwl_priv *priv = dev_get_drvdata(d);1591+1592+ return sprintf(buf, "%s\n",1593+ priv->cfg->use_rts_for_ht ? "RTS/CTS" : "CTS-to-self");1594+}1595+1596+static ssize_t store_rts_ht_protection(struct device *d,1597+ struct device_attribute *attr,1598+ const char *buf, size_t count)1599+{1600+ struct iwl_priv *priv = dev_get_drvdata(d);1601+ unsigned long val;1602+ int ret;1603+1604+ ret = strict_strtoul(buf, 10, &val);1605+ if (ret)1606+ IWL_INFO(priv, "Input is not in decimal form.\n");1607+ else {1608+ if (!iwl_is_associated(priv))1609+ priv->cfg->use_rts_for_ht = val ? true : false;1610+ else1611+ IWL_ERR(priv, "Sta associated with AP - "1612+ "Change protection mechanism is not allowed\n");1613+ ret = count;1614+ }1615+ return ret;1616+}1617+1618+static DEVICE_ATTR(rts_ht_protection, S_IWUSR | S_IRUGO,1619+ show_rts_ht_protection, store_rts_ht_protection);1620+1621+1622+static struct attribute *iwl_sysfs_entries[] = {1623+ &dev_attr_temperature.attr,1624+ &dev_attr_tx_power.attr,1625+ &dev_attr_rts_ht_protection.attr,1626+#ifdef CONFIG_IWLWIFI_DEBUG1627+ &dev_attr_debug_level.attr,1628+#endif1629+ NULL1630+};1631+1632+static struct attribute_group iwl_attribute_group = {1633+ .name = NULL, /* put in device directory */1634+ .attrs = iwl_sysfs_entries,1635+};1636+1637/******************************************************************************1638 *1639 * uCode download functions···1964 err = iwl_dbgfs_register(priv, DRV_NAME);1965 if (err)1966 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err);1967+1968+ err = sysfs_create_group(&priv->pci_dev->dev.kobj,1969+ &iwl_attribute_group);1970+ if (err) {1971+ IWL_ERR(priv, "failed to create sysfs device attributes\n");1972+ goto out_unbind;1973+ }19741975 /* We have our copies now, allow OS release its copies */1976 release_firmware(ucode_raw);···32643265/*****************************************************************************3266 *0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003267 * driver setup and teardown3268 *3269 *****************************************************************************/···3549 iwl_free_channel_map(priv);3550 kfree(priv->scan_cmd);3551}00000000000000035523553static struct ieee80211_ops iwl_hw_ops = {3554 .tx = iwl_mac_tx,···3750 IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq);3751 goto out_disable_msi;3752 }0000037533754 iwl_setup_deferred_work(priv);3755 iwl_setup_rx_handlers(priv);···37883789 err = iwl_request_firmware(priv, true);3790 if (err)3791+ goto out_destroy_workqueue;37923793 return 0;37943795+ out_destroy_workqueue:3796 destroy_workqueue(priv->workqueue);3797 priv->workqueue = NULL;003798 free_irq(priv->pci_dev->irq, priv);3799 iwl_free_isr_ict(priv);3800 out_disable_msi:
+39
drivers/net/wireless/iwlwifi/iwl-core.c
···854}855EXPORT_SYMBOL(iwl_set_rxon_chain);856000000000000000000000000000000000000000857/**858 * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON859 * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz
···854}855EXPORT_SYMBOL(iwl_set_rxon_chain);856857+/* Return valid channel */858+u8 iwl_get_single_channel_number(struct iwl_priv *priv,859+ enum ieee80211_band band)860+{861+ const struct iwl_channel_info *ch_info;862+ int i;863+ u8 channel = 0;864+865+ /* only scan single channel, good enough to reset the RF */866+ /* pick the first valid not in-use channel */867+ if (band == IEEE80211_BAND_5GHZ) {868+ for (i = 14; i < priv->channel_count; i++) {869+ if (priv->channel_info[i].channel !=870+ le16_to_cpu(priv->staging_rxon.channel)) {871+ channel = priv->channel_info[i].channel;872+ ch_info = iwl_get_channel_info(priv,873+ band, channel);874+ if (is_channel_valid(ch_info))875+ break;876+ }877+ }878+ } else {879+ for (i = 0; i < 14; i++) {880+ if (priv->channel_info[i].channel !=881+ le16_to_cpu(priv->staging_rxon.channel)) {882+ channel =883+ priv->channel_info[i].channel;884+ ch_info = iwl_get_channel_info(priv,885+ band, channel);886+ if (is_channel_valid(ch_info))887+ break;888+ }889+ }890+ }891+892+ return channel;893+}894+EXPORT_SYMBOL(iwl_get_single_channel_number);895+896/**897 * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON898 * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz