Discussion:
[Acx100-devel] [PATCH 04/19] debugfs.c: make debugfs_fops static
Jim Cromie
2012-05-15 07:51:02 UTC
Permalink
also wrap a line > 80 cols

Signed-off-by: Jim Cromie <***@gmail.com>
---
debugfs.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/debugfs.c b/debugfs.c
index 8ecaf32..426c598 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -112,7 +112,7 @@ static int acx_dbgfs_write(struct file *file, const char __user *buf,
return (acx_proc_write_funcs[fidx])(file, buf, count, ppos);
}

-const struct file_operations acx_fops = {
+static const struct file_operations acx_fops = {
.read = seq_read,
.write = acx_dbgfs_write,
.open = acx_dbgfs_open,
@@ -124,7 +124,7 @@ static struct dentry *acx_dbgfs_dir;
int acx_debugfs_add_adev(struct acx_device *adev)
{
int i;
- fmode_t fmode;
+ int fmode;
struct dentry *file;
const char *devname = wiphy_name(adev->ieee->wiphy);
struct dentry *acx_dbgfs_devdir
@@ -167,7 +167,8 @@ fail:
void acx_debugfs_remove_adev(struct acx_device *adev)
{
debugfs_remove_recursive(adev->debugfs_dir);
- pr_info("%s %p\n", wiphy_name(adev->ieee->wiphy), adev->debugfs_dir);
+ pr_info("%s %p\n", wiphy_name(adev->ieee->wiphy),
+ adev->debugfs_dir);
adev->debugfs_dir = NULL;
}
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:00 UTC
Permalink
Patch started as make check cleanup, grew into build refinement.
Generally, it tightens up #ifdefs which enable code for debugfs and
procfs interfaces.

- change #ifdef CONFIG_PROC_FS to CONFIG_PROC_FS || CONFIG_DEBUG_FS,
to enable file callbacks for procfs and/or debugfs.

- declare proc_(show|write)_funcs[] in merge.h (we have no common.h),
along with the supporting typedefs. Drop those typedefs in common.c
and in debugfs.c (which now includes merge.h)

- #ifdef ACX_WANT_PROC_FILES_ANYWAY controls presence of proc-files,
needed in addition to CONFIG_PROC_FS (since debugfs is preserved).
Probably should enable it automatically when CONFIG_DEBUG_FS=n.

Signed-off-by: Jim Cromie <***@gmail.com>
---
common.c | 32 +++++++++++++++-----------------
debugfs.c | 10 +++-------
merge.h | 10 ++++++++++
3 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/common.c b/common.c
index 5746c38..6f79a42 100644
--- a/common.c
+++ b/common.c
@@ -703,16 +703,20 @@ u16 acx_rate111_hwvalue_to_bitrate(u16 hw_value)
return (bitrate);
}

-/* Proc */
-#ifdef CONFIG_PROC_FS
-
+#if defined CONFIG_PROC_FS || defined CONFIG_PROC_FS
+/*
+ * debugfs.c provides new interface to the "files", procfs interface
+ * is deprecated for new stuff. Keep PROC_FS facility for users with
+ * non-DEBUG_FS kernels, so keep handlers themselves here.
+ */
+#ifdef ACX_WANT_PROC_FILES_ANYWAY
+/* obsoleted by debugfs.c */
static const char *const proc_files[] = {
"info", "diag", "eeprom", "phy", "debug",
"sensitivity", "tx_level", "antenna", "reg_domain",
};
-
-typedef int acx_proc_show_t(struct seq_file *file, void *v);
-typedef ssize_t (acx_proc_write_t)(struct file *, const char __user *, size_t, loff_t *);
+static struct file_operations acx_e_proc_ops[ARRAY_SIZE(proc_files)];
+#endif /* ACX_WANT_PROC_FILES_ANYWAY */

acx_proc_show_t *const acx_proc_show_funcs[] = {
acx_proc_show_acx,
@@ -725,8 +729,6 @@ acx_proc_show_t *const acx_proc_show_funcs[] = {
acx_proc_show_antenna,
acx_proc_show_reg_domain,
};
-BUILD_BUG_DECL(proc_files__VS__acx_proc_show_funcs,
- ARRAY_SIZE(proc_files) != ARRAY_SIZE(acx_proc_show_funcs));

acx_proc_write_t *const acx_proc_write_funcs[] = {
NULL,
@@ -742,11 +744,6 @@ acx_proc_write_t *const acx_proc_write_funcs[] = {
BUILD_BUG_DECL(SHOW, ARRAY_SIZE(acx_proc_show_funcs)
!= ARRAY_SIZE(acx_proc_write_funcs));

-#ifndef CONFIG_DEBUG_FS
-/* obsoleted */
-static struct file_operations acx_e_proc_ops[ARRAY_SIZE(proc_files)];
-#endif
-
#endif /* CONFIG_PROC_FS */

/*
@@ -4915,7 +4912,8 @@ out:
return ret;
}

-#if 0 /* now in debugfs.c */
+#ifdef ACX_WANT_PROC_FILES_ANYWAY
+
static int acx_proc_open(struct inode *inode, struct file *file)
{
int i;
@@ -5018,9 +5016,9 @@ int acx_proc_unregister_entries(struct ieee80211_hw *hw)
FN_EXIT0;
return OK;
}
-#else /* now in debugfs.c */
-void acx_proc_init(void) { } /* stub */
-#endif /* now in debugfs.c */
+#else /* ACX_WANT_PROC_FILES_ANYWAY */
+static void acx_proc_init(void) { } /* stub */
+#endif /* ACX_WANT_PROC_FILES_ANYWAY */

#endif /* defined(CONFIG_PROC_FS) || defined(CONFIG_DEBUGC_FS) */

diff --git a/debugfs.c b/debugfs.c
index 8ad57b4..10fff7f 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -17,13 +17,7 @@ void acx_debugfs_remove_adev(struct acx_device *adev) { return 0; }
#include <linux/seq_file.h>
#include <net/mac80211.h>
#include "acx.h"
-
-typedef int acx_proc_show_t(struct seq_file *file, void *v);
-typedef ssize_t (acx_proc_write_t)(struct file *, const char __user *,
- size_t, loff_t *);
-
-extern acx_proc_show_t *const acx_proc_show_funcs[];
-extern acx_proc_write_t *const acx_proc_write_funcs[];
+#include "merge.h" /* for acx_proc_(show|write)_funcs[]; */

/*
* debugfs files are created under $DBGMNT/acx_mac80211/phyX by
@@ -56,6 +50,8 @@ static const char *const dbgfs_files[] = {
[ANTENNA] = "antenna",
[REG_DOMAIN] = "reg_domain",
};
+BUILD_BUG_DECL(dbgfs_files__VS__enum_REG_DOMAIN,
+ ARRAY_SIZE(dbgfs_files) != REG_DOMAIN + 1);

static int acx_dbgfs_open(struct inode *inode, struct file *file)
{
diff --git a/merge.h b/merge.h
index fcac272..23eaa64 100644
--- a/merge.h
+++ b/merge.h
@@ -1,6 +1,16 @@
#ifndef _MERGE_H_
#define _MERGE_H_

+/* these 2 externs are defined in common.c (but we dont have a
+ * common.h), so expose them here. Theyre used in debugfs.c
+ */
+typedef int acx_proc_show_t(struct seq_file *file, void *v);
+typedef ssize_t ((acx_proc_write_t)(struct file *, const char __user *,
+ size_t, loff_t *));
+
+extern acx_proc_show_t *const acx_proc_show_funcs[];
+extern acx_proc_write_t *const acx_proc_write_funcs[];
+
#include <linux/interrupt.h>

irqreturn_t acx_interrupt(int irq, void *dev_id);
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:50:59 UTC
Permalink
Commit 5b98c8e5723, missed one ifdef conversion to CONFIG_ACX_MAC80211_PCI

Signed-off-by: Jim Cromie <***@gmail.com>
---
merge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/merge.c b/merge.c
index e952dae..fb02c28 100644
--- a/merge.c
+++ b/merge.c
@@ -1932,7 +1932,7 @@ int acx_reset_dev(acx_device_t *adev)
/* reset the device to make sure the eCPU is stopped
* to upload the firmware correctly */

-#ifdef CONFIG_PCI
+#ifdef CONFIG_ACX_MAC80211_PCI
acxpci_reset_mac(adev);
#endif
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:08 UTC
Permalink
- #ifdef guard: use correct guard name
- fixup comment grammar
- drop some obsolete comments
- change code-fence to not match with git's conflict markers

Signed-off-by: Jim Cromie <***@gmail.com>
---
inlines.h | 51 +++++++++++++++++++--------------------------------
1 file changed, 19 insertions(+), 32 deletions(-)

diff --git a/inlines.h b/inlines.h
index deb256a..b62f1c3 100644
--- a/inlines.h
+++ b/inlines.h
@@ -1,29 +1,20 @@
-#ifndef _MEM_INLINES_H_
-#define _MEM_INLINES_H_
+#ifndef _INLINES_H_
+#define _INLINES_H_

-/* currently need this even for no-mem builds, as it contains the
- * locking elements used in merge.c. TBD whether its worth
- * repartitioning to achieve this
- */
-#if defined(CONFIG_ACX_MAC80211_MEM) || 1
-
-/*
+/* ##################################################
* BOM Data Access
* Locking in mem
- * ==================================================
- */
-
-/*
- * Locking in mem is more complex as for pci, because the different
+ *
+ * Locking in mem is more complex than for pci, because the different
* data-access functions below need to be protected against incoming
* interrupts.
*
- * Data-access on the mem device is always going in serveral,
- * none-atomic steps, involving 2 or more register writes
- * (e.g. ACX_SLV_REG_ADDR, ACX_SLV_REG_DATA).
+ * Data-access on the mem device is always going in several non-atomic
+ * steps, involving 2 or more register writes (e.g. ACX_SLV_REG_ADDR,
+ * ACX_SLV_REG_DATA).
*
* If an interrupt is serviced while a data-access function is
- * ongoing, this may give access interference with by the involved
+ * ongoing, this may cause access interference with the involved
* operations, since the irq routine is also using the same
* data-access functions.
*
@@ -43,14 +34,14 @@
* accesses well enough, that simple driver operation without
* inbetween scans work without problems.
*
- * Different locking approaches a possible to solves this (e.g. fine
+ * Different locking approaches are possible to solve this (e.g. fine
* vs coarse-grained).
*
* The chosen approach is:
*
- * 1) Mem.c data-access functions contain all a check to insure, they
- * are executed under the acx-spinlock. => This is the red line that
- * tells, if something needs coverage.
+ * 1) Mem.c data-access functions all contain a check to insure that
+ * they are executed under the acx-spinlock. => This is the red line
+ * that tells, if something needs coverage.
*
* 2) The scope of acx-spinlocking is local, in this case here only to
* mem.c. All common.c functions are already protected by the sem.
@@ -61,20 +52,17 @@
*
* a) as coarse-grained as possible, and ...
*
- * b) ... as fine-grained as required. Basically that means, that
- * before functions, that sleep, unlocking needs to be done. And
- * locking is taken up again inside the sleeping
- * function. Specifically the cmd-functions are used in this path.
+ * b) ... as fine-grained as required. Basically that means that
+ * before functions that sleep are called, unlocking needs to be done.
+ * And locks are taken again inside the sleeping function.
+ * Specifically the cmd-functions are used in this path.
*
* Once stable, the locking checks in the data-access functions could
- * be #defined away. Mem.c is anyway more used two smaller cpus (pxa
+ * be #defined away. Mem.c is anyway more used two smaller cpus (pxa
* UP e.g.), so the implied runtime constraints by the lock won't take
* much effect.
*/

-/* These are used in many mem.c funcs, including those which should be
- * merged with their pci counterparts.
- */
#define acxmem_lock_flags unsigned long flags = 0
#define acxmem_lock() \
if (IS_MEM(adev)) \
@@ -447,5 +435,4 @@ INLINE_IO u16 read_slavemem16(acx_device_t *adev, u32 slave_address)
return val;
}

-#endif /* CONFIG_ACX_MAC80211_MEM */
-#endif /* _MEM_INLINES_H_ */
+#endif /* _INLINES_H_ */
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:04 UTC
Permalink
- add "static" back to acxpci_{probe,remove,suspend,resume}()
- add __iomem to vars assigned from pci_iomap()
- a few linewraps

Signed-off-by: Jim Cromie <***@gmail.com>
---
pci.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/pci.c b/pci.c
index 9008267..45f20be 100644
--- a/pci.c
+++ b/pci.c
@@ -1080,9 +1080,8 @@ acx100pci_ioctl_set_phy_amp_bias(struct net_device *ndev,
* id - ptr to the device id entry that matched this device
*/
#ifdef CONFIG_PCI
-static
-int __devinit
-acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+static int __devinit acxpci_probe(struct pci_dev *pdev,
+ const struct pci_device_id *id)
{
acx111_ie_configoption_t co;
unsigned long mem_region1 = 0;
@@ -1449,10 +1448,10 @@ done:
*
* pdev - ptr to PCI device structure containing info about pci configuration
*/
-static
-void __devexit acxpci_remove(struct pci_dev *pdev)
+static void __devexit acxpci_remove(struct pci_dev *pdev)
{
- struct ieee80211_hw *hw = (struct ieee80211_hw *)pci_get_drvdata(pdev);
+ struct ieee80211_hw *hw
+ = (struct ieee80211_hw *) pci_get_drvdata(pdev);
acx_device_t *adev = ieee2adev(hw);
unsigned long mem_region1, mem_region2;

@@ -1555,8 +1554,7 @@ void __devexit acxpci_remove(struct pci_dev *pdev)
** TODO: PM code needs to be fixed / debugged / tested.
*/
#ifdef CONFIG_PM
-static
-int acxpci_e_suspend(struct pci_dev *pdev, pm_message_t state)
+static int acxpci_e_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct ieee80211_hw *hw = pci_get_drvdata(pdev);
acx_device_t *adev;
@@ -1587,8 +1585,7 @@ int acxpci_e_suspend(struct pci_dev *pdev, pm_message_t state)
return OK;
}

-static
-int acxpci_e_resume(struct pci_dev *pdev)
+static int acxpci_e_resume(struct pci_dev *pdev)
{
struct ieee80211_hw *hw = pci_get_drvdata(pdev);
acx_device_t *adev;
@@ -1782,7 +1779,8 @@ static __devinit int vlynq_probe(struct vlynq_device *vdev,

FN_ENTER;

- ieee = ieee80211_alloc_hw(sizeof(struct acx_device), &acxpci_hw_ops);
+ ieee = ieee80211_alloc_hw(sizeof(struct acx_device),
+ &acxpci_hw_ops);
if (!ieee) {
pr_acx("could not allocate ieee80211 structure %s\n",
dev_name(&vdev->dev));
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:01 UTC
Permalink
Signed-off-by: Jim Cromie <***@gmail.com>
---
debugfs.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/debugfs.c b/debugfs.c
index 10fff7f..8ecaf32 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -33,6 +33,9 @@ void acx_debugfs_remove_adev(struct acx_device *adev) { return 0; }
* match/strcmp against the callback. The acx_device *ptr is
* retrieved from the file's parent's private data, and passed to the
* callback so it knows what vif to print data for.
+ *
+ * Similarly, a singe write handler retrieves the acx_device_t pointer
+ * and file-index, and dispatches to the file handler for that index.
*/

enum file_index {
@@ -83,6 +86,7 @@ static int acx_dbgfs_open(struct inode *inode, struct file *file)
static int acx_dbgfs_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
+ /* retrieve file-index and adev from private fields */
int fidx = (int) file->f_path.dentry->d_inode->i_private;
struct acx_device *adev = (struct acx_device *)
file->f_path.dentry->d_parent->d_inode->i_private;
@@ -130,7 +134,8 @@ int acx_debugfs_add_adev(struct acx_device *adev)
pr_err("debugfs_create_dir() failed\n");
return -ENOMEM;
}
- pr_info("adev:%p nm:%s dirp:%p\n", adev, devname, acx_dbgfs_devdir);
+ pr_info("adev:%p nm:%s dirp:%p\n", adev, devname,
+ acx_dbgfs_devdir);

if (acx_dbgfs_devdir->d_inode->i_private) {
/* this shouldnt happen */
@@ -138,12 +143,14 @@ int acx_debugfs_add_adev(struct acx_device *adev)
acx_dbgfs_devdir->d_inode->i_private);
goto fail;
}
+ /* save adev in dir's private field */
acx_dbgfs_devdir->d_inode->i_private = (void*) adev;

for (i = 0; i < ARRAY_SIZE(dbgfs_files); i++) {

fmode = (acx_proc_write_funcs[i])
? 0644 : 0444;
+ /* save file-index in in file's private field */
file = debugfs_create_file(dbgfs_files[i], fmode,
acx_dbgfs_devdir,
(void*) i, &acx_fops);
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:07 UTC
Permalink
Support writing symbolic names to debugflags.

$> echo +L_CTL,-L_BUFR > /sys/modules/acx_mac80211/parameters/debugflags

Names accepted are same as those printed by catting the file, prefixed
by +/- to turn on/off the bit. Multiple names can be given, separated
by commas. Maybe should drop the L_ prefix.

Signed-off-by: Jim Cromie <***@gmail.com>
---
common.c | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/common.c b/common.c
index a4746cc..fb7d4fc 100644
--- a/common.c
+++ b/common.c
@@ -6975,7 +6975,44 @@ static int acx_debug_flag_get(char *buf, const struct kernel_param *kp)

static int acx_debug_flag_set(const char *val, const struct kernel_param *kp)
{
- TODO();
+ int i, len = strlen(val);
+ char sign, *e, *p = (char*) val;
+
+ pr_info("val: %s len:%d\n", val, len);
+ while (*p) {
+ sign = *p++;
+ switch (sign) {
+ case '+':
+ case '-':
+ break;
+ default:
+ return -EINVAL;
+ }
+ if ((e = strchr(p, ',')))
+ *e = '\0';
+
+ for (i = 0; i < ARRAY_SIZE(flag_names); i++) {
+ if (strcmp(p, flag_names[i])) {
+
+ pr_info("found: %s flags:0x%x\n",
+ p, acx_debug);
+
+ if (sign == '+')
+ acx_debug |= (1 << i);
+ else
+ acx_debug &= ~(1 << i);
+
+ pr_info("new:%x\n", acx_debug);
+ p = ++e;
+ continue;
+ }
+ }
+ if (i == ARRAY_SIZE(flag_names)) {
+ pr_err("no match on val: %s len:%d\n", p, len);
+ return -EINVAL;
+ }
+ p = ++e;
+ }
return 0;
}
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:03 UTC
Permalink
make C=2 caught 5 __user related errors in acx_proc_write_*(),
similar to:

acx-mac80211/common.c:4714:44: warning: incorrect type in argument 1 (different address spaces)
acx-mac80211/common.c:4714:44: expected char const *<noident>
acx-mac80211/common.c:4714:44: got char const [noderef] <asn:1>*buf

Fix them, imitating ath9k/debug.c

Signed-off-by: Jim Cromie <***@gmail.com>
---
common.c | 71 +++++++++++++++++++++++++++++++++++++++++++++-------------------
1 file changed, 50 insertions(+), 21 deletions(-)

diff --git a/common.c b/common.c
index 6f79a42..a4746cc 100644
--- a/common.c
+++ b/common.c
@@ -4523,20 +4523,25 @@ static int acx_proc_show_diag(struct seq_file *file, void *v)
/*
* A write on acx_diag executes different operations for debugging
*/
-static ssize_t acx_proc_write_diag(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t acx_proc_write_diag(struct file *file,
+ const char __user *ubuf,
+ size_t count, loff_t *ppos)
{
struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
acx_device_t *adev = (acx_device_t *) pde->data;

ssize_t ret = -EINVAL;
- char *after;
+ char *after, buf[32];
unsigned int val;
- size_t size;
+ size_t size, len;

FN_ENTER;
acx_sem_lock(adev);

+ len = min(count, sizeof(buf) - 1);
+ if (unlikely(copy_from_user(buf, ubuf, len)))
+ return -EFAULT;
+
val = (unsigned int) simple_strtoul(buf, &after, 0);
size = after - buf + 1;

@@ -4698,13 +4703,21 @@ static int acx_proc_show_debug(struct seq_file *file, void *v)
return 0;
}

-static ssize_t acx_proc_write_debug(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t acx_proc_write_debug(struct file *file,
+ const char __user *ubuf,
+ size_t count, loff_t *ppos)
{
ssize_t ret = -EINVAL;
- char *after;
- unsigned long val = simple_strtoul(buf, &after, 0);
- size_t size = after - buf + 1;
+ char *after, buf[32];
+ unsigned long val;
+ size_t size, len;
+
+ len = min(count, sizeof(buf) - 1);
+ if (unlikely(copy_from_user(buf, ubuf, len)))
+ return -EFAULT;
+
+ val = simple_strtoul(buf, &after, 0);
+ size = after - buf + 1;

FN_ENTER;
/* No sem locking required, since debug is global for all devices */
@@ -4736,7 +4749,7 @@ static int acx_proc_show_sensitivity(struct seq_file *file, void *v)
}

static ssize_t acx_proc_write_sensitivity(struct file *file,
- const char __user *buf,
+ const char __user *ubuf,
size_t count, loff_t *ppos)

{
@@ -4744,13 +4757,17 @@ static ssize_t acx_proc_write_sensitivity(struct file *file,
PDE(file->f_path.dentry->d_inode)->data;

ssize_t ret = -EINVAL;
- char *after;
+ char *after, buf[32];
unsigned long val;
- size_t size;
+ size_t size, len;

FN_ENTER;
acx_sem_lock(adev);

+ len = min(count, sizeof(buf) - 1);
+ if (unlikely(copy_from_user(buf, ubuf, len)))
+ return -EFAULT;
+
val = simple_strtoul(buf, &after, 0);
size = after - buf + 1;

@@ -4784,20 +4801,24 @@ static int acx_proc_show_tx_level(struct seq_file *file, void *v)
}

static ssize_t acx111_proc_write_tx_level(struct file *file,
- const char __user *buf,
+ const char __user *ubuf,
size_t count, loff_t *ppos)
{
acx_device_t *adev = (acx_device_t *)
PDE(file->f_path.dentry->d_inode)->data;

ssize_t ret = -EINVAL;
- char *after;
+ char *after, buf[32];
unsigned long val;
- size_t size;
+ size_t size, len;

FN_ENTER;
acx_sem_lock(adev);

+ len = min(count, sizeof(buf) - 1);
+ if (unlikely(copy_from_user(buf, ubuf, len)))
+ return -EFAULT;
+
val = simple_strtoul(buf, &after, 0);
size = after - buf + 1;

@@ -4831,20 +4852,24 @@ static int acx_proc_show_reg_domain(struct seq_file *file, void *v)
}

static ssize_t acx_proc_write_reg_domain(struct file *file,
- const char __user *buf,
+ const char __user *ubuf,
size_t count, loff_t *ppos)
{
acx_device_t *adev = (acx_device_t *)
PDE(file->f_path.dentry->d_inode)->data;

ssize_t ret = -EINVAL;
- char *after;
+ char *after, buf[32];
unsigned long val;
- size_t size;
+ size_t size, len;

FN_ENTER;
acx_sem_lock(adev);

+ len = min(count, sizeof(buf) - 1);
+ if (unlikely(copy_from_user(buf, ubuf, len)))
+ return -EFAULT;
+
val = simple_strtoul(buf, &after, 0);
size = after - buf + 1;

@@ -4879,21 +4904,25 @@ static int acx_proc_show_antenna(struct seq_file *file, void *v)
}

static ssize_t acx_proc_write_antenna(struct file *file,
- const char __user *buf,
+ const char __user *ubuf,
size_t count, loff_t *ppos)
{
acx_device_t *adev = (acx_device_t *)
PDE(file->f_path.dentry->d_inode)->data;

ssize_t ret = -EINVAL;
- char *after;
+ char *after, buf[32];
unsigned long val;
u8 val0, val1;
- size_t size;
+ size_t size, len;

FN_ENTER;
acx_sem_lock(adev);

+ len = min(count, sizeof(buf) - 1);
+ if (unlikely(copy_from_user(buf, ubuf, len)))
+ return -EFAULT;
+
val = simple_strtoul(buf, &after, 0);
size = after - buf + 1;
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:05 UTC
Permalink
Signed-off-by: Jim Cromie <***@gmail.com>
---
mem.c | 53 +++++++++++++++++++++++++++++++----------------------
mem.h | 4 ++--
2 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/mem.c b/mem.c
index b8a91a5..68706cb 100644
--- a/mem.c
+++ b/mem.c
@@ -659,11 +659,11 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd,
bad:
/* Give enough info so that callers can avoid printing their
* own diagnostic messages */
- logf1(L_ANY, "%s: cmd=%s, buflen=%u, timeout=%ums, type=0x%04X, status=%s: FAILED\n",
- devname,
- cmdstr, buflen, cmd_timeout,
- buffer ? le16_to_cpu(((acx_ie_generic_t *) buffer)->type) : -1,
- acx_cmd_status_str(cmd_status)
+ logf1(L_ANY,
+ "%s: cmd=%s, buflen=%u, timeout=%ums, type=0x%04X, status=%s: FAILED\n",
+ devname, cmdstr, buflen, cmd_timeout,
+ buffer ? le16_to_cpu(((acx_ie_generic_t *) buffer)->type) : -1,
+ acx_cmd_status_str(cmd_status)
);

acxmem_unlock();
@@ -1070,24 +1070,28 @@ static void acxmem_process_rxdesc(acx_device_t *adev)
* rx descriptor on the ACX, which should be
* 0x11000000 if we should process it.
*/
- Ctl_8 = hostdesc->hd.Ctl_16 = read_slavemem8(adev, (uintptr_t) &(rxdesc->Ctl_8));
+ Ctl_8 = hostdesc->hd.Ctl_16
+ = read_slavemem8(adev, (uintptr_t) &(rxdesc->Ctl_8));
+
if ((Ctl_8 & DESC_CTL_HOSTOWN) && (Ctl_8 & DESC_CTL_ACXDONE))
break; /* found it! */

- if (unlikely(!--count)) /* hmm, no luck: all descs empty, bail out */
+ if (unlikely(!--count))
+ /* hmm, no luck: all descs empty, bail out */
goto end;
}

- /* now process descriptors, starting with the first we figured out */
+ /* now process descriptors, starting with the first we figured
+ * out */
while (1) {
- log(L_BUFR, "%s: rx: tail=%u Ctl_8=%02X\n", __func__, tail, Ctl_8);
+ log(L_BUFR, "%s: rx: tail=%u Ctl_8=%02X\n",
+ __func__, tail, Ctl_8);
/*
* If the ACX has CTL_RECLAIM set on this descriptor
* there is no buffer associated; it just wants us to
* tell it to reclaim the memory.
*/
if (!(Ctl_8 & DESC_CTL_RECLAIM)) {
-
/*
* slave interface - pull data now
*/
@@ -1101,7 +1105,8 @@ static void acxmem_process_rxdesc(acx_device_t *adev)
* information takes up an additional 12
* bytes, so add that to the length we copy.
*/
- addr = read_slavemem32(adev, (uintptr_t) &(rxdesc->ACXMemPtr));
+ addr = read_slavemem32(adev,
+ (uintptr_t) &(rxdesc->ACXMemPtr));
if (addr) {
/*
* How can &(rxdesc->ACXMemPtr) above
@@ -1115,14 +1120,15 @@ static void acxmem_process_rxdesc(acx_device_t *adev)
acxmem_dump_mem(adev, 0, 0x10000);
panic("Bad access!");
}
- acxmem_chaincopy_from_slavemem(adev, (u8 *) hostdesc->data, addr,
- hostdesc->hd.length + (uintptr_t) &((rxbuffer_t *) 0)->hdr_a3);
+ acxmem_chaincopy_from_slavemem(adev, (u8 *)
+ hostdesc->data, addr,
+ hostdesc->hd.length
+ + (uintptr_t) &((rxbuffer_t *) 0)->hdr_a3);

acx_process_rxbuf(adev, hostdesc->data);
}
- } else {
+ } else
log(L_ANY, "%s: rx reclaim only!\n", __func__);
- }

hostdesc->Status = 0;

@@ -1158,7 +1164,8 @@ static void acxmem_process_rxdesc(acx_device_t *adev)
}
#endif

-static int acxmem_get_txbuf_space_needed(acx_device_t *adev, unsigned int len)
+static int acxmem_get_txbuf_space_needed(acx_device_t *adev,
+ unsigned int len)
{
int blocks_needed;

@@ -1988,7 +1995,8 @@ int acx100mem_ioctl_set_phy_amp_bias(struct ieee80211_hw *hw,
* - Initialize the dev and wlan data
* - Initialize the MAC
*
- * pdev - ptr to pci device structure containing info about pci configuration
+ * pdev - ptr to pci device structure containing info about pci
+ * configuration
* id - ptr to the device id entry that matched this device
*/
static int __devinit acxmem_probe(struct platform_device *pdev)
@@ -2261,7 +2269,8 @@ done:
* Shut device down (if not hot unplugged)
* and deallocate PCI resources for the acx chip.
*
- * pdev - ptr to PCI device structure containing info about pci configuration
+ * pdev - ptr to PCI device structure containing info about pci
+ * configuration
*/
static int __devexit acxmem_remove(struct platform_device *pdev)
{
@@ -2360,12 +2369,12 @@ static int __devexit acxmem_remove(struct platform_device *pdev)
* TODO: PM code needs to be fixed / debugged / tested.
*/
#ifdef CONFIG_PM
-STATick int
-acxmem_e_suspend(struct platform_device *pdev, pm_message_t state)
+static int acxmem_e_suspend(struct platform_device *pdev,
+ pm_message_t state)
{
- struct ieee80211_hw *hw = (struct ieee80211_hw *)
- platform_get_drvdata(pdev);
acx_device_t *adev;
+ struct ieee80211_hw *hw
+ = (struct ieee80211_hw *) platform_get_drvdata(pdev);

FN_ENTER;
pr_acx("suspend handler is experimental!\n");
diff --git a/mem.h b/mem.h
index f61d7ff..b7872bc 100644
--- a/mem.h
+++ b/mem.h
@@ -45,8 +45,8 @@ void acxmem_init_acx_txbuf2(acx_device_t *adev);
int __init acxmem_init_module(void);
void __exit acxmem_cleanup_module(void);

-void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status);
-void acxmem_init_mboxes(acx_device_t *adev);
+void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type,
+ u16 status);


#else /* !CONFIG_ACX_MAC80211_MEM */
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:09 UTC
Permalink
Signed-off-by: Jim Cromie <***@gmail.com>
---
inlines.h | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/inlines.h b/inlines.h
index b62f1c3..868f20e 100644
--- a/inlines.h
+++ b/inlines.h
@@ -152,8 +152,7 @@ INLINE_IO u32 read_reg32(acx_device_t *adev, unsigned int offset)
return acx_readl(adev->iobase + adev->io[offset]);
#else
return acx_readw(adev->iobase + adev->io[offset])
- + (acx_readw(adev->iobase +
- adev->io[offset] + 2) << 16);
+ + (acx_readw(adev->iobase + adev->io[offset] + 2) << 16);
#endif
}
/* else IS_MEM */
@@ -208,20 +207,19 @@ INLINE_IO u8 read_reg8(acx_device_t *adev, unsigned int offset)
return (u8) lo;
}

-INLINE_IO void write_reg32(acx_device_t *adev, unsigned int offset,
- u32 val)
+INLINE_IO void write_reg32(acx_device_t *adev, unsigned int offset, u32 val)
{
u32 addr;

if (IS_PCI(adev)) {
#if ACX_IO_WIDTH == 32
acx_writel(val, adev->iobase + adev->io[offset]);
-#else
- acx_writew(val & 0xffff, (u8 *) adev->iobase
- + adev->io[offset]);
- acx_writew(val >> 16, (u8 *) adev->iobase
- + adev->io[offset] + 2);
-#endif
+ #else
+ acx_writew(val & 0xffff,
+ (u8 *) adev->iobase + adev->io[offset]);
+ acx_writew(val >> 16,
+ (u8 *) adev->iobase + adev->io[offset] + 2);
+ #endif
}
/* else IS_MEM */

@@ -233,8 +231,7 @@ INLINE_IO void write_reg32(acx_device_t *adev, unsigned int offset,
acx_writel(val, adev->iobase + ACX_SLV_REG_DATA);
}

-INLINE_IO void write_reg16(acx_device_t *adev, unsigned int offset,
- u16 val)
+INLINE_IO void write_reg16(acx_device_t *adev, unsigned int offset, u16 val)
{
u32 addr;

@@ -308,8 +305,7 @@ INLINE_IO void set_regbits(acx_device_t *adev, unsigned int offset,
write_flush(adev);
}

-INLINE_IO void clear_regbits(acx_device_t *adev, unsigned int offset,
- u32 bits)
+INLINE_IO void clear_regbits(acx_device_t *adev, unsigned int offset, u32 bits)
{
u32 tmp;
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:06 UTC
Permalink
sparse reported funcs w/o scope, restore static to them, and adjust
headers, wrap debugfs funcs in #ifdef CONFIG_DEBUG_FS and add stubs
when its not configd. Remove #if1 wrap on acx_init_mbox.

Also drop casts sparse complains about (Larry may have also done these)

Signed-off-by: Jim Cromie <***@gmail.com>
---
merge.c | 78 ++++++-----------------------------------------------------------
merge.h | 17 +++++++++++++-
2 files changed, 23 insertions(+), 72 deletions(-)

diff --git a/merge.c b/merge.c
index fb02c28..152aac3 100644
--- a/merge.c
+++ b/merge.c
@@ -459,7 +459,7 @@ static void acx_create_rx_desc_queue(acx_device_t * adev, u32 rx_queue_start)

if (IS_PCI(adev))
adev->rx.desc_start = (rxdesc_t *)
- ((u8 *) adev->iobase2 + rx_queue_start);
+ (adev->iobase2 + rx_queue_start);
else
adev->rx.desc_start = (rxdesc_t *)
((u8 *) (uintptr_t)rx_queue_start);
@@ -1533,9 +1533,7 @@ void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status)
FN_EXIT0;
}

-#if 1 //
-/* static inline */
-void acx_init_mboxes(acx_device_t *adev)
+static void acx_init_mboxes(acx_device_t *adev)
{
uintptr_t cmd_offs, info_offs;

@@ -1549,18 +1547,16 @@ void acx_init_mboxes(acx_device_t *adev)
if (adev->iobase2)
pr_notice("adev->iobase2 != 0 for MEM dev\n");
} else {
- adev->cmd_area = (u8 *) adev->iobase2 + cmd_offs;
- adev->info_area = (u8 *) adev->iobase2 + info_offs;
+ adev->cmd_area = adev->iobase2 + cmd_offs;
+ adev->info_area = adev->iobase2 + info_offs;
}
/* OW iobase2 not used in mem.c, in pci.c it is */
- log(L_DEBUG,
- "iobase2=%p cmd_mbox_offset=%lX cmd_area=%pinfo_mbox_offset=%lX info_area=%p\n",
- adev->iobase2, cmd_offs, adev->cmd_area,
- info_offs, adev->info_area);
+ log(L_DEBUG, "iobase2=%p cmd_mbox_offset=%lX cmd_area=%pinfo_mbox_offset=%lX info_area=%p\n",
+ adev->iobase2, cmd_offs, adev->cmd_area,
+ info_offs, adev->info_area);

FN_EXIT0;
}
-#endif

/*
* acxmem_s_issue_cmd_timeo
@@ -2153,66 +2149,6 @@ static void acxmem_init_acx_txbuf(acx_device_t *adev) {
/*
* Most of the acx specific pieces of hardware reset.
*/
-#if 0 // none in pci.c, doesnt belong here
-static int acxmem_complete_hw_reset(acx_device_t *adev)
-{
- acx111_ie_configoption_t co;
- acxmem_lock_flags;
-
- /* NB: read_reg() reads may return bogus data before
- * reset_dev(), since the firmware which directly controls
- * large parts of the I/O registers isn't initialized yet.
- * acx100 seems to be more affected than acx111 */
- if (OK != acx_reset_dev(adev))
- return -1;
-
- acxmem_lock();
- if (IS_ACX100(adev)) {
- /* ACX100: configopt struct in cmd mailbox - directly
- * after reset */
- acxmem_copy_from_slavemem(adev, (u8*) &co,
- (u32) adev->cmd_area, sizeof(co));
- }
- acxmem_unlock();
-
- if (OK != acx_init_mac(adev))
- return -3;
-
- if (IS_ACX111(adev)) {
- /* ACX111: configopt struct needs to be queried after
- * full init */
- acx_interrogate(adev, &co, ACX111_IE_CONFIG_OPTIONS);
- }
-
- /* Set up transmit buffer administration */
- acxmem_init_acx_txbuf(adev);
-
- acxmem_lock();
-
- /* Windows driver writes 0x01000000 to register 0x288,
- * RADIO_CTL, if the form factor is 3. It also write protects
- * the EEPROM by writing 1<<9 to GPIO_OUT
- */
- if (adev->form_factor == 3) {
- set_regbits(adev, 0x288, 0x01000000);
- set_regbits(adev, 0x298, 1 << 9);
- }
-
- /* TODO: merge them into one function, they are called just
- * once and are the same for pci & usb */
- if (OK != acx_read_eeprom_byte(adev, 0x05, &adev->eeprom_version))
- return -2;
-
- acxmem_unlock();
-
- acx_parse_configoption(adev, &co);
- acx_get_firmware_version(adev);
- /* needs to be after acx_s_init_mac() */
- acx_display_hardware_details(adev);
-
- return 0;
-}
-#endif // acxmem_complete_hw_reset()

#if 0
/***********************************************************************
diff --git a/merge.h b/merge.h
index 23eaa64..28723fa 100644
--- a/merge.h
+++ b/merge.h
@@ -11,6 +11,21 @@ typedef ssize_t ((acx_proc_write_t)(struct file *, const char __user *,
extern acx_proc_show_t *const acx_proc_show_funcs[];
extern acx_proc_write_t *const acx_proc_write_funcs[];

+/* debugfs.c API used by common.c */
+#if defined CONFIG_DEBUG_FS
+int acx_debugfs_add_adev(struct acx_device *adev);
+void acx_debugfs_remove_adev(struct acx_device *adev);
+int acx_proc_register_entries(struct ieee80211_hw *hw);
+int __init acx_debugfs_init(void);
+void __exit acx_debugfs_exit(void);
+#else
+static int acx_debugfs_add_adev(struct acx_device *adev) { return 0; }
+static void acx_debugfs_remove_adev(struct acx_device *adev) { }
+static int acx_proc_register_entries(struct ieee80211_hw *hw) { return 0; }
+static int __init acx_debugfs_init(void) { return 0; }
+static void __exit acx_debugfs_exit(void) { }
+#endif /* defined CONFIG_DEBUG_FS */
+
#include <linux/interrupt.h>

irqreturn_t acx_interrupt(int irq, void *dev_id);
@@ -62,7 +77,7 @@ void acx_irq_work(struct work_struct *work);

u32 acx_read_cmd_type_status(acx_device_t *adev);
void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status);
-void acx_init_mboxes(acx_device_t *adev);
+
int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image,
u32 offset);
int acx_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image,
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:11 UTC
Permalink
Add ifdef wrapper on body of merge.c; it has MANY refs to acx_device
fields which are not defined in USB-only builds, this is easiest way,
and apparently correct.

There are a number of stubs now needed, and a few functions are
actually called; will fix next.

Signed-off-by: Jim Cromie <***@gmail.com>
---
merge.c | 3 +++
merge.h | 10 +++++++---
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/merge.c b/merge.c
index dd6f95d..ed4b3cd 100644
--- a/merge.c
+++ b/merge.c
@@ -1,4 +1,6 @@

+#if defined CONFIG_ACX_MAC80211_PCI || defined CONFIG_ACX_MAC80211_MEM
+
#define pr_fmt(fmt) "acx.%s: " fmt, __func__
#include "acx_debug.h"

@@ -5027,3 +5029,4 @@ MODULE_DESCRIPTION( "ACX Slave Memory Driver" );
MODULE_LICENSE( "GPL" );

#endif // til-end
+#endif /* defined CONFIG_ACX_MAC80211_PCI || defined CONFIG_ACX_MAC80211_MEM */
diff --git a/merge.h b/merge.h
index 28723fa..8e529b0 100644
--- a/merge.h
+++ b/merge.h
@@ -26,6 +26,8 @@ static int __init acx_debugfs_init(void) { return 0; }
static void __exit acx_debugfs_exit(void) { }
#endif /* defined CONFIG_DEBUG_FS */

+#if defined CONFIG_ACX_MAC80211_PCI || defined CONFIG_ACX_MAC80211_MEM
+
#include <linux/interrupt.h>

irqreturn_t acx_interrupt(int irq, void *dev_id);
@@ -91,8 +93,7 @@ int acxpci_upload_radio(acx_device_t *adev);
void acx_power_led(acx_device_t * adev, int enable);


-#if defined(CONFIG_ACX_MAC80211_PCI) \
- || defined(CONFIG_ACX_MAC80211_MEM)
+// #if !(defined CONFIG_ACX_MAC80211_PCI || defined CONFIG_ACX_MAC80211_MEM)


void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue);
@@ -112,6 +113,10 @@ static inline txdesc_t* acx_advance_txdesc(acx_device_t *adev,

#else /* !(CONFIG_ACX_MAC80211_PCI || CONFIG_ACX_MAC80211_MEM) */

+static inline void acx_create_desc_queues(acx_device_t *adev,
+ u32 tx_queue_start, u32 rx_queue_start)
+{ }
+
static inline void acxmem_update_queue_indicator(acx_device_t *adev,
int txqueue)
{ }
@@ -124,5 +129,4 @@ static inline txdesc_t* acx_advance_txdesc(acx_device_t *adev,
#define ACX_FREE_QUEUES(adev, _dir_)

#endif /* !(CONFIG_ACX_MAC80211_PCI || CONFIG_ACX_MAC80211_MEM) */
-
#endif /* _MERGE_H_ */
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:10 UTC
Permalink
Merge of acx(mem|pci)_proc_diag_output is rather ugly,
lets defer it for now. Remove #if0d code separately.

Signed-off-by: Jim Cromie <***@gmail.com>
---
mem.c | 2 +-
merge.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mem.c b/mem.c
index 68706cb..76e69d4 100644
--- a/mem.c
+++ b/mem.c
@@ -835,7 +835,7 @@ STATick void acxmem_i_set_multicast_list(struct net_device *ndev)
* BOM Proc, Debug
* ==================================================
*/
-#if 0 // copied to merge, but needs work
+#if 1 // copied to merge, but needs work
int acxmem_proc_diag_output(struct seq_file *file,
acx_device_t *adev)
{
diff --git a/merge.c b/merge.c
index 152aac3..dd6f95d 100644
--- a/merge.c
+++ b/merge.c
@@ -2200,7 +2200,7 @@ static void acxmem_i_set_multicast_list(struct net_device *ndev)
* BOM Proc, Debug
* ==================================================
*/
-#if 1 // real close
+#if 0 // real close
int acxmem_proc_diag_output(struct seq_file *file,
acx_device_t *adev)
{
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:12 UTC
Permalink
Signed-off-by: Jim Cromie <***@gmail.com>
---
merge.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/merge.c b/merge.c
index ed4b3cd..d40842d 100644
--- a/merge.c
+++ b/merge.c
@@ -3946,10 +3946,11 @@ static irqreturn_t acxmem_interrupt(int irq, void *dev_id)

if (unlikely(++adev->irq_loops_this_jiffy> MAX_IRQLOOPS_PER_JIFFY)) {
pr_err("acx: too many interrupts per jiffy!\n");
- /* Looks like card floods us with IRQs! Try to stop that */
+ /* Looks like card floods us with IRQs! Try to
+ * stop that */
write_reg16(adev, IO_ACX_IRQ_MASK, 0xffff);
- /* This will short-circuit all future attempts to handle IRQ.
- * We cant do much more... */
+ /* This will short-circuit all future attempts
+ * to handle IRQ. We cant do much more... */
adev->irq_mask = 0;
break;
}
@@ -3957,14 +3958,12 @@ static irqreturn_t acxmem_interrupt(int irq, void *dev_id)
#endif

/* OW 20091129 TODO Currently breaks mem.c ...
- * If sleeping is required like for update card settings, this is usefull
- * For now I replaced sleeping for command handling by mdelays.
- * if (adev->after_interrupt_jobs){
- * acx_e_after_interrupt_task(adev);
- * }
+ * If sleeping is required like for update card settings, this
+ * is usefull For now I replaced sleeping for command handling
+ * by mdelays. if (adev->after_interrupt_jobs){
+ * acx_e_after_interrupt_task(adev); }
*/

-
/* OW TODO */
#if 0
/* Routine to perform blink with range */
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:13 UTC
Permalink
With this patch, USB-only compiles cleanly. In effect, it adds stub
functions (static inlines) for every function that compiler complained
about.

It does so via a new macro: decl_or_stub(proto, stubret), which may be
too-clever-by-half (or not clever enough). The macro expands either
as a prototype, or with a "static inline" prefix and an "empty" body.

The main shortcoming with the new macro is that it must be redefined
for each conditional combination desired (only 1 is needed here),
because macros cannot contain #if constructs. There may be a high-fu
way to do this better, please suggest it if you know how. Despite its
weakness, it works, and eliminates a large repetetive block of
fn-protos, so keep it.

Signed-off-by: Jim Cromie <***@gmail.com>
---
merge.h | 171 +++++++++++++++++++++++++++++++++++++++++++++-------------------
1 file changed, 121 insertions(+), 50 deletions(-)

diff --git a/merge.h b/merge.h
index 8e529b0..34a39af 100644
--- a/merge.h
+++ b/merge.h
@@ -27,74 +27,148 @@ static void __exit acx_debugfs_exit(void) { }
#endif /* defined CONFIG_DEBUG_FS */

#if defined CONFIG_ACX_MAC80211_PCI || defined CONFIG_ACX_MAC80211_MEM
+#define decl_or_stub(proto, stubret) proto;
+#else
+#define decl_or_stub(proto, stubret) static inline proto stubret
+#endif

-#include <linux/interrupt.h>
+decl_or_stub(
+ void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start,
+ u32 rx_queue_start),
+ { } )

-irqreturn_t acx_interrupt(int irq, void *dev_id);
+decl_or_stub(
+ int acx_create_hostdesc_queues(acx_device_t *adev),
+ { return 0; } )

-void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start,
- u32 rx_queue_start);
+decl_or_stub(
+ void acx_free_desc_queues(acx_device_t *adev),
+ { } )

-int acx_create_hostdesc_queues(acx_device_t *adev);
-void acx_free_desc_queues(acx_device_t *adev);
+decl_or_stub(
+ int _acx_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf),
+ { return 0; } )

-void acx_log_rxbuffer(const acx_device_t *adev);
-void acx_log_txbuffer(acx_device_t *adev);
+decl_or_stub(
+ int _acx_write_phy_reg(acx_device_t *adev, u32 reg, u8 value),
+ { return 0; } )

-void acx_op_stop(struct ieee80211_hw *hw);
-int acx_op_start(struct ieee80211_hw *hw);
+decl_or_stub(
+ void acx_irq_enable(acx_device_t *adev),
+ { } )

-void acx_handle_info_irq(acx_device_t *adev);
+decl_or_stub(
+ void acx_irq_disable(acx_device_t *adev),
+ { } )

+decl_or_stub(
+ int acx_read_eeprom_byte(acx_device_t *adev, u32 addr, u8 *charbuf),
+ { return 0; } )

-int _acx_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf);
-int _acx_write_phy_reg(acx_device_t *adev, u32 reg, u8 value);
+decl_or_stub(
+ char *acx_proc_eeprom_output(int *length, acx_device_t *adev),
+ { return (char*) NULL; } )

-void acx_irq_enable(acx_device_t *adev);
-void acx_irq_disable(acx_device_t *adev);
+decl_or_stub(
+ void acx_up(struct ieee80211_hw *hw),
+ { } )

-int acx_read_eeprom_byte(acx_device_t *adev, u32 addr, u8 *charbuf);
-char *acx_proc_eeprom_output(int *length, acx_device_t *adev);
+decl_or_stub(
+ void acx_set_interrupt_mask(acx_device_t *adev),
+ { } )

-void acx_up(struct ieee80211_hw *hw);
+decl_or_stub(
+ void acx_show_card_eeprom_id(acx_device_t *adev),
+ { } )

-void acx_set_interrupt_mask(acx_device_t *adev);
+decl_or_stub(
+ unsigned int acx_tx_clean_txdesc(acx_device_t *adev),
+ { return 0; } )

-void acx_show_card_eeprom_id(acx_device_t *adev);
+decl_or_stub(
+ int acx_reset_dev(acx_device_t *adev),
+ { return 0; } )

-unsigned int acx_tx_clean_txdesc(acx_device_t *adev);
+/* wrappers on acx_upload_radio(adev, filename */
+decl_or_stub(
+ int acxmem_upload_radio(acx_device_t *adev),
+ { return 0; } )

-void _acx_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len,
- struct ieee80211_tx_info *info, struct sk_buff *skb);
+decl_or_stub(
+ int acxpci_upload_radio(acx_device_t *adev),
+ { return 0; } )

-void *_acx_get_txbuf(acx_device_t * adev, tx_t * tx_opaque);
-void acx_process_rxdesc(acx_device_t *adev);
+decl_or_stub(
+ void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue),
+ { } )

-void acx_delete_dma_regions(acx_device_t *adev);
-int acx_reset_dev(acx_device_t *adev);
-int acx_verify_init(acx_device_t *adev);
+decl_or_stub(
+ void _acx_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len,
+ struct ieee80211_tx_info *info, struct sk_buff *skb),
+ { } )

-void acx_clean_txdesc_emergency(acx_device_t *adev);
-void acx_irq_work(struct work_struct *work);
+decl_or_stub(
+ void acx_irq_work(struct work_struct *work),
+ { } )

-u32 acx_read_cmd_type_status(acx_device_t *adev);
-void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status);
+decl_or_stub(
+ int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image,
+ u32 offset),
+ { return 0; } )

-int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image,
- u32 offset);
-int acx_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image,
- u32 offset);
-int acxmem_upload_fw(acx_device_t *adev);
+decl_or_stub(
+ int acx_validate_fw(acx_device_t *adev,
+ const firmware_image_t *fw_image, u32 offset),
+ { return 0; } )

-/* wrappers on acx_upload_radio(adev, filename */
-int acxmem_upload_radio(acx_device_t *adev);
-int acxpci_upload_radio(acx_device_t *adev);
+decl_or_stub(
+ u32 acx_read_cmd_type_status(acx_device_t *adev),
+ { return 0; } )
+
+decl_or_stub(
+ void acx_write_cmd_type_status(acx_device_t *adev, u16 type,
+ u16 status),
+ { } )
+
+decl_or_stub(
+ int acx_op_start(struct ieee80211_hw *hw),
+ { return 0; } )
+
+decl_or_stub(
+ void acx_op_stop(struct ieee80211_hw *hw),
+ { } )
+
+decl_or_stub(
+ irqreturn_t acx_interrupt(int irq, void *dev_id),
+ { return (irqreturn_t) NULL; } )
+
+decl_or_stub(
+ void acx_delete_dma_regions(acx_device_t *adev),
+ { } )
+
+decl_or_stub(
+ void acx_power_led(acx_device_t * adev, int enable),
+ { } )

-void acx_power_led(acx_device_t * adev, int enable);
+decl_or_stub(
+ void acx_clean_txdesc_emergency(acx_device_t *adev),
+ { } )

+decl_or_stub(
+ void acx_log_rxbuffer(const acx_device_t *adev),
+ { } )

-// #if !(defined CONFIG_ACX_MAC80211_PCI || defined CONFIG_ACX_MAC80211_MEM)
+decl_or_stub(
+ void acx_log_txbuffer(acx_device_t *adev),
+ { } )

+decl_or_stub(
+ void *_acx_get_txbuf(acx_device_t * adev, tx_t * tx_opaque),
+ { return (void*) NULL; } )
+
+//void acx_process_rxdesc(acx_device_t *adev);
+
+#if (defined CONFIG_ACX_MAC80211_PCI || defined CONFIG_ACX_MAC80211_MEM)

void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue);

@@ -113,20 +187,17 @@ static inline txdesc_t* acx_advance_txdesc(acx_device_t *adev,

#else /* !(CONFIG_ACX_MAC80211_PCI || CONFIG_ACX_MAC80211_MEM) */

-static inline void acx_create_desc_queues(acx_device_t *adev,
- u32 tx_queue_start, u32 rx_queue_start)
-{ }
-
-static inline void acxmem_update_queue_indicator(acx_device_t *adev,
- int txqueue)
-{ }
+static inline txdesc_t* acx_get_txdesc(acx_device_t *adev, int index)
+{ return (txdesc_t*) NULL; }

static inline txdesc_t* acx_advance_txdesc(acx_device_t *adev,
- txdesc_t* txdesc, int inc)
+ txdesc_t* txdesc, int inc)
{ return (txdesc_t*) NULL; }

/* empty stub here, real one in merge.c */
#define ACX_FREE_QUEUES(adev, _dir_)

+
#endif /* !(CONFIG_ACX_MAC80211_PCI || CONFIG_ACX_MAC80211_MEM) */
+
#endif /* _MERGE_H_ */
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:15 UTC
Permalink
This is helpful for finding ranges of #ifdefed code.

Signed-off-by: Jim Cromie <***@gmail.com>
---
merge.c | 215 ++++++++++++++++++++++++++++++++++------------------------------
1 file changed, 115 insertions(+), 100 deletions(-)

diff --git a/merge.c b/merge.c
index 81240c6..aefe8b5 100644
--- a/merge.c
+++ b/merge.c
@@ -335,7 +335,7 @@ static int acx_create_tx_host_desc_queue(acx_device_t *adev)
txbuf = (u8*) adev->tx.buf.txstart;
txbuf_phy = adev->tx.buf.phy;

-#if 0
+#if 0 /* tx-buffer */
/* Each tx buffer is accessed by hardware via txdesc -> txhostdesc(s)
* -> txbuffer(s). We use only one txhostdesc per txdesc, but it
* looks like acx111 is buggy: it accesses second txhostdesc (via
@@ -379,7 +379,7 @@ static int acx_create_tx_host_desc_queue(acx_device_t *adev)
}
hostdesc++;
}
-#endif
+#endif /* tx-buffer */
/* We initialize two hostdescs so that they point to adjacent
* memory areas. Thus txbuf is really just a contiguous memory
* area */
@@ -720,7 +720,7 @@ void acx_free_desc_queues(acx_device_t *adev)
adev->_dir_.host.start, adev->_dir_.host.phy); \
ACX_FREE_QUEUE(adev, adev->_dir_.buf.size, \
adev->_dir_.buf.start, adev->_dir_.buf.phy);
-#endif
+#endif // ACX_FREE_QUEUES

FN_ENTER;

@@ -972,11 +972,11 @@ end:
FN_EXIT1(result);
return result;
}
-#endif /* acx_write_eeprom() */
+#endif /* acx_write_eeprom() */

static inline void acx_read_eeprom_area(acx_device_t *adev)
{
-#if ACX_DEBUG > 1
+#if ACX_DEBUG > 1 /* in acx_read_eeprom_area() */
int offs;
u8 tmp;

@@ -985,11 +985,12 @@ static inline void acx_read_eeprom_area(acx_device_t *adev)
if (IS_MEM(adev) || IS_PCI(adev))
for (offs = 0x8c; offs < 0xb9; offs++)
acx_read_eeprom_byte(adev, offs, &tmp);
- else BUG();
+ else
+ BUG();

FN_EXIT0;

-#endif
+#endif /* ACX_DEBUG > 1 : in acx_read_eeprom_area() */
}

/*
@@ -1099,7 +1100,7 @@ fail:
* 0 success
*/
/* static */
-#if 1 // needs work, but it compiles
+#if 1 // acx_write_fw()
int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image,
u32 offset)
{
@@ -1126,16 +1127,17 @@ int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image,
write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */
write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */
write_flush(adev);
-#endif
-#endif
- } else {
+#endif /* FW_NO_AUTO_INCREMENT */
+#endif /* NOPE mem.c only, all else same */
+ }
+ else {
#if FW_NO_AUTO_INCREMENT
write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0); /* use basic mode */
#else
write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */
write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */
write_flush(adev);
-#endif
+#endif /* FW_NO_AUTO_INCREMENT */
}
len = 0;
size = le32_to_cpu(fw_image->size) & (~3);
@@ -1151,18 +1153,18 @@ int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image,
write_reg32(adev, IO_ACX_SLV_MEM_ADDR,
offset + len - 4);
write_flush(adev);
-#endif
+#endif /* FW_NO_AUTO_INCREMENT */
write_reg32(adev, IO_ACX_SLV_MEM_DATA, v32);
write_flush(adev);
} else {
-#ifdef NOPE // mem.c
+#ifdef NOPE
#if FW_NO_AUTO_INCREMENT
write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset + len - 4);
write_flush(adev);
-#endif
+#endif /* FW_NO_AUTO_INCREMENT */
write_reg32(adev, IO_ACX_SLV_MEM_DATA, v32);
write_flush(adev);
-#endif
+#endif /* NOPE */
/* mem.c only, til .. */
write_slavemem32(adev, offset + len - 4, v32);

@@ -1189,7 +1191,7 @@ int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image,
FN_EXIT1(sum != le32_to_cpu(fw_image->chksum));
return (sum != le32_to_cpu(fw_image->chksum));
}
-#endif
+#endif // acx_write_fw()

/*
* acx_validate_fw
@@ -1283,7 +1285,7 @@ int acx_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image,
return result;
}

-#if 1 /* used for mem.c only */
+#if 1 /* used for mem.c only */

#ifdef PATCH_AROUND_BAD_SPOTS
/*
@@ -1298,7 +1300,7 @@ static const u32 patch[] = {
0x602e6018, 0x23036468, 0x480203db, 0x60ca6003, 0xbdf0750a,
0xffff0808
};
-#endif // PATCH_AROUND_BAD_SPOTS
+#endif // PATCH_AROUND_BAD_SPOTS

static int _acx_upload_fw(acx_device_t *adev, char *filename)
{
@@ -1312,7 +1314,7 @@ static int _acx_upload_fw(acx_device_t *adev, char *filename)
#ifdef PATCH_AROUND_BAD_SPOTS
u32 offset;
int i;
-#endif
+#endif /* PATCH_AROUND_BAD_SPOTS */

FN_ENTER;

@@ -1397,7 +1399,7 @@ static int _acx_upload_fw(acx_device_t *adev, char *filename)

}
acxmem_unlock();
-#endif // PATCH_AROUND_BAD_SPOTS
+#endif // PATCH_AROUND_BAD_SPOTS
} // IS_MEM

vfree(fw_image);
@@ -1491,14 +1493,14 @@ void acx_show_card_eeprom_id(acx_device_t *adev)
}
#else
static inline void acx_show_card_eeprom_id(acx_device_t *adev) {}
-#endif /* NONESSENTIAL_FEATURES */
+#endif /* NONESSENTIAL_FEATURES */

/*
* BOM CMDs (Control Path)
* ==================================================
*/

-#if 1 //
+#if 1 /* acx_read_cmd_type_status() */
u32 acx_read_cmd_type_status(acx_device_t *adev)
{
u32 cmd_type, cmd_status;
@@ -1518,7 +1520,7 @@ u32 acx_read_cmd_type_status(acx_device_t *adev)
FN_EXIT1(cmd_status);
return cmd_status;
}
-#endif // acxmem_read_cmd_type_status()
+#endif /* acx_read_cmd_type_status() */

/* static inline */
void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status)
@@ -1583,7 +1585,7 @@ static void acx_init_mboxes(acx_device_t *adev)
* Also ifup/down works more reliable on the mem device.
*
*/
-#if 0 // needs work
+#if 0 /* acxmem_issue_cmd_timeo_debug() */
int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd,
void *buffer, unsigned buflen,
unsigned cmd_timeout, const char *cmdstr)
@@ -1809,7 +1811,7 @@ int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd,
FN_EXIT1(NOT_OK);
return NOT_OK;
}
-#endif // acxmem_issue_cmd_timeo_debug()
+#endif /* acxmem_issue_cmd_timeo_debug() */

#define REG_ACX_VENDOR_ID 0x900
#define ACX_VENDOR_ID 0x8400104c
@@ -1826,7 +1828,7 @@ int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd,
* MAC will be reset
* Call context: reset_dev
*/
-#if 0 // review before restoring
+#if 0 // acxmem_reset_mac()
static void acxmem_reset_mac(acx_device_t *adev)
{
int count;
@@ -1864,7 +1866,7 @@ static void acxmem_reset_mac(acx_device_t *adev)

FN_EXIT0;
}
-#endif // acxmem_reset_mac()
+#endif // acxmem_reset_mac()

void acx_up(struct ieee80211_hw *hw)
{
@@ -1969,7 +1971,7 @@ int acx_reset_dev(acx_device_t *adev)
goto end_fail;
}
} // IS_MEM
-#if 0
+#if 0 // IO_ACX_SOR_CFG
if (read_reg16(adev, IO_ACX_SOR_CFG) & 2) {
/* eCPU most likely means "embedded CPU" */
msg = "acx: eCPU did not start after boot from flash. ";
@@ -1982,7 +1984,7 @@ int acx_reset_dev(acx_device_t *adev)
"is this fatal?\n", adev->ndev->name,
wiphy_name(adev->ieee->wiphy));
}
-#endif
+#endif // IO_ACX_SOR_CFG

/* scan, if any, is stopped now, setting corresponding IRQ bit */
(IS_MEM(adev))
@@ -2126,9 +2128,9 @@ int acx_verify_init(acx_device_t *adev)
* control field, of which only 0x02000000 has any meaning. The lower
* 19 bits are the address of the next block divided by 32.
*/
-#if 0 // none in pci
-static void acxmem_init_acx_txbuf(acx_device_t *adev) {
-
+#if 0 // acxmem_init_acx_txbuf()
+static void acxmem_init_acx_txbuf(acx_device_t *adev)
+{
/*
* acx100_s_init_memory_pools set up txbuf_start and
* txbuf_numblocks for us. All we need to do is reset the
@@ -2146,13 +2148,13 @@ static void acxmem_init_acx_txbuf(acx_device_t *adev) {
* reset, so the ACX memory is in the state we want.
*/
}
-#endif // acxmem_init_acx_txbuf()
+#endif // acxmem_init_acx_txbuf()

/*
* Most of the acx specific pieces of hardware reset.
*/

-#if 0
+#if 0 // acxmem_i_set_multicast_list()
/***********************************************************************
** acxmem_i_set_multicast_list
** FIXME: most likely needs refinement
@@ -2202,7 +2204,7 @@ static void acxmem_i_set_multicast_list(struct net_device *ndev)
* BOM Proc, Debug
* ==================================================
*/
-#if 0 // real close
+#if 0 // acxmem_proc_diag_output()
int acxmem_proc_diag_output(struct seq_file *file,
acx_device_t *adev)
{
@@ -2309,8 +2311,9 @@ int acxmem_proc_diag_output(struct seq_file *file,
(ulong) & (txdesc->AcxMemPtr));
seq_printf(file, " %04x: ", tmp);

- /* Output allocated tx-buffer chain */
-#if 1
+
+#if 1 /* Output allocated tx-buffer chain */
+
if (tmp) {
while ((tmp2 = read_slavemem32(adev, (u32) tmp))
!= 0x02000000) {
@@ -2320,7 +2323,8 @@ int acxmem_proc_diag_output(struct seq_file *file,
}
seq_printf(file, " %04x=%04x", tmp, tmp2);
}
-#endif
+#endif /* Output allocated tx-buffer chain */
+
seq_printf(file, "\n");

#if 0
@@ -2345,7 +2349,7 @@ int acxmem_proc_diag_output(struct seq_file *file,
}
}

-#if 1
+#if 1 /* Tx-buffer list dump */
/* Tx-buffer list dump */
seq_printf(file, "\n");
seq_printf(file, "* Tx-buffer list dump\n");
@@ -2365,7 +2369,7 @@ int acxmem_proc_diag_output(struct seq_file *file,
}
seq_printf(file, "\n");
/* --- */
-#endif
+#endif /* Tx-buffer list dump */

seq_printf(file, "\n"
"** Generic slave data **\n"
@@ -2396,7 +2400,7 @@ int acxmem_proc_diag_output(struct seq_file *file,
FN_EXIT0;
return 0;
}
-#endif // acxmem_proc_diag_output()
+#endif // acxmem_proc_diag_output()

/*
* BOM Rx Path
@@ -2588,7 +2592,7 @@ static int acxmem_get_txbuf_space_needed(acx_device_t *adev, unsigned int len) {
return (blocks_needed);
}

-#if 0 // acxmem_get_txdesc()
+#if 0 // acxmem_get_txdesc()
static inline
txdesc_t* acxmem_get_txdesc(acx_device_t *adev, int index)
{
@@ -2606,7 +2610,7 @@ txdesc_t* acxmem_get_txdesc(acx_device_t *adev, int index)
* sufficiently many.
*/
/* OW TODO Align with pci.c */
-#if 1 // acxmem_alloc_tx()
+#if 1 // acxmem_alloc_tx()
tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) {
struct txdesc *txdesc;
unsigned head;
@@ -2725,7 +2729,7 @@ tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) {

return (tx_t*) txdesc;
}
-#endif // acxmem_alloc_tx()
+#endif // acxmem_alloc_tx()

/*
* acxmem_l_dealloc_tx
@@ -2737,7 +2741,7 @@ tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) {
* pointer back.
*
*/
-#if 1 // acxmem_dealloc_tx()
+#if 1 // acxmem_dealloc_tx()
void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque) {
/*
* txdesc is the address of the descriptor on the ACX.
@@ -2772,13 +2776,13 @@ void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque) {
acxmem_unlock();

}
-#endif // acxmem_dealloc_tx()
-#endif // CONFIG_ACX_MAC80211_MEM
+#endif // acxmem_dealloc_tx()
+#endif // CONFIG_ACX_MAC80211_MEM

/*
* Return an acx pointer to the next transmit data block.
*/
-#if 0 // using copy in mem.c
+#if 0 /* acxmem_allocate_acx_txbuf_space() */
static u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) {
u32 block, next, last_block;
int blocks_needed;
@@ -2840,7 +2844,7 @@ static u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) {

return block;
}
-#endif
+#endif /* acxmem_allocate_acx_txbuf_space() */

/*
* Return buffer space back to the pool by following the next pointers
@@ -2928,7 +2932,7 @@ void *_acx_get_txbuf(acx_device_t * adev, tx_t * tx_opaque)
* pre-allocated tx descrs, properly setting up transfer data and
* CTL_xxx flags according to fragment number.
*/
-#if 1 // pci version merge started
+#if 1 // pci version merge started
void _acx_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len,
struct ieee80211_tx_info *info, struct sk_buff *skb)
{
@@ -3184,7 +3188,7 @@ end_of_chain:

FN_EXIT0;
}
-#endif // acxmem_tx_data()
+#endif // acxmem_tx_data()

/*
* acxmem_l_clean_txdesc
@@ -3476,10 +3480,10 @@ void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue)
local_irq_restore (flags);
#endif
}
-#endif // CONFIG_ACX_MAC80211_MEM) acxmem_update_queue_indicator()
+#endif // CONFIG_ACX_MAC80211_MEM) acxmem_update_queue_indicator()

/* OW TODO See if this is usable with mac80211 */
-#if 0
+#if 0 // acxmem_i_tx_timeout()
/***********************************************************************
** acxmem_i_tx_timeout
**
@@ -3526,10 +3530,7 @@ static void acxmem_i_tx_timeout(struct net_device *ndev) {

FN_EXIT0;
}
-#endif // acxmem_i_tx_timeout()
-
-#ifdef CONFIG_ACX_MAC80211_MEM
-#endif // CONFIG_ACX_MAC80211_MEM
+#endif // acxmem_i_tx_timeout()

/*
* BOM Irq Handling, Timer
@@ -3573,7 +3574,7 @@ void acx_irq_work(struct work_struct *work)

#if IRQ_ITERATE
if (!irqmasked) break;
-#endif
+#endif /* IRQ_ITERATE */

/* HOST_INT_CMD_COMPLETE handling */
if (irqmasked & HOST_INT_CMD_COMPLETE) {
@@ -3644,7 +3645,7 @@ void acx_irq_work(struct work_struct *work)
* tx_free >= TX_START_QUEUE */
if (!acx_queue_stopped(adev->ieee))
acx_tx_queue_go(adev);
-#endif
+#endif /* IRQ_ITERATE */

/* HOST_INT_INFO */
if (irqmasked & HOST_INT_INFO)
@@ -3728,7 +3729,7 @@ void acx_irq_work(struct work_struct *work)

void acx_handle_info_irq(acx_device_t *adev)
{
-#if ACX_DEBUG
+#if ACX_DEBUG /* static const char * const info_type_msg[] */
static const char * const info_type_msg[] = {
"(unknown)",
"scan complete",
@@ -3748,7 +3749,8 @@ void acx_handle_info_irq(acx_device_t *adev)
"???",
"TKIP IV value exceeds thresh"
};
-#endif
+#endif /* ACX_DEBUG static const char * const info_type_msg[] */
+
u32 info_type, info_status;

info_type = (IS_MEM(adev))
@@ -3790,7 +3792,7 @@ void acx_set_interrupt_mask(acx_device_t *adev)
/* OW FIXME Old interrupt handler
* ---
*/
-#if 0
+#if 0 /* acxmem_interrupt() */
static irqreturn_t acxmem_interrupt(int irq, void *dev_id)
{
acx_device_t *adev = dev_id;
@@ -3840,7 +3842,8 @@ static irqreturn_t acxmem_interrupt(int irq, void *dev_id)
/* safety condition; we'll normally abort loop below
* in case no IRQ type occurred */
while (likely(--irqcount)) {
-#endif
+#endif // IRQ_ITERATE
+
/* ACK all IRQs ASAP */
write_reg16(adev, IO_ACX_IRQ_ACK, 0xffff);

@@ -3870,10 +3873,11 @@ static irqreturn_t acxmem_interrupt(int irq, void *dev_id)
* some reason...) */
if (adev->tx_free <= TX_START_CLEAN) {
#if TX_CLEANUP_IN_SOFTIRQ
- acx_schedule_task(adev, ACX_AFTER_IRQ_TX_CLEANUP);
+ acx_schedule_task(adev,
+ ACX_AFTER_IRQ_TX_CLEANUP);
#else
acx_tx_clean_txdesc(adev);
-#endif
+#endif /* TX_CLEANUP_IN_SOFTIRQ */
}
}

@@ -3883,7 +3887,8 @@ static irqreturn_t acxmem_interrupt(int irq, void *dev_id)
if (irqtype & HOST_INT_CMD_COMPLETE) {
log(L_IRQ, "got Command_Complete IRQ\n");
/* save the state for the running issue_cmd() */
- SET_BIT(adev->irq_status, HOST_INT_CMD_COMPLETE);
+ SET_BIT(adev->irq_status,
+ HOST_INT_CMD_COMPLETE);
}
if (irqtype & HOST_INT_INFO) {
acx_handle_info_irq(adev);
@@ -3891,9 +3896,11 @@ static irqreturn_t acxmem_interrupt(int irq, void *dev_id)
if (irqtype & HOST_INT_SCAN_COMPLETE) {
log(L_IRQ, "got Scan_Complete IRQ\n");
/* need to do that in process context */
- acx_schedule_task(adev, ACX_AFTER_IRQ_COMPLETE_SCAN);
+ acx_schedule_task(adev,
+ ACX_AFTER_IRQ_COMPLETE_SCAN);
/* remember that fw is not scanning anymore */
- SET_BIT(adev->irq_status, HOST_INT_SCAN_COMPLETE);
+ SET_BIT(adev->irq_status,
+ HOST_INT_SCAN_COMPLETE);
}
}

@@ -3927,7 +3934,8 @@ static irqreturn_t acxmem_interrupt(int irq, void *dev_id)
if (!irqtype)
break;

- if (unlikely(++adev->irq_loops_this_jiffy> MAX_IRQLOOPS_PER_JIFFY)) {
+ if (unlikely(++adev->irq_loops_this_jiffy
+ > MAX_IRQLOOPS_PER_JIFFY)) {
pr_err("acx: too many interrupts per jiffy!\n");
/* Looks like card floods us with IRQs! Try to
* stop that */
@@ -3938,7 +3946,7 @@ static irqreturn_t acxmem_interrupt(int irq, void *dev_id)
break;
}
}
-#endif
+#endif /* IRQ_ITERATE */

/* OW 20091129 TODO Currently breaks mem.c ...
* If sleeping is required like for update card settings, this
@@ -3948,11 +3956,13 @@ static irqreturn_t acxmem_interrupt(int irq, void *dev_id)
*/

/* OW TODO */
-#if 0
+#if 0 /* call update_link_quality_led() */
+
/* Routine to perform blink with range */
if (unlikely(adev->led_power == 2))
update_link_quality_led(adev);
-#endif
+
+#endif /* call update_link_quality_led() */

/* handled: */
/* write_flush(adev); - not needed, last op was read anyway */
@@ -3965,7 +3975,7 @@ static irqreturn_t acxmem_interrupt(int irq, void *dev_id)
FN_EXIT0;
return IRQ_NONE;
}
-#endif
+#endif /* acxmem_interrupt() */
/* --- */


@@ -4075,8 +4085,9 @@ INLINE_IO int acxmem_adev_present(acx_device_t *adev)
}

/* OW TODO */
-#if 0
-static void update_link_quality_led(acx_device_t *adev) {
+#if 0 /* update_link_quality_led() */
+static void update_link_quality_led(acx_device_t *adev)
+{
int qual;

qual = acx_signal_determine_quality(adev->wstats.qual.level,
@@ -4091,7 +4102,7 @@ static void update_link_quality_led(acx_device_t *adev) {
adev->brange_time_last_state_change = jiffies;
}
}
-#endif
+#endif /* update_link_quality_led() */


/*
@@ -4100,10 +4111,11 @@ static void update_link_quality_led(acx_device_t *adev) {
*/

/* OW TODO Not used in pci either !? */
-#if 0
+#if 0 /* acx111pci_ioctl_info() */
int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info,
- struct iw_param *vwrq, char *extra) {
-#if ACX_DEBUG > 1
+ struct iw_param *vwrq, char *extra)
+{
+#if ACX_DEBUG > 1 /* in acx111pci_ioctl_info body */

acx_device_t *adev = ieee2adev(hw);
rxdesc_t *rxdesc;
@@ -4381,12 +4393,12 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info,
end_ok:

acx_sem_unlock(adev);
-#endif /* ACX_DEBUG */
+#endif /* ACX_DEBUG > 1 in acx111pci_ioctl_info body */
return OK;
}

-/***********************************************************************
- */
+/********************************************************************/
+
int acx100mem_ioctl_set_phy_amp_bias(struct ieee80211_hw *hw,
struct iw_request_info *info,
struct iw_param *vwrq, char *extra) {
@@ -4429,7 +4441,7 @@ int acx100mem_ioctl_set_phy_amp_bias(struct ieee80211_hw *hw,
acx_sem_unlock(adev);
return OK;
}
-#endif
+#endif /* acx111pci_ioctl_info() */

void acx_delete_dma_regions(acx_device_t *adev)
{
@@ -4476,7 +4488,7 @@ void acx_delete_dma_regions(acx_device_t *adev)
* pdev - ptr to pci device structure containing info about pci configuration
* id - ptr to the device id entry that matched this device
*/
-#if 0 // non-trivial diffs vs pci
+#if 0 /* acxmem_probe() */
static int __devinit acxmem_probe(struct platform_device *pdev) {

acx_device_t *adev = NULL;
@@ -4497,7 +4509,8 @@ static int __devinit acxmem_probe(struct platform_device *pdev) {

ieee = ieee80211_alloc_hw(sizeof(struct acx_device), &acxmem_hw_ops);
if (!ieee) {
- pr_acx("could not allocate ieee80211 structure %s\n", pdev->name);
+ pr_acx("could not allocate ieee80211 structure %s\n",
+ pdev->name);
goto fail_ieee80211_alloc_hw;
}
SET_IEEE80211_DEV(ieee, &pdev->dev);
@@ -4616,7 +4629,8 @@ static int __devinit acxmem_probe(struct platform_device *pdev) {
IRQF_SHARED,
KBUILD_MODNAME,
adev)) {
- pr_acx("%s: request_irq FAILED\n", wiphy_name(adev->ieee->wiphy));
+ pr_acx("%s: request_irq FAILED\n",
+ wiphy_name(adev->ieee->wiphy));
result = -EAGAIN;
goto fail_request_irq;
}
@@ -4702,7 +4716,7 @@ static int __devinit acxmem_probe(struct platform_device *pdev) {

#if CMD_DISCOVERY
great_inquisitor(adev);
-#endif
+#endif /* CMD_DISCOVERY */

result = OK;
goto done;
@@ -4737,7 +4751,7 @@ static int __devinit acxmem_probe(struct platform_device *pdev) {
FN_EXIT1(result);
return result;
}
-#endif
+#endif /* acxmem_probe() */

/*
* acxmem_e_remove
@@ -4747,7 +4761,7 @@ static int __devinit acxmem_probe(struct platform_device *pdev) {
*
* pdev - ptr to PCI device structure containing info about pci configuration
*/
-#if 0 // close, but defer merge
+#if 0 /* acxmem_remove() */
static int __devexit acxmem_remove(struct platform_device *pdev)
{
struct ieee80211_hw *hw = (struct ieee80211_hw *)
@@ -4783,7 +4797,7 @@ static int __devexit acxmem_remove(struct platform_device *pdev)
* not possible currently, since not supported by all
* firmware versions */
acx_issue_cmd(adev, ACX100_CMD_SLEEP, NULL, 0);
-#endif
+#endif /* REDUNDANT */

acxmem_lock();

@@ -4840,9 +4854,9 @@ static int __devexit acxmem_remove(struct platform_device *pdev)

return(0);
}
-#endif
+#endif /* acxmem_remove() */

-#if 0 // til-end
+#if 0 /* CONFIG_PM not ready */
/*
* TODO: PM code needs to be fixed / debugged / tested.
*/
@@ -4940,7 +4954,7 @@ static int acxmem_e_resume(struct platform_device *pdev)
FN_EXIT0;
return OK;
}
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM */


static struct platform_driver acxmem_driver = {
@@ -4953,7 +4967,7 @@ static struct platform_driver acxmem_driver = {
#ifdef CONFIG_PM
.suspend = acxmem_e_suspend,
.resume = acxmem_e_resume
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM */
};

/*
@@ -4966,20 +4980,21 @@ int __init acxmem_init_module(void) {

FN_ENTER;

-#if (ACX_IO_WIDTH==32)
+#if (ACX_IO_WIDTH == 32)
pr_acx("compiled to use 32bit I/O access. "
"I/O timing issues might occur, such as "
"non-working firmware upload. Report them\n");
#else
pr_acx("compiled to use 16bit I/O access only "
"(compatibility mode)\n");
-#endif
+#endif /* (ACX_IO_WIDTH == 32) */

#ifdef __LITTLE_ENDIAN
#define ENDIANNESS_STRING "acx: running on a little-endian CPU\n"
#else
#define ENDIANNESS_STRING "acx: running on a BIG-ENDIAN CPU\n"
-#endif
+#endif /* __LITTLE_ENDIAN */
+
log(L_INIT,
ENDIANNESS_STRING
"acx: Slave-memory module initialized, "
@@ -5010,5 +5025,5 @@ MODULE_AUTHOR( "Todd Blumer <***@sdgsystems.com>" );
MODULE_DESCRIPTION( "ACX Slave Memory Driver" );
MODULE_LICENSE( "GPL" );

-#endif // til-end
-#endif /* defined CONFIG_ACX_MAC80211_PCI || defined CONFIG_ACX_MAC80211_MEM */
+#endif /* CONFIG_PM not ready */
+#endif /* CONFIG_ACX_MAC80211_PCI || CONFIG_ACX_MAC80211_MEM */
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:16 UTC
Permalink
add spaces in assignments, per checkpatch

Signed-off-by: Jim Cromie <***@gmail.com>
---
common.c | 46 +++++++++++++++++++++++-----------------------
1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/common.c b/common.c
index fb7d4fc..49e103e 100644
--- a/common.c
+++ b/common.c
@@ -1689,7 +1689,7 @@ void acx_parse_configoption(acx_device_t *adev,
(char *)acfg->manufacturer.list);
/*
pr_info("EEPROM part:\n");
- for (i=0; i<58; i++) {
+ for (i = 0; i < 58; i++) {
printk("%02X =======> 0x%02X\n",
i, (u8 *)acfg->NVSv[i-2]);
}
@@ -2514,7 +2514,7 @@ static int acx1xx_get_tx_level(acx_device_t *adev)
FN_EXIT1(NOT_OK);
return NOT_OK;
}
- adev->tx_level_val= tx_level.level;
+ adev->tx_level_val = tx_level.level;
log(L_ANY, "Got tx-power-level: %d\n", adev->tx_level_val);
end:
FN_EXIT0;
@@ -2523,7 +2523,7 @@ end:

static int acx1xx_set_tx_level(acx_device_t *adev, u8 level_val)
{
- adev->tx_level_val=level_val;
+ adev->tx_level_val = level_val;
return acx1xx_update_tx_level(adev);
}

@@ -2538,7 +2538,7 @@ static int acx1xx_update_tx_level(acx_device_t *adev)

log(L_ANY, "Updating tx-power-level to: %d\n", adev->tx_level_val);
memset(&tx_level, 0, sizeof(tx_level));
- tx_level.level=adev->tx_level_val;
+ tx_level.level = adev->tx_level_val;

return acx_configure(adev, &tx_level, ACX1xx_IE_DOT11_TX_POWER_LEVEL);
}
@@ -2670,7 +2670,7 @@ static int acx1xx_get_antenna(acx_device_t *adev)
FN_ENTER;

memset(antenna, 0, sizeof(antenna));
- res=acx_interrogate(adev, antenna,
+ res = acx_interrogate(adev, antenna,
ACX1xx_IE_DOT11_CURRENT_ANTENNA);
adev->antenna[0] = antenna[4];
adev->antenna[1] = antenna[5];
@@ -2688,7 +2688,7 @@ static int acx1xx_set_antenna(acx_device_t *adev, u8 val0, u8 val1)

adev->antenna[0] = val0;
adev->antenna[1] = val1;
- res=acx1xx_update_antenna(adev);
+ res = acx1xx_update_antenna(adev);

FN_EXIT0;
return res;
@@ -2706,7 +2706,7 @@ static int acx1xx_update_antenna(acx_device_t *adev)
memset(antenna, 0, sizeof(antenna));
antenna[4] = adev->antenna[0];
antenna[5] = adev->antenna[1];
- res=acx_configure(adev, &antenna,
+ res = acx_configure(adev, &antenna,
ACX1xx_IE_DOT11_CURRENT_ANTENNA);

FN_EXIT0;
@@ -2774,7 +2774,7 @@ static int acx100_set_tx_antenna(acx_device_t *adev, u8 val)
val2 = 0;
break;
default:
- val2=val;
+ val2 = val;
}
logf1(L_ANY, "val2=%02d\n", val2);

@@ -2832,7 +2832,7 @@ static int acx1xx_get_station_id(acx_device_t *adev)

FN_ENTER;

- res=acx_interrogate(adev, &stationID, ACX1xx_IE_DOT11_STATION_ID);
+ res = acx_interrogate(adev, &stationID, ACX1xx_IE_DOT11_STATION_ID);
paddr = &stationID[4];
for (i = 0; i < ETH_ALEN; i++) {
/* we copy the MAC address (reversed in the card) to
@@ -2854,7 +2854,7 @@ static int acx1xx_set_station_id(acx_device_t *adev, u8 *new_addr)
FN_ENTER;

MAC_COPY(adev->dev_addr, new_addr);
- res=acx1xx_update_station_id(adev);
+ res = acx1xx_update_station_id(adev);

FN_EXIT0;
return res;
@@ -2878,7 +2878,7 @@ static int acx1xx_update_station_id(acx_device_t *adev)
* (reversed in the card!) */
paddr[i] = adev->dev_addr[ETH_ALEN - 1 - i];
}
- res=acx_configure(adev, &stationID, ACX1xx_IE_DOT11_STATION_ID);
+ res = acx_configure(adev, &stationID, ACX1xx_IE_DOT11_STATION_ID);

FN_EXIT0;
return res;
@@ -2891,7 +2891,7 @@ static int acx1xx_get_ed_threshold(acx_device_t *adev)
FN_ENTER;

if (IS_ACX100(adev)) {
- res=acx100_get_ed_threshold(adev);
+ res = acx100_get_ed_threshold(adev);
} else {
log(L_INIT, "acx111 doesn't support ED\n");
adev->ed_threshold = 0;
@@ -2911,7 +2911,7 @@ static int acx100_get_ed_threshold(acx_device_t *adev)

FN_ENTER;
memset(ed_threshold, 0, sizeof(ed_threshold));
- res=acx_interrogate(adev, ed_threshold,
+ res = acx_interrogate(adev, ed_threshold,
ACX100_IE_DOT11_ED_THRESHOLD);
adev->ed_threshold = ed_threshold[4];

@@ -2926,7 +2926,7 @@ static int acx1xx_set_ed_threshold(acx_device_t *adev, u8 ed_threshold)

FN_ENTER;
adev->ed_threshold=ed_threshold;
- res=acx1xx_update_ed_threshold(adev);
+ res = acx1xx_update_ed_threshold(adev);

FN_EXIT0;
return res;
@@ -2935,14 +2935,14 @@ static int acx1xx_set_ed_threshold(acx_device_t *adev, u8 ed_threshold)

static int acx1xx_update_ed_threshold(acx_device_t *adev)
{
- int res=NOT_OK;
+ int res = NOT_OK;

FN_ENTER;
log(L_INIT, "Updating the Energy Detect (ED) threshold: %u\n",
adev->ed_threshold);

if (IS_ACX100(adev))
- res=acx100_update_ed_threshold(adev);
+ res = acx100_update_ed_threshold(adev);
else
log(L_INIT, "acx111 doesn't support ED threshold\n");

@@ -2958,7 +2958,7 @@ static int acx100_update_ed_threshold(acx_device_t *adev)
FN_ENTER;
memset(ed_threshold, 0, sizeof(ed_threshold));
ed_threshold[4] = adev->ed_threshold;
- res=acx_configure(adev, &ed_threshold,
+ res = acx_configure(adev, &ed_threshold,
ACX100_IE_DOT11_ED_THRESHOLD);

FN_EXIT0;
@@ -3005,8 +3005,8 @@ static int acx1xx_set_cca(acx_device_t *adev, u8 cca)

FN_ENTER;

- adev->cca=cca;
- res=acx1xx_update_cca(adev);
+ adev->cca = cca;
+ res = acx1xx_update_cca(adev);

FN_EXIT0;
return res;
@@ -3053,7 +3053,7 @@ static int acx1xx_get_rate_fallback(acx_device_t *adev)

FN_ENTER;
memset(rate, 0, sizeof(rate));
- res=acx_interrogate(adev, &rate,
+ res = acx_interrogate(adev, &rate,
ACX1xx_IE_RATE_FALLBACK);
adev->rate_auto = rate[4];

@@ -3324,7 +3324,7 @@ static int acx_update_wep(acx_device_t *adev)

static int acx_update_wep_options(acx_device_t *adev)
{
- int res=NOT_OK;
+ int res = NOT_OK;

FN_ENTER;

@@ -3340,7 +3340,7 @@ static int acx_update_wep_options(acx_device_t *adev)

static int acx100_update_wep_options(acx_device_t *adev)
{
- int res=NOT_OK;
+ int res = NOT_OK;
acx100_ie_wep_options_t options;

FN_ENTER;
@@ -6336,7 +6336,7 @@ void acx_op_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
adev->vif_monitor--;
else {
adev->vif_operating = 0;
- adev->vif=NULL;
+ adev->vif = NULL;
}

acx_set_mode(adev, ACX_MODE_OFF);
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:14 UTC
Permalink
Signed-off-by: Jim Cromie <***@gmail.com>
---
merge.c | 17 -----------------
1 file changed, 17 deletions(-)

diff --git a/merge.c b/merge.c
index d40842d..81240c6 100644
--- a/merge.c
+++ b/merge.c
@@ -2917,23 +2917,6 @@ void *_acx_get_txbuf(acx_device_t * adev, tx_t * tx_opaque)
return acx_get_txhostdesc(adev, (txdesc_t *) tx_opaque)->data;
}

-#if 0 // merged
-static txhostdesc_t*
-acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc) {
- int index = (u8*) txdesc - (u8*) adev->tx.desc_start;
- if (unlikely(ACX_DEBUG && (index % adev->tx.desc_size))) {
- pr_info("bad txdesc ptr %p\n", txdesc);
- return NULL;
- }
- index /= adev->tx.desc_size;
- if (unlikely(ACX_DEBUG && (index >= TX_CNT))) {
- pr_info("bad txdesc ptr %p\n", txdesc);
- return NULL;
- }
- return &adev->tx.host.txstart[index * 2];
-}
-#endif // acxmem_get_txhostdesc()
-
/*
* acxmem_l_tx_data
*
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:51:17 UTC
Permalink
Commit 5b98c8e572 merged acx(pci|mem)_upload_fw() together, but used
it only for mem (by adding a wrapper: acxmem_upload_fw). This adds
the complementary wrapper for pci; it #if0s the pci.c version, and
copies the filename selection/construction code into a wrapper.

Also does a bit of refactoring of wrappers, adding FN_ENTER/EXITs, and
most importantly, moves the adev->need_radio_fw = 1 out into wrapper
(needed to make acxpci_upload_fw() work.

Signed-off-by: Jim Cromie <***@gmail.com>
---
merge.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
pci.c | 3 ++-
2 files changed, 71 insertions(+), 10 deletions(-)

diff --git a/merge.c b/merge.c
index aefe8b5..d237215 100644
--- a/merge.c
+++ b/merge.c
@@ -1318,9 +1318,6 @@ static int _acx_upload_fw(acx_device_t *adev, char *filename)

FN_ENTER;

- /* No combined image; tell common we need the radio firmware, too */
- adev->need_radio_fw = 1;
-
fw_image = acx_read_fw(adev->bus_dev, filename, &file_size);
if (!fw_image) {
FN_EXIT1(NOT_OK);
@@ -1353,11 +1350,11 @@ static int _acx_upload_fw(acx_device_t *adev, char *filename)
#ifdef PATCH_AROUND_BAD_SPOTS
acxmem_lock();
/*
- * Only want to do this if the firmware is exactly what we expect for an
- * iPaq 4700; otherwise, bad things would ensue.
+ * Only want to do this if the firmware is exactly what we
+ * expect for an iPaq 4700; otherwise, bad things would ensue.
*/
if ((HX4700_FIRMWARE_CHECKSUM == fw_image->chksum)
- || (HX4700_ALTERNATE_FIRMWARE_CHECKSUM == fw_image->chksum)) {
+ || (HX4700_ALTERNATE_FIRMWARE_CHECKSUM == fw_image->chksum)) {
/*
* Put the patch after the main firmware image.
* 0x950c contains the ACX's idea of the end of the
@@ -1407,12 +1404,75 @@ static int _acx_upload_fw(acx_device_t *adev, char *filename)
FN_EXIT1(res);
return res;
}
+
int acxmem_upload_fw(acx_device_t *adev)
{
char *filename = "WLANGEN.BIN";
- return _acx_upload_fw(adev, filename);
+ int rc;
+
+ FN_ENTER;
+ /* No combined image; tell common we need the radio firmware, too */
+ adev->need_radio_fw = 1;
+ rc = _acx_upload_fw(adev, filename);
+ FN_EXIT1(rc);
+ return rc;
+}
+
+int acxpci_upload_fw(acx_device_t *adev)
+{
+ char filename[sizeof("tiacx1NNcNN")];
+ int rc;
+
+ FN_ENTER;
+ /* print exact chipset and radio ID to make sure people really
+ * get a clue on which files exactly they need to provide.
+ * Firmware loading is a frequent end-user PITA with these
+ * chipsets.
+ */
+ pr_acx("need firmware for acx1%02d chipset with radio ID %02X\n"
+ "Please provide via firmware hotplug:\n"
+ "either combined firmware (single file named "
+ "'tiacx1%02dc%02X')\n"
+ "or two files (base firmware file 'tiacx1%02d' "
+ "+ radio fw 'tiacx1%02dr%02X')\n",
+ IS_ACX111(adev)*11, adev->radio_type,
+ IS_ACX111(adev)*11, adev->radio_type,
+ IS_ACX111(adev)*11,
+ IS_ACX111(adev)*11, adev->radio_type
+ );
+
+ /* print exact chipset and radio ID to make sure people really
+ * get a clue on which files exactly they are supposed to
+ * provide, since firmware loading is the biggest enduser PITA
+ * with these chipsets. Not printing radio ID in 0xHEX in
+ * order to not confuse them into wrong file naming
+ */
+ pr_acx("need to load firmware for acx1%02d chipset with radio "
+ "ID %02x, please provide via firmware hotplug:\n"
+ "either one file only (<c>ombined firmware image file, "
+ "radio-specific) or two files (radio-less base image "
+ "file *plus* separate <r>adio-specific extension file)\n",
+ IS_ACX111(adev)*11, adev->radio_type);
+
+ /* Try combined, then main image */
+ adev->need_radio_fw = 0;
+ snprintf(filename, sizeof(filename), "tiacx1%02dc%02X",
+ IS_ACX111(adev) * 11, adev->radio_type);
+
+ rc = _acx_upload_fw(adev, filename);
+ if (!rc) {
+ FN_EXIT1(rc);
+ return rc;
+ }
+ adev->need_radio_fw = 1;
+ snprintf(filename, sizeof(filename), "tiacx1%02dr%02X",
+ IS_ACX111(adev) * 11, adev->radio_type);
+
+ rc = _acx_upload_fw(adev, filename);
+ FN_EXIT1(rc);
+ return rc;
}
-#endif // acx_upload_fw()
+#endif // acx_upload_fw()

#if defined(NONESSENTIAL_FEATURES)

@@ -1477,7 +1537,7 @@ void acx_show_card_eeprom_id(acx_device_t *adev)
if (!memcmp(&buffer, device_ids[i].id, CARD_EEPROM_ID_SIZE)) {
if (device_ids[i].descr) {
pr_acx("EEPROM card ID string check "
- "found %s card ID: is this %s?\n",
+ "found %s card ID: is this a %s?\n",
device_ids[i].descr,
device_ids[i].type);
}
diff --git a/pci.c b/pci.c
index 45f20be..c6d5131 100644
--- a/pci.c
+++ b/pci.c
@@ -164,6 +164,7 @@ void acxpci_free_coherent(struct pci_dev *hwdev, size_t size,
* Origin: Derived from FW dissection
*/
/* static */
+#if 0 // acxpci_upload_fw()
int acxpci_upload_fw(acx_device_t *adev)
{
firmware_image_t *fw_image = NULL;
@@ -239,7 +240,7 @@ int acxpci_upload_fw(acx_device_t *adev)
FN_EXIT1(res);
return res;
}
-
+#endif

/*
* BOM CMDs (Control Path)
--
1.7.10.1.487.ga3935e6
Jim Cromie
2012-05-15 07:56:13 UTC
Permalink
this is on top of Larrys 15
hi Oliver, Larry,
heres another batch of merges, sparse fixes, comment wraps and grammar
fixes, and various other stuff.  Another chance to amortize your testing efforts over more changes ;-)
 common.c  | 188 +++++++++++++++++++----------
 debugfs.c |  26 ++--
 inlines.h |  75 +++++-------
 mem.c     |  55 +++++----
 mem.h     |   4 +-
 merge.c   | 408 +++++++++++++++++++++++++++++++-------------------------------
 merge.h   | 204 +++++++++++++++++++++++--------
 pci.c     |  23 ++--
 8 files changed, 569 insertions(+), 414 deletions(-)
0001-merge.c-fix-ifdef-CONFIG_PCI.patch
0002-debugfs-refine-config-build-choices.patch
- improve configurability
0003-debugfs.c-tweak-commentary.patch
- note use of inode/dentry->privates
0004-debugfs.c-make-debugfs_fops-static.patch
0005-common.c-fix-5-copy_from_user-omissions-in-acx_proc_.patch
- fix sparse issues
0006-pci.c-fix-sparse-warnings.patch
0007-mem-statics-etc-linewraps.patch
0008-merge-drop-if0d-restore-statics-fixup-headers.patch
0009-common.c-set-debug-flags-by-symbolic-names.patch
0010-inlines.h-ifdef-comment-cleanup.patch
0011-inlines.h-prettier.patch
0012-merge-stick-with-mem.c-acxmem_proc_diag_output.patch
- merging looks too ugly, defer
0013-refactor-for-USB-only-builds.patch
- wrap entire file in ifdef skip unless PCI or MEM
0014-merge.c-comment-wrap.patch
0015-merge.h-make-USB-only-cleanly.patch
- reason for 1,2
- adds decl_or_stub helper macro,
0016-merge.c-drop-if0d-acxmem_get_txhostdesc.patch
- merge cleanup
0017-merge.c-add-comments-to-ifdefs-to-aid-searches-greps.patch
- help find remaining merges
0018-common.c-fix-var-val-style.patch
0019-merge-redo-acxpci_upload_fw-as-wrapper-on-_acx_uploa.patch
- finish partial merge of upload-fw
Oliver Winker
2012-05-15 17:36:10 UTC
Permalink
Hi Jim, Larry,

Alright, Thanks again for the new batches ;)!

I was held up by an problem encountered while checking the latest
OpenWRT trunk, which is related to a change in the mac80211 hw-queue
handling in the current wireless-testing (and compat-wireless). I was
checking different possibilities, but I think it's concluded to one now.

So as next step I'll merge then in all the batches and do the usual
testing with the devices here.

Maybe I get this done tomorrow (maybe), latest Thu then (there is an
public holiday). But I'm on it!

Best Regards, Oliver
hi Oliver, Larry,
heres another batch of merges, sparse fixes, comment wraps and grammar
fixes, and various other stuff. Another chance to amortize your testing efforts over more changes ;-)
common.c | 188 +++++++++++++++++++----------
debugfs.c | 26 ++--
inlines.h | 75 +++++-------
mem.c | 55 +++++----
mem.h | 4 +-
merge.c | 408 +++++++++++++++++++++++++++++++-------------------------------
merge.h | 204 +++++++++++++++++++++++--------
pci.c | 23 ++--
8 files changed, 569 insertions(+), 414 deletions(-)
0001-merge.c-fix-ifdef-CONFIG_PCI.patch
0002-debugfs-refine-config-build-choices.patch
- improve configurability
0003-debugfs.c-tweak-commentary.patch
- note use of inode/dentry->privates
0004-debugfs.c-make-debugfs_fops-static.patch
0005-common.c-fix-5-copy_from_user-omissions-in-acx_proc_.patch
- fix sparse issues
0006-pci.c-fix-sparse-warnings.patch
0007-mem-statics-etc-linewraps.patch
0008-merge-drop-if0d-restore-statics-fixup-headers.patch
0009-common.c-set-debug-flags-by-symbolic-names.patch
0010-inlines.h-ifdef-comment-cleanup.patch
0011-inlines.h-prettier.patch
0012-merge-stick-with-mem.c-acxmem_proc_diag_output.patch
- merging looks too ugly, defer
0013-refactor-for-USB-only-builds.patch
- wrap entire file in ifdef skip unless PCI or MEM
0014-merge.c-comment-wrap.patch
0015-merge.h-make-USB-only-cleanly.patch
- reason for 1,2
- adds decl_or_stub helper macro,
0016-merge.c-drop-if0d-acxmem_get_txhostdesc.patch
- merge cleanup
0017-merge.c-add-comments-to-ifdefs-to-aid-searches-greps.patch
- help find remaining merges
0018-common.c-fix-var-val-style.patch
0019-merge-redo-acxpci_upload_fw-as-wrapper-on-_acx_uploa.patch
- finish partial merge of upload-fw
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Acx100-devel mailing list
https://lists.sourceforge.net/lists/listinfo/acx100-devel
Jim Cromie
2012-05-15 18:54:34 UTC
Permalink
Post by Oliver Winker
Hi Jim, Larry,
Alright, Thanks again for the new batches ;)!
I was held up by an problem encountered while checking the latest
OpenWRT trunk, which is related to a change in the mac80211 hw-queue
handling in the current wireless-testing (and compat-wireless). I was
checking different possibilities, but I think it's concluded to one now.
So as next step I'll merge then in all the batches and do the usual
testing with the devices here.
Maybe I get this done tomorrow (maybe), latest Thu then (there is an
public holiday). But I'm on it!
Best Regards, Oliver
FYI, several things


I recently rebuilt my kernel to add ieee80211 debugfs support,
and (I think) afterwards started seeing these periodically.


ieee80211 phy0: wlan0: No probe response from AP 00:14:d1:e8:65:0a
after 500ms, try 1/5
ieee80211 phy0: wlan0: No probe response from AP 00:14:d1:e8:65:0a
after 500ms, try 1/5
ieee80211 phy0: wlan0: No probe response from AP 00:14:d1:e8:65:0a
after 500ms, try 1/5
ieee80211 phy0: wlan0: No probe response from AP 00:14:d1:e8:65:0a
after 500ms, try 1/5
ieee80211 phy9: wlan1: No probe response from AP 00:14:d1:e8:65:0a
after 500ms, try 1/5
ieee80211 phy0: wlan0: No probe response from AP 00:14:d1:e8:65:0a
after 500ms, try 1/5

Im getting them for both wlan0 (rtl8180) and wlan1 (acx-mac80211)
which pretty much excuses the driver.

More suspiciously, Im getting tail errors:


acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=2, tail=2, head=9
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=11,
tail=11, head=1
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=10,
tail=10, head=2
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=15,
tail=15, head=4
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=14,
tail=14, head=5
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=0, tail=0, head=9
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=7,
tail=7, head=14
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=0,
tail=0, head=12
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=12,
tail=12, head=1
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=7, tail=7, head=8
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=8,
tail=8, head=13


In all cases (I think), finger==tail, which suggests an off-by-one error,
probably due to merge, but I havent looked yet.

Iperf testing works, as does scp of a large tarball, checksums match,
so its affecting thruput at worst.


there are a bunch of retries though:

***@voyage:~# iw dev wlan1 station dump
Failed to read classid file: Object not found
Station 00:14:d1:e8:65:0a (on wlan1)
inactive time: 14740 ms
rx bytes: 61152680
rx packets: 276428
tx bytes: 72244666
tx packets: 65471
tx retries: 18447
tx failed: 2
tx bitrate: 54.0 MBit/s


***@voyage:~# more /dbg/acx_mac80211/phy10/info
acx.acx_dbgfs_open: opening filename=info fmode=35 fidx=0 adev=c0bd2fc0
acx driver version: v0.6.0-glarry-512-19-g0fde744 (git: larry-512-19
-g0fde744)
Wireless extension version: 22
chip name: TNETW1130 (0x03010101)
radio type: 0x16
form factor: 0x01
EEPROM version: 0x05
firmware version: Rev 1.2.1.34 (0x01020134)

larry-512 is the (mis-dated) tag I applied to Larrys 15 on 509


Im attaching a test script Ive been using to bang on the driver
Dot it into your shell, and go from there.

***@voyage:~# . wifi-probe.rc
wifi-help for info
***@voyage:~# wifi-help

provides functions to probe, test wifi drivers using iw-tools
wifi-probe: run the probes/tests
mon-up: create monitor ifaces, do tcpdump captures on them
mon-down: close those monitor interfaces
wifi-save: save the files to to driver-version dir
wifi-net: run some connectivity tests (ifdowns eth0 wlan0)
vars: # set to change behavior
devs: wlan0 wlan1
drvname: acx
apmac: 00:14:d1:e8:65:0a # not used now
chan: 11
macs: 00:18:DE:06:B2:0C 00:30:BD:4D:E2:47 00:18:4D:24:B3:FA
iperfsvrs: 192.168.10.127 192.168.10.128 # iperf server addresses
iperfargs: -t30 -i5
others: eth0 wlan0 # ifdown these in wifi-ent


Please suggests mods, enhancements useful to you.
2 Ive just thought of:
- snapshot of /dbg/acx-mac80211/phyX
- snapshots of /dbg/ieee80211/phyX

Maybe commit this to the tree ?
Jim Cromie
2012-05-15 19:00:51 UTC
Permalink
Post by Jim Cromie
Im attaching a test script Ive been using to bang on the driver
Dot it into your shell, and go from there.
oof. now attached.


ieee80211 phy0: device now idle
# ping -c 5 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=42 time=74.1 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=42 time=73.1 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=42 time=72.1 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=42 time=75.8 ms
64 bytes from 8.8.8.8: icmp_req=5 ttl=42 time=75.1 ms

--- 8.8.8.8 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms
rtt min/avg/max/mdev = 72.160/74.078/75.856/1.367 ms
# traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 192.168.10.1 (192.168.10.1) 3.182 ms 4.057 ms 3.032
msacx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=8,
tail=8, head=9

2 98.245.32.1 (98.245.32.1) 29.426 ms 27.175 ms 37.633 ms
3 ge-1-39-sr01.summit.co.denver.comcast.net (68.85.220.81) 17.012
ms 18.033 ms 17.180 ms
4 te-0-3-0-5-ar02.denver.co.denver.comcast.net (68.86.179.13)
20.576 ms 19.859 ms 18.830 ms
5 pos-0-1-0-0-ar02.aurora.co.denver.comcast.net (68.86.128.242)
21.255 ms 25.530 ms 24.431 ms
6 pos-3-8-0-0-cr01.denver.co.ibone.comcast.net (68.86.94.153)
29.713 msacx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free.
finger=15, tail=15, head=1
21.524 ms 20.397 ms
7 pos-2-15-0-0-cr01.dallas.tx.ibone.comcast.net (68.86.85.174)
32.443 ms 38.577 ms 38.590 ms
8 pos-0-2-0-0-pe01.1950stemmons.tx.ibone.comcast.net (68.86.86.150)
37.771 ms 36.751 ms 34.762 ms
9 75.149.231.70 (75.149.231.70) 70.077 ms 77.810 ms 76.300 ms
10 72.14.233.85 (72.14.233.85) 77.171 ms 76.659 ms 73.189 ms
11 72.14.237.221 (72.14.237.221) 73.666 ms 72.262 ms 81.477 ms
12 209.85.243.178 (209.85.243.178) 79.493 ms 216.239.47.121
(216.239.47.121) 84.403 ms 76.440 ms
13 216.239.46.63 (216.239.46.63) 79.059 ms 216.239.46.59
(216.239.46.59) 79.192 ms 78.299 ms
14 * * *
15 google-public-dns-a.google.com (8.8.8.8) 79.325 ms 77.984 ms 76.868 ms
# iperf -c 192.168.10.127 -t30 -i5
------------------------------------------------------------
Client connecting to 192.168.10.127, TCP port 5001
TCP window size: 21.0 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.10.126 port 54345 connected with 192.168.10.127 port 5001
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=5, tail=5, head=0
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=15,
tail=15, head=0
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=10,
tail=10, head=6
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=3, tail=3, head=1
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=2,
tail=2, head=14
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=3, tail=3, head=1
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=9, tail=9, head=5
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=14,
tail=14, head=12
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=8, tail=8, head=1
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=7, tail=7, head=5
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=12,
tail=12, head=15
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=7,
tail=7, head=11
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=1, tail=1, head=7
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=9,
tail=9, head=14
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 5.0 sec 2.49 MBytes 4.18 Mbits/sec
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=1, tail=1, head=6
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=4, tail=4, head=0
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=12,
tail=12, head=6
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=11,
tail=11, head=9
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=10,
tail=10, head=8
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=12,
tail=12, head=8
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=0,
tail=0, head=12
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=2, tail=2, head=0
[ 3] 5.0-10.0 sec 2.72 MBytes 4.56 Mbits/sec
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=12,
tail=12, head=8
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=0,
tail=0, head=14
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=12,
tail=12, head=8
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=1,
tail=1, head=15
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=4,
tail=4, head=10
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=13,
tail=13, head=9
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=8, tail=8, head=6
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=10,
tail=10, head=6
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=4, tail=4, head=0
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=9, tail=9, head=7
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=4, tail=4, head=2
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=5, tail=5, head=3
[ 3] 10.0-15.0 sec 2.68 MBytes 4.50 Mbits/sec
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=9, tail=9, head=5
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=5, tail=5, head=3
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=14,
tail=14, head=1
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=12,
tail=12, head=13
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=7, tail=7, head=5
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=14,
tail=14, head=10
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=11,
tail=11, head=7
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=6, tail=6, head=2
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=3,
tail=3, head=15
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=0,
tail=0, head=12
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=15,
tail=15, head=11
[ 3] 15.0-20.0 sec 2.65 MBytes 4.44 Mbits/sec
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=10,
tail=10, head=8
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=14,
tail=14, head=10
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=8, tail=8, head=6
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=6, tail=6, head=2
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=0,
tail=0, head=14
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=6,
tail=6, head=14
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=15,
tail=15, head=11
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=3,
tail=3, head=14
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=4, tail=4, head=0
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=5, tail=5, head=2
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=2,
tail=2, head=13
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=11,
tail=11, head=9
[ 3] 20.0-25.0 sec 2.71 MBytes 4.55 Mbits/sec
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=3, tail=3, head=1
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=14,
tail=14, head=12
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=0, tail=0, head=9
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=8, tail=8, head=3
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=9, tail=9, head=5
[ 3] 25.0-30.0 sec 3.01 MBytes 5.05 Mbits/sec
[ 3] 0.0-30.0 sec 16.3 MBytes 4.54 Mbits/sec


The datarate is nothing like the 54MBits / sec reported by
station dump, but I guess thats typical.

At least server side agrees ;-)

$ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 192.168.10.127 port 5001 connected with 192.168.10.126 port 54345
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-30.2 sec 16.3 MBytes 4.52 Mbits/sec
Oliver Winker
2012-05-15 19:17:37 UTC
Permalink
Post by Jim Cromie
Post by Jim Cromie
Im attaching a test script Ive been using to bang on the driver
Dot it into your shell, and go from there.
How about putting the script into a 'scripts' sub-dir in the tree ? For
me that's fine.

Cheers, Oliver
Post by Jim Cromie
oof. now attached.
ieee80211 phy0: device now idle
Larry Finger
2012-05-15 20:02:22 UTC
Permalink
Post by Oliver Winker
Post by Jim Cromie
Im attaching a test script Ive been using to bang on the driver
Dot it into your shell, and go from there.
How about putting the script into a 'scripts' sub-dir in the tree ? For
me that's fine.
Sounds good to me.

Larry
Jim Cromie
2012-05-15 20:46:59 UTC
Permalink
hey, this one seems to have problems:
Ive gotten a couple null-pointer oopses.

common.c: set debug-flags by symbolic names


I'll look into it.
Oliver Winker
2012-05-15 19:06:40 UTC
Permalink
Hi Jim,
Regarding this one: It was striking me as well. But I think that is just
a difference in log-levels. Before, this was a "log(L_BUFT,..." and in
normal log-config not shown, now it's a pr_warn.

So probably that's no real issue and just the logging needs to be adjusted.

merge.c (HEAD)
---
if ((Ctl_8 & DESC_CTL_ACXDONE_HOSTOWN)
!= DESC_CTL_ACXDONE_HOSTOWN) {
/* maybe remove if wrapper */
if (unlikely(!num_cleaned))
pr_warn("clean_txdesc: tail isn't free. "
"finger=%d, tail=%d, head=%d\n",
finger, adev->tx.tail, adev->tx_head);
---

previous pci.c (0301ec35)
---
if ((Ctl_8 & DESC_CTL_ACXDONE_HOSTOWN) != DESC_CTL_ACXDONE_HOSTOWN) {
//if (unlikely(!num_cleaned)) { /* maybe remove completely */
log(L_BUFT, "clean_txdesc: tail isn't free. "
"finger=%d, tail=%d, head=%d\n", finger, adev->tx_tail,
adev->tx_head);
---

previous mem.c (0301ec35)
---
if ((Ctl_8 & DESC_CTL_ACXDONE_HOSTOWN) != DESC_CTL_ACXDONE_HOSTOWN) {
//if (unlikely(!num_cleaned)) { /* maybe remove completely */
log(L_BUFT, "clean_txdesc: tail isn't free. "
"finger=%d, tail=%d, head=%d\n", finger, adev->tx_tail,
adev->tx_head);
---

Best Regards, Oliver
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=2, tail=2, head=9
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=11,
tail=11, head=1
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=10,
tail=10, head=2
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=15,
tail=15, head=4
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=14,
tail=14, head=5
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=0, tail=0, head=9
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=7,
tail=7, head=14
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=0,
tail=0, head=12
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=12,
tail=12, head=1
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=7, tail=7, head=8
acx.acx_tx_clean_txdesc: clean_txdesc: tail isn't free. finger=8,
tail=8, head=13
In all cases (I think), finger==tail, which suggests an off-by-one error,
probably due to merge, but I havent looked yet.
Iperf testing works, as does scp of a large tarball, checksums match,
so its affecting thruput at worst.
Failed to read classid file: Object not found
Station 00:14:d1:e8:65:0a (on wlan1)
inactive time: 14740 ms
rx bytes: 61152680
rx packets: 276428
tx bytes: 72244666
tx packets: 65471
tx retries: 18447
tx failed: 2
tx bitrate: 54.0 MBit/s
acx.acx_dbgfs_open: opening filename=info fmode=35 fidx=0 adev=c0bd2fc0
acx driver version: v0.6.0-glarry-512-19-g0fde744 (git: larry-512-19
-g0fde744)
Wireless extension version: 22
chip name: TNETW1130 (0x03010101)
radio type: 0x16
form factor: 0x01
EEPROM version: 0x05
firmware version: Rev 1.2.1.34 (0x01020134)
larry-512 is the (mis-dated) tag I applied to Larrys 15 on 509
Im attaching a test script Ive been using to bang on the driver
Dot it into your shell, and go from there.
wifi-help for info
provides functions to probe, test wifi drivers using iw-tools
wifi-probe: run the probes/tests
mon-up: create monitor ifaces, do tcpdump captures on them
mon-down: close those monitor interfaces
wifi-save: save the files to to driver-version dir
wifi-net: run some connectivity tests (ifdowns eth0 wlan0)
vars: # set to change behavior
devs: wlan0 wlan1
drvname: acx
apmac: 00:14:d1:e8:65:0a # not used now
chan: 11
macs: 00:18:DE:06:B2:0C 00:30:BD:4D:E2:47 00:18:4D:24:B3:FA
iperfsvrs: 192.168.10.127 192.168.10.128 # iperf server addresses
iperfargs: -t30 -i5
others: eth0 wlan0 # ifdown these in wifi-ent
Please suggests mods, enhancements useful to you.
- snapshot of /dbg/acx-mac80211/phyX
- snapshots of /dbg/ieee80211/phyX
Maybe commit this to the tree ?
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Acx100-devel mailing list
https://lists.sourceforge.net/lists/listinfo/acx100-devel
Oliver Winker
2012-05-17 12:10:17 UTC
Permalink
Hi Jim, Larry,

Ok, the series and pushed! Thanks a lot again for this heap of work :)!!

There are several changes regarding builds and some functional fixes.
You'll see in the commits messages.

I had also to revert b4661bf5 (CONFIG_PCI vs. CONFIG_ACX_MAC80211_PCI,
see commit message). Maybe a runtime check would still be better here.

The sparse checks are interesting. I'll have also a look at some one time.

There regarding debugfs.c:

There were warnings, which have been fixed in 740058 and then seem to
have been rolled back again due to sparse warnings.

I checked those and, at least from my perspective, could fix them for
both gcc and sparse - see patch below.

Is this ok to commit, or is there something, that missed maybe ?

Best Regards, Oliver

---
CC [M] /media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.o
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:61:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:90:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:117:2: warning: initialization from incompatible pointer type [enabled by default]
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:117:2: warning: (near initialization for ‘acx_fops.write’) [enabled by default]
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:158:6: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
---

Then I get also still these sparse warning in debugfs.c:
---
CHECK /media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:117:27: warning: incorrect type in initializer (different type sizes)
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:117:27: expected long ( *write )( ... )
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:117:27: got int ( static [toplevel] *<noident> )( ... )
---

This patch seems to satisfy both, gcc and sparse for x86_32 and x86_64:
---
diff --git a/debugfs.c b/debugfs.c
index cd403bc..d6bbe7e 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -58,7 +58,7 @@ BUILD_BUG_DECL(dbgfs_files__VS__enum_REG_DOMAIN,
static int acx_dbgfs_open(struct inode *inode, struct file *file)
{
- int fidx = (int) inode->i_private;
+ int fidx = (uintptr_t) inode->i_private;
struct acx_device *adev = (struct acx_device *)
file->f_path.dentry->d_parent->d_inode->i_private;
@@ -83,11 +83,11 @@ static int acx_dbgfs_open(struct inode *inode, struct file *file)
return single_open(file, acx_proc_show_funcs[fidx], adev);
}
-static int acx_dbgfs_write(struct file *file, const char __user *buf,
+static ssize_t acx_dbgfs_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
/* retrieve file-index and adev from private fields */
- int fidx = (int) file->f_path.dentry->d_inode->i_private;
+ int fidx = (uintptr_t) file->f_path.dentry->d_inode->i_private;
struct acx_device *adev = (struct acx_device *)
file->f_path.dentry->d_parent->d_inode->i_private;
@@ -155,7 +155,7 @@ int acx_debugfs_add_adev(struct acx_device *adev)
/* save file-index in in file's private field */
file = debugfs_create_file(dbgfs_files[i], fmode,
acx_dbgfs_devdir,
- (void*) i, &acx_fops);
+ (void *) (uintptr_t) i, &acx_fops);
if (!file)
goto fail;
}
---
hi Oliver, Larry,
heres another batch of merges, sparse fixes, comment wraps and grammar
fixes, and various other stuff. Another chance to amortize your testing efforts over more changes ;-)
common.c | 188 +++++++++++++++++++----------
debugfs.c | 26 ++--
inlines.h | 75 +++++-------
mem.c | 55 +++++----
mem.h | 4 +-
merge.c | 408 +++++++++++++++++++++++++++++++-------------------------------
merge.h | 204 +++++++++++++++++++++++--------
pci.c | 23 ++--
8 files changed, 569 insertions(+), 414 deletions(-)
Larry Finger
2012-05-17 14:43:39 UTC
Permalink
Post by Oliver Winker
Hi Jim, Larry,
Ok, the series and pushed! Thanks a lot again for this heap of work :)!!
There are several changes regarding builds and some functional fixes.
You'll see in the commits messages.
I had also to revert b4661bf5 (CONFIG_PCI vs. CONFIG_ACX_MAC80211_PCI,
see commit message). Maybe a runtime check would still be better here.
The sparse checks are interesting. I'll have also a look at some one time.
There were warnings, which have been fixed in 740058 and then seem to
have been rolled back again due to sparse warnings.
I checked those and, at least from my perspective, could fix them for
both gcc and sparse - see patch below.
Is this ok to commit, or is there something, that missed maybe ?
Best Regards, Oliver
---
CC [M] /media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.o
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:61:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:90:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:117:2: warning: initialization from incompatible pointer type [enabled by default]
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:117:2: warning: (near initialization for ‘acx_fops.write’) [enabled by default]
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:158:6: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
---
---
CHECK /media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:117:27: warning: incorrect type in initializer (different type sizes)
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:117:27: expected long ( *write )( ... )
/media/OE/Devel/Git-acx-mac80211/acx-mac80211/debugfs.c:117:27: got int ( static [toplevel] *<noident> )( ... )
---
---
diff --git a/debugfs.c b/debugfs.c
index cd403bc..d6bbe7e 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -58,7 +58,7 @@ BUILD_BUG_DECL(dbgfs_files__VS__enum_REG_DOMAIN,
static int acx_dbgfs_open(struct inode *inode, struct file *file)
{
- int fidx = (int) inode->i_private;
+ int fidx = (uintptr_t) inode->i_private;
struct acx_device *adev = (struct acx_device *)
file->f_path.dentry->d_parent->d_inode->i_private;
@@ -83,11 +83,11 @@ static int acx_dbgfs_open(struct inode *inode, struct file *file)
return single_open(file, acx_proc_show_funcs[fidx], adev);
}
-static int acx_dbgfs_write(struct file *file, const char __user *buf,
+static ssize_t acx_dbgfs_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
/* retrieve file-index and adev from private fields */
- int fidx = (int) file->f_path.dentry->d_inode->i_private;
+ int fidx = (uintptr_t) file->f_path.dentry->d_inode->i_private;
struct acx_device *adev = (struct acx_device *)
file->f_path.dentry->d_parent->d_inode->i_private;
@@ -155,7 +155,7 @@ int acx_debugfs_add_adev(struct acx_device *adev)
/* save file-index in in file's private field */
file = debugfs_create_file(dbgfs_files[i], fmode,
acx_dbgfs_devdir,
- (void*) i,&acx_fops);
+ (void *) (uintptr_t) i,&acx_fops);
if (!file)
goto fail;
}
---
I had noticed the warnings from debugfs on x86_64 and prepared a patch. As I
decided that you had enough to test and merge, I have been holding it back. Your
solution looks like mine with one exception. In acx-debugfs_add_adev(), I
changed "i" to a long rather than using the uintptr_t cast. AFAIK, the solutions
are equal.

I purchased a DWL-120+ on E-bay yesterday. When it arrives, I hope that turns
out to be an acx100. The one labeled as DWL-120 that I asked you about turns out
to use at76c50x-usb as a driver. It wasn't a total loss, as that driver crashes
my kernels, thus it needs some work. I hope to get to it someday.

Thanks for your efforts on merging the code.

Loading...