debug.c (1534069491c67619bfaeb25368a1249b669503c3) | debug.c (9bff0bc4012c7f079b297eb45b47780e3713f367) |
---|---|
1/* 2 * Copyright (c) 2008-2009 Atheros Communications Inc. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 780 unchanged lines hidden (view full) --- 789} 790 791static const struct file_operations fops_recv = { 792 .read = read_file_recv, 793 .open = ath9k_debugfs_open, 794 .owner = THIS_MODULE 795}; 796 | 1/* 2 * Copyright (c) 2008-2009 Atheros Communications Inc. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 780 unchanged lines hidden (view full) --- 789} 790 791static const struct file_operations fops_recv = { 792 .read = read_file_recv, 793 .open = ath9k_debugfs_open, 794 .owner = THIS_MODULE 795}; 796 |
797static ssize_t read_file_regidx(struct file *file, char __user *user_buf, 798 size_t count, loff_t *ppos) 799{ 800 struct ath_softc *sc = file->private_data; 801 char buf[32]; 802 unsigned int len; 803 804 len = snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.regidx); 805 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 806} 807 808static ssize_t write_file_regidx(struct file *file, const char __user *user_buf, 809 size_t count, loff_t *ppos) 810{ 811 struct ath_softc *sc = file->private_data; 812 unsigned long regidx; 813 char buf[32]; 814 ssize_t len; 815 816 len = min(count, sizeof(buf) - 1); 817 if (copy_from_user(buf, user_buf, len)) 818 return -EINVAL; 819 820 buf[len] = '\0'; 821 if (strict_strtoul(buf, 0, ®idx)) 822 return -EINVAL; 823 824 sc->debug.regidx = regidx; 825 return count; 826} 827 828static const struct file_operations fops_regidx = { 829 .read = read_file_regidx, 830 .write = write_file_regidx, 831 .open = ath9k_debugfs_open, 832 .owner = THIS_MODULE 833}; 834 835static ssize_t read_file_regval(struct file *file, char __user *user_buf, 836 size_t count, loff_t *ppos) 837{ 838 struct ath_softc *sc = file->private_data; 839 struct ath_hw *ah = sc->sc_ah; 840 char buf[32]; 841 unsigned int len; 842 u32 regval; 843 844 regval = REG_READ_D(ah, sc->debug.regidx); 845 len = snprintf(buf, sizeof(buf), "0x%08x\n", regval); 846 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 847} 848 849static ssize_t write_file_regval(struct file *file, const char __user *user_buf, 850 size_t count, loff_t *ppos) 851{ 852 struct ath_softc *sc = file->private_data; 853 struct ath_hw *ah = sc->sc_ah; 854 unsigned long regval; 855 char buf[32]; 856 ssize_t len; 857 858 len = min(count, sizeof(buf) - 1); 859 if (copy_from_user(buf, user_buf, len)) 860 return -EINVAL; 861 862 buf[len] = '\0'; 863 if (strict_strtoul(buf, 0, ®val)) 864 return -EINVAL; 865 866 REG_WRITE_D(ah, sc->debug.regidx, regval); 867 return count; 868} 869 870static const struct file_operations fops_regval = { 871 .read = read_file_regval, 872 .write = write_file_regval, 873 .open = ath9k_debugfs_open, 874 .owner = THIS_MODULE 875}; 876 |
|
797int ath9k_init_debug(struct ath_hw *ah) 798{ 799 struct ath_common *common = ath9k_hw_common(ah); 800 struct ath_softc *sc = (struct ath_softc *) common->priv; 801 802 if (!ath9k_debugfs_root) 803 return -ENOENT; 804 --- 35 unchanged lines hidden (view full) --- 840 if (!debugfs_create_file("rx_chainmask", S_IRUSR | S_IWUSR, 841 sc->debug.debugfs_phy, sc, &fops_rx_chainmask)) 842 goto err; 843 844 if (!debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, 845 sc->debug.debugfs_phy, sc, &fops_tx_chainmask)) 846 goto err; 847 | 877int ath9k_init_debug(struct ath_hw *ah) 878{ 879 struct ath_common *common = ath9k_hw_common(ah); 880 struct ath_softc *sc = (struct ath_softc *) common->priv; 881 882 if (!ath9k_debugfs_root) 883 return -ENOENT; 884 --- 35 unchanged lines hidden (view full) --- 920 if (!debugfs_create_file("rx_chainmask", S_IRUSR | S_IWUSR, 921 sc->debug.debugfs_phy, sc, &fops_rx_chainmask)) 922 goto err; 923 924 if (!debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, 925 sc->debug.debugfs_phy, sc, &fops_tx_chainmask)) 926 goto err; 927 |
928 if (!debugfs_create_file("regidx", S_IRUSR | S_IWUSR, 929 sc->debug.debugfs_phy, sc, &fops_regidx)) 930 goto err; 931 932 if (!debugfs_create_file("regval", S_IRUSR | S_IWUSR, 933 sc->debug.debugfs_phy, sc, &fops_regval)) 934 goto err; 935 936 sc->debug.regidx = 0; |
|
848 return 0; 849err: 850 ath9k_exit_debug(ah); 851 return -ENOMEM; 852} 853 854void ath9k_exit_debug(struct ath_hw *ah) 855{ --- 20 unchanged lines hidden --- | 937 return 0; 938err: 939 ath9k_exit_debug(ah); 940 return -ENOMEM; 941} 942 943void ath9k_exit_debug(struct ath_hw *ah) 944{ --- 20 unchanged lines hidden --- |