aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2400pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-12-20 04:54:54 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:58:35 -0500
commit5352ff6510422d9a9bf13b7272f865eb53247f4d (patch)
treeec85fd9933b3d79cf4ae844c36f0803168203f06 /drivers/net/wireless/rt2x00/rt2400pci.c
parenteb20b4e8a6998ca68d9ac0963ee36a1a36fe241d (diff)
rt2x00: Restrict interface between rt2x00link and drivers
Restrict drivers to only access link_qual structure during link tuning. The contents of these fields are for the drivers and all fields are allowed to be changed to values the driver considers correct. This means that some fields need to be moved outside of this structure to restrict access only to rt2x00link itself. This allows some code to be moved outside of the rt2x00.h header and into rt2x00link.c. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2400pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index e87ad43e8e8d..9104113270d0 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -600,36 +600,37 @@ static void rt2400pci_link_stats(struct rt2x00_dev *rt2x00dev,
600 qual->false_cca = bbp; 600 qual->false_cca = bbp;
601} 601}
602 602
603static inline void rt2400pci_set_vgc(struct rt2x00_dev *rt2x00dev, u8 vgc_level) 603static inline void rt2400pci_set_vgc(struct rt2x00_dev *rt2x00dev,
604 struct link_qual *qual, u8 vgc_level)
604{ 605{
605 rt2400pci_bbp_write(rt2x00dev, 13, vgc_level); 606 rt2400pci_bbp_write(rt2x00dev, 13, vgc_level);
606 rt2x00dev->link.vgc_level = vgc_level; 607 qual->vgc_level = vgc_level;
607 rt2x00dev->link.vgc_level_reg = vgc_level; 608 qual->vgc_level_reg = vgc_level;
608} 609}
609 610
610static void rt2400pci_reset_tuner(struct rt2x00_dev *rt2x00dev) 611static void rt2400pci_reset_tuner(struct rt2x00_dev *rt2x00dev,
612 struct link_qual *qual)
611{ 613{
612 rt2400pci_set_vgc(rt2x00dev, 0x08); 614 rt2400pci_set_vgc(rt2x00dev, qual, 0x08);
613} 615}
614 616
615static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev) 617static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev,
618 struct link_qual *qual, const u32 count)
616{ 619{
617 struct link *link = &rt2x00dev->link;
618
619 /* 620 /*
620 * The link tuner should not run longer then 60 seconds, 621 * The link tuner should not run longer then 60 seconds,
621 * and should run once every 2 seconds. 622 * and should run once every 2 seconds.
622 */ 623 */
623 if (link->count > 60 || !(link->count & 1)) 624 if (count > 60 || !(count & 1))
624 return; 625 return;
625 626
626 /* 627 /*
627 * Base r13 link tuning on the false cca count. 628 * Base r13 link tuning on the false cca count.
628 */ 629 */
629 if ((link->qual.false_cca > 512) && (link->vgc_level < 0x20)) 630 if ((qual->false_cca > 512) && (qual->vgc_level < 0x20))
630 rt2400pci_set_vgc(rt2x00dev, ++link->vgc_level); 631 rt2400pci_set_vgc(rt2x00dev, qual, ++qual->vgc_level);
631 else if ((link->qual.false_cca < 100) && (link->vgc_level > 0x08)) 632 else if ((qual->false_cca < 100) && (qual->vgc_level > 0x08))
632 rt2400pci_set_vgc(rt2x00dev, --link->vgc_level); 633 rt2400pci_set_vgc(rt2x00dev, qual, --qual->vgc_level);
633} 634}
634 635
635/* 636/*