diff options
author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2013-10-24 02:34:39 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-12-02 14:24:53 -0500 |
commit | ef6b19e40f525777a0052956bf7d9a1985f74993 (patch) | |
tree | b9fecb0348318be8f8be43763bbbed8a4f8cb5b6 /drivers/net/wireless/ath/ath9k/debug.c | |
parent | 4dd3564030020f8beb8dc7bbfea05781648836d0 (diff) |
ath9k: Fix TX99 config option usage
Use CONFIG_ATH9K_TX99 to properly enclose the tx99 code
and make sure that it is not compiled as part of the driver
when it is not selected. Move the tx99 code to a new file tx99.c
and also add ATH9K_DEBUGFS as a dependency in Kconfig.
This reduces the module size on platforms like OpenWrt where
ATH9K_DEBUGFS is selected, but TX99 might be disabled.
Cc: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 115 |
1 files changed, 1 insertions, 114 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 83a2c59f680b..2f7dccfdb727 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -1778,111 +1778,6 @@ void ath9k_deinit_debug(struct ath_softc *sc) | |||
1778 | } | 1778 | } |
1779 | } | 1779 | } |
1780 | 1780 | ||
1781 | static ssize_t read_file_tx99(struct file *file, char __user *user_buf, | ||
1782 | size_t count, loff_t *ppos) | ||
1783 | { | ||
1784 | struct ath_softc *sc = file->private_data; | ||
1785 | char buf[3]; | ||
1786 | unsigned int len; | ||
1787 | |||
1788 | len = sprintf(buf, "%d\n", sc->tx99_state); | ||
1789 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1790 | } | ||
1791 | |||
1792 | static ssize_t write_file_tx99(struct file *file, const char __user *user_buf, | ||
1793 | size_t count, loff_t *ppos) | ||
1794 | { | ||
1795 | struct ath_softc *sc = file->private_data; | ||
1796 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
1797 | char buf[32]; | ||
1798 | bool start; | ||
1799 | ssize_t len; | ||
1800 | int r; | ||
1801 | |||
1802 | if (sc->nvifs > 1) | ||
1803 | return -EOPNOTSUPP; | ||
1804 | |||
1805 | len = min(count, sizeof(buf) - 1); | ||
1806 | if (copy_from_user(buf, user_buf, len)) | ||
1807 | return -EFAULT; | ||
1808 | |||
1809 | if (strtobool(buf, &start)) | ||
1810 | return -EINVAL; | ||
1811 | |||
1812 | if (start == sc->tx99_state) { | ||
1813 | if (!start) | ||
1814 | return count; | ||
1815 | ath_dbg(common, XMIT, "Resetting TX99\n"); | ||
1816 | ath9k_tx99_deinit(sc); | ||
1817 | } | ||
1818 | |||
1819 | if (!start) { | ||
1820 | ath9k_tx99_deinit(sc); | ||
1821 | return count; | ||
1822 | } | ||
1823 | |||
1824 | r = ath9k_tx99_init(sc); | ||
1825 | if (r) | ||
1826 | return r; | ||
1827 | |||
1828 | return count; | ||
1829 | } | ||
1830 | |||
1831 | static const struct file_operations fops_tx99 = { | ||
1832 | .read = read_file_tx99, | ||
1833 | .write = write_file_tx99, | ||
1834 | .open = simple_open, | ||
1835 | .owner = THIS_MODULE, | ||
1836 | .llseek = default_llseek, | ||
1837 | }; | ||
1838 | |||
1839 | static ssize_t read_file_tx99_power(struct file *file, | ||
1840 | char __user *user_buf, | ||
1841 | size_t count, loff_t *ppos) | ||
1842 | { | ||
1843 | struct ath_softc *sc = file->private_data; | ||
1844 | char buf[32]; | ||
1845 | unsigned int len; | ||
1846 | |||
1847 | len = sprintf(buf, "%d (%d dBm)\n", | ||
1848 | sc->tx99_power, | ||
1849 | sc->tx99_power / 2); | ||
1850 | |||
1851 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1852 | } | ||
1853 | |||
1854 | static ssize_t write_file_tx99_power(struct file *file, | ||
1855 | const char __user *user_buf, | ||
1856 | size_t count, loff_t *ppos) | ||
1857 | { | ||
1858 | struct ath_softc *sc = file->private_data; | ||
1859 | int r; | ||
1860 | u8 tx_power; | ||
1861 | |||
1862 | r = kstrtou8_from_user(user_buf, count, 0, &tx_power); | ||
1863 | if (r) | ||
1864 | return r; | ||
1865 | |||
1866 | if (tx_power > MAX_RATE_POWER) | ||
1867 | return -EINVAL; | ||
1868 | |||
1869 | sc->tx99_power = tx_power; | ||
1870 | |||
1871 | ath9k_ps_wakeup(sc); | ||
1872 | ath9k_hw_tx99_set_txpower(sc->sc_ah, sc->tx99_power); | ||
1873 | ath9k_ps_restore(sc); | ||
1874 | |||
1875 | return count; | ||
1876 | } | ||
1877 | |||
1878 | static const struct file_operations fops_tx99_power = { | ||
1879 | .read = read_file_tx99_power, | ||
1880 | .write = write_file_tx99_power, | ||
1881 | .open = simple_open, | ||
1882 | .owner = THIS_MODULE, | ||
1883 | .llseek = default_llseek, | ||
1884 | }; | ||
1885 | |||
1886 | int ath9k_init_debug(struct ath_hw *ah) | 1781 | int ath9k_init_debug(struct ath_hw *ah) |
1887 | { | 1782 | { |
1888 | struct ath_common *common = ath9k_hw_common(ah); | 1783 | struct ath_common *common = ath9k_hw_common(ah); |
@@ -1899,6 +1794,7 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1899 | #endif | 1794 | #endif |
1900 | 1795 | ||
1901 | ath9k_dfs_init_debug(sc); | 1796 | ath9k_dfs_init_debug(sc); |
1797 | ath9k_tx99_init_debug(sc); | ||
1902 | 1798 | ||
1903 | debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc, | 1799 | debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc, |
1904 | &fops_dma); | 1800 | &fops_dma); |
@@ -1974,15 +1870,6 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1974 | debugfs_create_file("btcoex", S_IRUSR, sc->debug.debugfs_phy, sc, | 1870 | debugfs_create_file("btcoex", S_IRUSR, sc->debug.debugfs_phy, sc, |
1975 | &fops_btcoex); | 1871 | &fops_btcoex); |
1976 | #endif | 1872 | #endif |
1977 | if (config_enabled(CONFIG_ATH9K_TX99) && | ||
1978 | AR_SREV_9300_20_OR_LATER(ah)) { | ||
1979 | debugfs_create_file("tx99", S_IRUSR | S_IWUSR, | ||
1980 | sc->debug.debugfs_phy, sc, | ||
1981 | &fops_tx99); | ||
1982 | debugfs_create_file("tx99_power", S_IRUSR | S_IWUSR, | ||
1983 | sc->debug.debugfs_phy, sc, | ||
1984 | &fops_tx99_power); | ||
1985 | } | ||
1986 | 1873 | ||
1987 | return 0; | 1874 | return 0; |
1988 | } | 1875 | } |