aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Huewe <peterhuewe@gmx.de>2013-02-12 22:05:22 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-02-15 13:28:36 -0500
commit2c370d9512c4ea0929e87cb18a2308d9422a350a (patch)
treed9e6490104a38cbfc43843b72b0bae8ef31a4d54
parent8a26aefda17d7fdf0bdfb505b6366a7051e7fb1a (diff)
staging/rtl8187se: Reuse ReadBBPortUchar to avoid duplicated code
WriteBBPortUchar reimplements ReadBBPortUchar in its body, so we can remove the duplicated code by calling ReadBBPortUchar directly. Unfortunately we have to move ReadBBPortUchar around; while at it we can also get rid of the temporary variable for the return value. Also we can remove the local variables UCharData and RegisterContent in WriteBBPortUchar as they are not used / without effect. Both functions are only 'local' so we can mark them as static. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/rtl8187se/r8185b_init.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c
index 1e54eadb054e..a3b836cf775b 100644
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -287,35 +287,19 @@ u16 RF_ReadReg(struct net_device *dev, u8 offset)
287 return reg; 287 return reg;
288} 288}
289 289
290static u8 ReadBBPortUchar(struct net_device *dev, u32 addr)
291{
292 PlatformIOWrite4Byte(dev, PhyAddr, addr & 0xffffff7f);
293 return PlatformIORead1Byte(dev, PhyDataR);
294}
290 295
291/* by Owen on 04/07/14 for writing BB register successfully */ 296/* by Owen on 04/07/14 for writing BB register successfully */
292void WriteBBPortUchar(struct net_device *dev, u32 Data) 297static void WriteBBPortUchar(struct net_device *dev, u32 Data)
293{ 298{
294 /* u8 TimeoutCounter; */
295 u8 RegisterContent;
296 u8 UCharData;
297
298 UCharData = (u8)((Data & 0x0000ff00) >> 8);
299 PlatformIOWrite4Byte(dev, PhyAddr, Data); 299 PlatformIOWrite4Byte(dev, PhyAddr, Data);
300 /* for(TimeoutCounter = 10; TimeoutCounter > 0; TimeoutCounter--) */ 300 ReadBBPortUchar(dev, Data);
301 {
302 PlatformIOWrite4Byte(dev, PhyAddr, Data & 0xffffff7f);
303 RegisterContent = PlatformIORead1Byte(dev, PhyDataR);
304 /*if(UCharData == RegisterContent) */
305 /* break; */
306 }
307} 301}
308 302
309u8 ReadBBPortUchar(struct net_device *dev, u32 addr)
310{
311 /*u8 TimeoutCounter; */
312 u8 RegisterContent;
313
314 PlatformIOWrite4Byte(dev, PhyAddr, addr & 0xffffff7f);
315 RegisterContent = PlatformIORead1Byte(dev, PhyDataR);
316
317 return RegisterContent;
318}
319/* 303/*
320 * Description: 304 * Description:
321 * Perform Antenna settings with antenna diversity on 87SE. 305 * Perform Antenna settings with antenna diversity on 87SE.