1 --- a/drivers/net/wireless/ath/ath9k/debug.c
2 +++ b/drivers/net/wireless/ath/ath9k/debug.c
3 @@ -873,6 +873,53 @@ static const struct file_operations fops
4 .llseek = default_llseek,
7 +static ssize_t read_file_eeprom(struct file *file, char __user *user_buf,
8 + size_t count, loff_t *ppos)
10 + struct ath_softc *sc = file->private_data;
11 + struct ath_hw *ah = sc->sc_ah;
12 + struct ath_common *common = ath9k_hw_common(ah);
19 + if (AR_SREV_9300_20_OR_LATER(ah))
25 + if (count > size - *ppos)
26 + count = size - *ppos;
28 + for (i = *ppos / 2; count > 0; count -= bytes, *ppos += bytes, i++) {
31 + if (!common->bus_ops->eeprom_read(common, i, &val))
37 + } else if (count == 1) {
42 + copy_to_user(user_buf, from, bytes);
48 +static const struct file_operations fops_eeprom = {
49 + .read = read_file_eeprom,
50 + .open = ath9k_debugfs_open,
51 + .owner = THIS_MODULE
54 int ath9k_init_debug(struct ath_hw *ah)
56 struct ath_common *common = ath9k_hw_common(ah);
57 @@ -938,6 +985,10 @@ int ath9k_init_debug(struct ath_hw *ah)
58 debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR,
59 sc->debug.debugfs_phy, &sc->sc_ah->gpio_val);
61 + if (!debugfs_create_file("eeprom", S_IRUSR,
62 + sc->debug.debugfs_phy, sc, &fops_eeprom))