rt2x00: Make rt2x00debug structure interface independent
PATCH 1/1 rt2x00: Make rt2x00debug structure interface independent
The rt2x00debug structure was 90% interface independent, this patch will remove the last interface dependent fields which allows us to make the rt2x00debug structure a static field inside each rt2x00 driver.
This patch also moves the rt2x00 debugfs files into a seperate folder _within_ the debugfs dentry provided by the wiphy structure. This will prevent rt2x00 dentry file names to accidently interfere with dentry files from others (i.e. mac80211).
This patch will make moving rt2x00debug into the rt2x00lib structure easier, but that will be handled in a different patch later. ;)
---
drivers/net/wireless/mac80211/rt2x00/rt2400pci.c +27 -22
@@ -225,35 +225,40 @@ static void rt2400pci_write_bbp(struct rt2x00_dev *rt2x00dev,rt2x00_bbp_write (rt2x00dev, word, *((u8 *)data)); } +static struct rt2x00debug rt2400pci_rt2x00debug = { + .owner =THIS_MODULE , + .mod_name =DRV_NAME , + .mod_version =DRV_VERSION , + .reg_csr = { + .read = rt2400pci_read_csr, + .write = rt2400pci_write_csr, + .word_size =sizeof (u32), + .length =CSR_REG_SIZE , + }, + .reg_eeprom = { + .read = rt2400pci_read_eeprom, + .write = rt2400pci_write_eeprom, + .word_size =sizeof (u16), + .length =EEPROM_SIZE , + }, + .reg_bbp = { + .read = rt2400pci_read_bbp, + .write = rt2400pci_write_bbp, + .word_size =sizeof (u8), + .length =BBP_SIZE , + }, +}; +static void rt2400pci_open_debugfs (struct rt2x00_dev *rt2x00dev) { -struct rt2x00debug *debug = &rt2x00dev->debug; - - debug->wiphy = rt2x00dev->hw->wiphy; - debug->owner =THIS_MODULE ; - debug->mod_name =DRV_NAME ; - debug->mod_version =DRV_VERSION ; - debug->reg_csr.read = rt2400pci_read_csr; - debug->reg_csr.write = rt2400pci_write_csr; - debug->reg_csr.word_size =sizeof (u32); - debug->reg_csr.length =CSR_REG_SIZE ; - debug->reg_eeprom.read = rt2400pci_read_eeprom; - debug->reg_eeprom.write = rt2400pci_write_eeprom; - debug->reg_eeprom.word_size =sizeof (u16); - debug->reg_eeprom.length =EEPROM_SIZE ; - debug->reg_bbp.read = rt2400pci_read_bbp; - debug->reg_bbp.write = rt2400pci_write_bbp; - debug->reg_bbp.word_size =sizeof (u8); - debug->reg_bbp.length =BBP_SIZE ; - debug->rt2x00dev = rt2x00dev; - -if (rt2x00debug_register (debug)) +if (!rt2x00debug_register (&rt2400pci_rt2x00debug, + rt2x00dev->hw->wiphy, rt2x00dev))ERROR ("Failed to register debug handler.\n" ); }static void rt2400pci_close_debugfs (struct rt2x00_dev *rt2x00dev) { -rt2x00debug_deregister (&rt2x00dev->debug); +rt2x00debug_deregister (&rt2x00dev->debugfs_data); }#else /* CONFIG_RT2X00_DEBUGFS */ static inline void rt2400pci_open_debugfs (struct rt2x00_dev *rt2x00dev){}
drivers/net/wireless/mac80211/rt2x00/rt2500pci.c +27 -22
62 lines not on this page · raw message
drivers/net/wireless/mac80211/rt2x00/rt2500usb.c +27 -22
62 lines not on this page · raw message
drivers/net/wireless/mac80211/rt2x00/rt2x00.h +1 -1
@@ -984,7 +984,7 @@ struct rt2x00_dev {* If enabled, the structure for the debugfs files. */ #ifdef CONFIG_RT2X00_DEBUGFS -struct rt2x00debug debug; +void *debugfs_data;#endif /* CONFIG_RT2X00_DEBUGFS */ /*
drivers/net/wireless/mac80211/rt2x00/rt2x00debug.c +32 -24
159 lines not on this page · raw message
drivers/net/wireless/mac80211/rt2x00/rt2x00debug.h +5 -19
@@ -28,6 +28,8 @@#ifndef RT2X00DEBUG_H #define RT2X00DEBUG_H +#include <net/wireless.h> +struct rt2x00_dev ; typedef void (debug_access_t)(struct rt2x00_dev *rt2x00dev,
@@ -43,11 +45,6 @@ struct rt2x00debug_reg {struct rt2x00debug {/* -* wiphy structure this entry belongs to. -*/ -struct wiphy *wiphy; - -/* * Reference to the modules structure. */ struct module *owner;
@@ -64,21 +61,10 @@ struct rt2x00debug {struct rt2x00debug_reg reg_csr;struct rt2x00debug_reg reg_eeprom; struct rt2x00debug_reg reg_bbp; - -/* -* Pointer to driver structure where -* this debugfs entry belongs to. -*/ -struct rt2x00_dev *rt2x00dev; - -/* -* Pointer to rt2x00debug private data, -* individual driver should not touch this. -*/ - void *priv; }; -extern int rt2x00debug_register (struct rt2x00debug *debug); -extern void rt2x00debug_deregister (struct rt2x00debug *debug); +void *rt2x00debug_register (struct rt2x00debug *debug,struct wiphy *wiphy, +struct rt2x00_dev *rt2x00dev); +void rt2x00debug_deregister (void *debugfs_data);#endif /* RT2X00DEBUG_H */
drivers/net/wireless/mac80211/rt2x00/rt61pci.c +27 -22
62 lines not on this page · raw message
drivers/net/wireless/mac80211/rt2x00/rt73usb.c +27 -22
62 lines not on this page · raw message
PATCH 1/1 rt2x00: Move rt2x00debug include file
Now that we are working on rt2x00debug anyway, lets remove the #if statements about RT2X00_DEBUGFS from rt2x00.h and completely handle it in the drivers.
This will remove the ugly define CONFIG_RT2X00_DEBUGFS hack And the rt2x00_dev structure is only increased slightly because of the void* pointer.
The rt2x00_debugfs.h needs to be included inside the drivers.
---
drivers/net/wireless/mac80211/rt2x00/rt2400pci.c +3 -1
@@ -186,7 +186,9 @@ rf_write:rt2x00_register_write (rt2x00dev,RFCSR , reg); } -#ifdef CONFIG_RT2X00_DEBUGFS +#if defined(CONFIG_RT2X00_DEBUGFS ) || defined(CONFIG_RT2X00_DEBUGFS_MODULE ) +#include "rt2x00debug.h" +#define CSR_OFFSET (__word) ( CSR_REG_BASE + ((__word) * sizeof(u32)) ) static void rt2400pci_read_csr(struct rt2x00_dev *rt2x00dev,
drivers/net/wireless/mac80211/rt2x00/rt2500pci.c +3 -1
@@ -186,7 +186,9 @@ rf_write:rt2x00_register_write (rt2x00dev,RFCSR , reg); } -#ifdef CONFIG_RT2X00_DEBUGFS +#if defined(CONFIG_RT2X00_DEBUGFS ) || defined(CONFIG_RT2X00_DEBUGFS_MODULE ) +#include "rt2x00debug.h" +#define CSR_OFFSET (__word) ( CSR_REG_BASE + ((__word) * sizeof(u32)) ) static void rt2500pci_read_csr(struct rt2x00_dev *rt2x00dev,
drivers/net/wireless/mac80211/rt2x00/rt2500usb.c +3 -1
@@ -228,7 +228,9 @@ rf_write:rt2x00_register_write (rt2x00dev,PHY_CSR10 , reg); } -#ifdef CONFIG_RT2X00_DEBUGFS +#if defined(CONFIG_RT2X00_DEBUGFS ) || defined(CONFIG_RT2X00_DEBUGFS_MODULE ) +#include "rt2x00debug.h" +#define CSR_OFFSET (__word) ( CSR_REG_BASE + ((__word) * sizeof(u16)) ) static void rt2500usb_read_csr(struct rt2x00_dev *rt2x00dev,
drivers/net/wireless/mac80211/rt2x00/rt2x00.h +0 -7
@@ -32,11 +32,6 @@#include <linux/workqueue.h> #include <net/mac80211.h> -#if defined(CONFIG_RT2X00_DEBUGFS ) || defined(CONFIG_RT2X00_DEBUGFS_MODULE ) -#define CONFIG_RT2X00_DEBUGFS -#include "rt2x00debug.h" -#endif /* CONFIG_RT2X00_DEBUGFS */ -/* * Module information. */
@@ -983,9 +978,7 @@ struct rt2x00_dev {/* * If enabled, the structure for the debugfs files. */ -#ifdef CONFIG_RT2X00_DEBUGFS void *debugfs_data; -#endif /* CONFIG_RT2X00_DEBUGFS */ /* * Queue for deferred work.
drivers/net/wireless/mac80211/rt2x00/rt61pci.c +3 -1
@@ -217,7 +217,9 @@ static void rt2x00_mcu_request(const struct rt2x00_dev *rt2x00dev,rt2x00_register_write (rt2x00dev,HOST_CMD_CSR , reg); } -#ifdef CONFIG_RT2X00_DEBUGFS +#if defined(CONFIG_RT2X00_DEBUGFS ) || defined(CONFIG_RT2X00_DEBUGFS_MODULE ) +#include "rt2x00debug.h" +#define CSR_OFFSET (__word) ( CSR_REG_BASE + ((__word) * sizeof(u32)) ) static void rt61pci_read_csr(struct rt2x00_dev *rt2x00dev,
drivers/net/wireless/mac80211/rt2x00/rt73usb.c +3 -1
@@ -224,7 +224,9 @@ rf_write:rt2x00_register_write (rt2x00dev,PHY_CSR4 , reg); } -#ifdef CONFIG_RT2X00_DEBUGFS +#if defined(CONFIG_RT2X00_DEBUGFS ) || defined(CONFIG_RT2X00_DEBUGFS_MODULE ) +#include "rt2x00debug.h" +#define CSR_OFFSET (__word) ( CSR_REG_BASE + ((__word) * sizeof(u32)) ) static void rt73usb_read_csr(struct rt2x00_dev *rt2x00dev,