acxsm: Make acxsm modular again (2nd try)
Subsystems (3)
cover acxsm: Make acxsm modular again (2nd try)
Hi,
There are a couple of differences between this and my previos patch, so I'll list them here:
- Separate the patches properly
- This patchset uses the default generic functions and calls the appropiate function using a #define, which should be much clearer and saves us from having to migrate the whole common.c file.
- We get the proper string for the _debug family of functions.
- acx_ops.issue_cmd takes different functions depending on the debug level so we save a few bytes we weren't going to use otherwise. This also saves a function call.
- Denis' sense of style has been applied, though some of it doesn't apply anymore and some came from me trying to do too many things at once which screwed up the format. I hope these are alright.
Kconfig | 40 ++++++++++---------- Makefile | 15 +++++-- acx_func.h | 112 ++++++++++++++++++++-------------------------------------- acx_struct.h | 32 ++++++++++++++-- common.c | 113 ++++++++++++++++++++++++++++------------------------------- ioctl.c | 2 + pci.c | 31 ++++++++++++++++ usb.c | 27 +++++++++++++- 8 files changed, 212 insertions(+), 160 deletions(-)
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
PATCH 1/7 acxsm: Change Kconfig and Makefile to be modular
We now only expose ACX_PCI and ACX_USB and the Makefile creates acx-usb.ko, acx-pci.ko and acx-common.ko
---
Kconfig | 40 ++++++++++++++++++++-------------------- Makefile | 15 +++++++++++---- 2 files changed, 31 insertions(+), 24 deletions(-)
66c1585df6e0969806b9608fb3f006eb1eb02637
Kconfig +20 -20
@@ -1,6 +1,6 @@ -config ACX - tristate "TI acx100/acx111 802.11b/g wireless chipsets" - depends on NET_RADIO && EXPERIMENTAL && (USB || PCI) +config ACX_PCI + tristate "TI acx100/acx111 802.11b/g PCI" + depends on NET_RADIO && EXPERIMENTAL && PCI select FW_LOADER select IEEE80211 select IEEE80211_SOFTMAC
@@ -8,20 +8,7 @@ config ACX A driver for 802.11b/g wireless cards based on Texas Instruments acx100 and acx111 chipsets. - This driver supports Host AP mode that allows - your computer to act as an IEEE 802.11 access point. - This driver is new and experimental. - - Texas Instruments did not take part in development of this driver - in any way, shape or form. - - The driver can be compiled as a module and will be named "acx". - -config ACX_PCI - bool "TI acx100/acx111 802.11b/g PCI" - depends on ACX && PCI - ---help--- - Include PCI and CardBus support in acx. + This is the PCI code. acx chipsets need their firmware loaded at startup. You will need to provide a firmware image via hotplug.
@@ -46,11 +33,20 @@ config ACX_PCI Firmware files are not covered by GPL and are not distributed with this driver for legal reasons. + Texas Instruments did not take part in development of this driver + in any way, shape or form. + config ACX_USB - bool "TI acx100/acx111 802.11b/g USB" - depends on ACX && (USB=y || USB=ACX) + tristate "TI acx100/acx111 802.11b/g USB" + depends on NET_RADIO && EXPERIMENTAL && USB + select FW_LOADER + select IEEE80211 + select IEEE80211_SOFTMAC ---help--- - Include USB support in acx. + A driver for 802.11b/g wireless cards based on + Texas Instruments acx100 and acx111 chipsets. + + This is the USB code. There is only one currently known device in this category, D-Link DWL-120+, but newer devices seem to be on the horizon.
@@ -63,3 +59,7 @@ config ACX_USB Firmware files are not covered by GPL and are not distributed with this driver for legal reasons. + + Texas Instruments did not take part in development of this driver + in any way, shape or form. +
Makefile +11 -4
@@ -1,6 +1,13 @@ -obj-$(CONFIG_ACX) += acx.o +acx-common-y += wlan.o ioctl.o common.o +acx-usb-y += usb.o +acx-pci-y += pci.o -acx-obj-$(CONFIG_ACX_PCI) += pci.o -acx-obj-$(CONFIG_ACX_USB) += usb.o +obj-$(CONFIG_ACX_PCI) += acx-common.o acx-pci.o +obj-$(CONFIG_ACX_USB) += acx-common.o acx-usb.o -acx-objs := wlan.o ioctl.o common.o $(acx-obj-y) +#obj-$(CONFIG_ACX) += acx.o +# +#acx-obj-$(CONFIG_ACX_PCI) += pci.o +#acx-obj-$(CONFIG_ACX_USB) += usb.o +# +#acx-objs := wlan.o ioctl.o common.o $(acx-obj-y)
Signature · 10 lines
1.2.1.g62a4 ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
PATCH 2/7 acxsm: Move module init/exit to the modules
In reply to Carlos MartinWe now have the module license and init/exit routines in each module instead of just calling them through common.c.
---
common.c | 55 +------------------------------------------------------ pci.c | 10 ++++++++++ usb.c | 11 ++++++++++- 3 files changed, 21 insertions(+), 55 deletions(-)
147a9817d6d762545fc7c5efc124281b7c8ca8fb
common.c +1 -54
@@ -94,7 +94,7 @@ MODULE_LICENSE("Dual MPL/GPL");#endif /* USB had this: MODULE_AUTHOR("Martin Wawro <martin.wawro AT uni-dortmund.de>"); */ MODULE_AUTHOR ("ACX100 Open Source Driver development team" ); -MODULE_DESCRIPTION ("Driver for TI ACX1xx based wireless cards (CardBus/PCI/USB)" ); +MODULE_DESCRIPTION ("Driver for TI ACX1xx based wireless cards (common)" );/***********************************************************************
@@ -7407,59 +7407,6 @@ acx_s_parse_configoption(acx_device_t *a } -/*********************************************************************** -*/ -static int __init -acx_e_init_module (void ) -{ -int r1,r2; - -acx_struct_size_check (); - -printk ("acx: this driver is still EXPERIMENTAL\n" -"acx: reading README file and/or Craig's HOWTO is " -"recommended, visit http://acx100.sf.net in case " -"of further questions/discussion\n" ); - -#if defined(CONFIG_ACX_PCI ) - r1 =acxpci_e_init_module (); -#else - r1 = -EINVAL ; -#endif -#if defined(CONFIG_ACX_USB ) - r2 =acxusb_e_init_module (); -#else - r2 = -EINVAL ; -#endif -if (r2 && r1)/* both failed! */ -return r2 ? r2 : r1; -/* return success if at least one succeeded */ -return 0 ; -} - -static void __exit -acx_e_cleanup_module (void ) -{ -#if defined(CONFIG_ACX_PCI ) -acxpci_e_cleanup_module (); -#endif -#if defined(CONFIG_ACX_USB ) -acxusb_e_cleanup_module (); -#endif -} - -module_init(acx_e_init_module) -module_exit(acx_e_cleanup_module) - - - - - - - - - -//SM void acx_e_ieee80211_set_security(struct net_device *ndev,
pci.c +10 -0
@@ -105,6 +105,13 @@ static int acxpci_e_close(struct net_devstatic void acxpci_s_up (struct net_device *ndev);static void acxpci_s_down (struct net_device *ndev); +#ifdef MODULE_LICENSE +MODULE_LICENSE ("Dual MPL/GPL" ); +#endif +/* USB had this: MODULE_AUTHOR("Martin Wawro <martin.wawro AT uni-dortmund.de>"); */ +MODULE_AUTHOR ("ACX100 Open Source Driver development team" ); +MODULE_DESCRIPTION ("Driver for TI ACX1xx based wireless cards (CardBus/PCI)" ); +/*********************************************************************** ** Register access
@@ -4192,3 +4199,6 @@ acxpci_e_cleanup_module(void)FN_EXIT0 ; } + +module_init (acxpci_e_init_module); +module_exit (acxpci_e_cleanup_module);
usb.c +10 -1
@@ -127,6 +127,14 @@ static void acxusb_i_tx_timeout(struct n/* static void dump_device_descriptor(struct usb_device_descriptor *); */ /* static void dump_config_descriptor(struct usb_config_descriptor *); */ +#ifdef MODULE_LICENSE +MODULE_LICENSE ("Dual MPL/GPL" ); +#endif +/* USB had this: MODULE_AUTHOR("Martin Wawro <martin.wawro AT uni-dortmund.de>"); */ +MODULE_AUTHOR ("ACX100 Open Source Driver development team" ); +MODULE_DESCRIPTION ("Driver for TI ACX1xx based wireless cards (USB)" ); + +/*********************************************************************** ** Module Data */
@@ -1811,7 +1819,8 @@ acxusb_e_cleanup_module()usb_deregister (&acxusb_driver); } - +module_init (acxusb_e_init_module); +module_exit (acxusb_e_cleanup_module);/*********************************************************************** ** DEBUG STUFF */
Signature · 10 lines
1.2.1.g62a4 ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
PATCH 3/7 acxsm: Create struct acx_ops
In reply to Carlos Martinstruct acx_ops is where the device-specific functions go. This allows us to call these functions from the acx-common.ko module without creating recursive dependencies.
---
acx_struct.h | 32 ++++++++++++++++++++++++++++---- 1 files changed, 28 insertions(+), 4 deletions(-)
fe7e63091292e78cb523c8060b267c0faeb3b898
acx_struct.h +28 -4
@@ -87,6 +87,31 @@ enum { acx_debug = 0 };#define SCHEDULE_WORK schedule_work#define FLUSH_SCHEDULED_WORK flush_scheduled_work +/*********************************************************************** +** Chip-specific functions get set here. +*/ + +struct acx_ops { +int (*create_dma_regions)(acx_device_t *); +void (*delete_dma_regions)(acx_device_t *); + +#if ACX_DEBUG +int (*issue_cmd)(acx_device_t *adev,unsigned cmd,void *param, +unsigned len,unsigned cmd_timeout,const char *cmdstr); +#else +int (*issue_cmd)(acx_device_t *adev,unsigned cmd,void *param, +unsigned len,unsigned cmd_timeout); +#endif /* ACX_DEBUG */ +tx_t * (*alloc_tx)(acx_device_t *adev); +void (*dealloc_tx)(tx_t *tx_opaque); + +void * (*get_txbuf)(acx_device_t *adev,tx_t *tx_opaque); +void (*tx_data)(acx_device_t *adev,tx_t *tx_opaque,int len); + +int (*write_phy_reg)(acx_device_t *adev,u32 reg,u8 value); +int (*read_phy_reg)(acx_device_t *adev,u32 reg,u8 *charbuf); +}; +/*********************************************************************** ** Constants
@@ -105,10 +130,6 @@ enum { acx_debug = 0 };#define DEVTYPE_PCI 0#define DEVTYPE_USB 1 -#if !defined(CONFIG_ACX_PCI ) && !defined(CONFIG_ACX_USB ) -#error Driver must include PCI and/or USB support. You selected neither. -#endif -#if defined(CONFIG_ACX_PCI )#if !defined(CONFIG_ACX_USB )#define IS_PCI (adev) 1
@@ -1198,6 +1219,9 @@ struct acx_device {/*** Linux network device ***/ struct net_device *ndev;/* pointer to linux netdevice */ +/* Chip-specific functions */ +struct acx_ops ops; +/*** Device statistics ***/ struct net_device_stats stats;/* net device statistics */ #ifdef WIRELESS_EXT
Signature · 10 lines
1.2.1.g62a4 ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
PATCH 6/7 acxsm: Assign chip-specific ops in the probe functions
In reply to Carlos MartinAssign the chip-specific ops in the probe functions. Add extern and dummy functions where needed.
---
acx_func.h | 1 + pci.c | 24 ++++++++++++++++++++++++ usb.c | 19 +++++++++++++++++++ 3 files changed, 44 insertions(+), 0 deletions(-)
1a6bb060d33906c12c6ef161b851cc1fab91d3a9
acx_func.h +1 -0
@@ -534,6 +534,7 @@ acx_l_alloc_tx(acx_device_t *adev) }void acxusb_l_dealloc_tx (tx_t *tx_opaque); +void acxpci_l_dealloc_tx (tx_t *tx_opaque);static inline void acx_l_dealloc_tx (acx_device_t *adev,tx_t *tx_opaque) {
pci.c +24 -0
@@ -105,6 +105,9 @@ static int acxpci_e_close(struct net_devstatic void acxpci_s_up (struct net_device *ndev);static void acxpci_s_down (struct net_device *ndev); +extern int acx100_s_create_dma_regions (acx_device_t *); +extern int acx111_s_create_dma_regions (acx_device_t *); +#ifdef MODULE_LICENSE MODULE_LICENSE ("Dual MPL/GPL" );#endif
@@ -1599,6 +1602,22 @@ acxpci_e_probe(struct pci_dev *pdev, con adev->ieee->sec.enabled =0 ; adev->ieee->sec.auth_mode =WLAN_AUTH_OPEN ; +#if ACX_DEBUG + adev->ops.issue_cmd = acxpci_s_issue_cmd_timeo_debug; +#else + adev->ops.issue_cmd = acxpci_s_issue_cmd_timeo; +#endif /* ACX_DEBUG */ + adev->ops.alloc_tx = acxpci_l_alloc_tx; + adev->ops.dealloc_tx = acxpci_l_dealloc_tx; + adev->ops.delete_dma_regions = acxpci_s_delete_dma_regions; + adev->ops.write_phy_reg = acxpci_s_write_phy_reg; + adev->ops.read_phy_reg = acxpci_s_read_phy_reg; + +if (IS_ACX100 (adev)) { + adev->ops.create_dma_regions = acx100_s_create_dma_regions; + }else { + adev->ops.create_dma_regions = acx111_s_create_dma_regions; + }#ifdef NONESSENTIAL_FEATURES acx_show_card_eeprom_id (adev);#endif /* NONESSENTIAL_FEATURES */
@@ -3058,6 +3077,11 @@ end:return (tx_t *)txdesc; } +/* Dummy function. */ +static void +acxpci_l_dealloc_tx (tx_t *tx_opaque) +{ +}/*********************************************************************** */
usb.c +19 -0
@@ -123,6 +123,8 @@ static void acxusb_l_poll_rx(acx_device_static void acxusb_i_tx_timeout (struct net_device *); +extern int acx100_s_create_dma_regions (acx_device_t *); +/* static void dump_device(struct usb_device *); */ /* static void dump_device_descriptor(struct usb_device_descriptor *); */ /* static void dump_config_descriptor(struct usb_config_descriptor *); */
@@ -763,6 +765,11 @@ acxusb_s_fill_configoption(acx_device_treturn OK ; } +/* Dummy function. */ +static void +acxusb_s_delete_dma_regions (acx_device_t *adev) +{ +}/*********************************************************************** ** acxusb_e_probe()
@@ -891,6 +898,18 @@ acxusb_e_probe(struct usb_interface *int adev->ieee->sec.encrypt =0 ; adev->ieee->sec.auth_mode =WLAN_AUTH_OPEN ; +#if ACX_DEBUG + adev->ops.issue_cmd = acxusb_s_issue_cmd_timeo_debug; +#else + adev->ops.issue_cmd = acxusb_s_issue_cmd_timeo; +#endif /* ACX_DEBUG */ + adev->ops.alloc_tx = acxusb_l_alloc_tx; + adev->ops.dealloc_tx = acxusb_l_dealloc_tx; + adev->ops.delete_dma_regions = acxusb_s_delete_dma_regions; + adev->ops.write_phy_reg = acxusb_s_write_phy_reg; + adev->ops.read_phy_reg = acxusb_s_read_phy_reg; + adev->ops.create_dma_regions = acx100_s_create_dma_regions; +/* Check that this is really the hardware we know about. ** If not sure, at least notify the user that he ** may be in trouble...
Signature · 10 lines
1.2.1.g62a4 ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642