From: Peter Huewe <peterhuewe@gmx.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Peter Huewe <peterhuewe@gmx.de>,
Andrew Miller <amiller@amilx.com>,
Maxim Mikityanskiy <maxtram95@gmail.com>,
YAMANE Toshiaki <yamanetoshi@gmail.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 5/9] staging/rtl8187se: Reuse ReadBBPortUchar to avoid duplicated code
Date: Wed, 13 Feb 2013 04:05:22 +0100 [thread overview]
Message-ID: <1360724726-2997-5-git-send-email-peterhuewe@gmx.de> (raw)
In-Reply-To: <1360724302-2794-4-git-send-email-peterhuewe@gmx.de>
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>
---
drivers/staging/rtl8187se/r8185b_init.c | 30 +++++++-----------------------
1 files changed, 7 insertions(+), 23 deletions(-)
diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c
index 1e54ead..a3b836c 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)
return reg;
}
+static u8 ReadBBPortUchar(struct net_device *dev, u32 addr)
+{
+ PlatformIOWrite4Byte(dev, PhyAddr, addr & 0xffffff7f);
+ return PlatformIORead1Byte(dev, PhyDataR);
+}
/* by Owen on 04/07/14 for writing BB register successfully */
-void WriteBBPortUchar(struct net_device *dev, u32 Data)
+static void WriteBBPortUchar(struct net_device *dev, u32 Data)
{
- /* u8 TimeoutCounter; */
- u8 RegisterContent;
- u8 UCharData;
-
- UCharData = (u8)((Data & 0x0000ff00) >> 8);
PlatformIOWrite4Byte(dev, PhyAddr, Data);
- /* for(TimeoutCounter = 10; TimeoutCounter > 0; TimeoutCounter--) */
- {
- PlatformIOWrite4Byte(dev, PhyAddr, Data & 0xffffff7f);
- RegisterContent = PlatformIORead1Byte(dev, PhyDataR);
- /*if(UCharData == RegisterContent) */
- /* break; */
- }
+ ReadBBPortUchar(dev, Data);
}
-u8 ReadBBPortUchar(struct net_device *dev, u32 addr)
-{
- /*u8 TimeoutCounter; */
- u8 RegisterContent;
-
- PlatformIOWrite4Byte(dev, PhyAddr, addr & 0xffffff7f);
- RegisterContent = PlatformIORead1Byte(dev, PhyDataR);
-
- return RegisterContent;
-}
/*
* Description:
* Perform Antenna settings with antenna diversity on 87SE.
--
1.7.8.6
next prev parent reply other threads:[~2013-02-13 3:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 2:58 [PATCH 1/9] staging/rtl8187se: Remove code without effect Peter Huewe
2013-02-13 2:58 ` [PATCH 2/9] " Peter Huewe
2013-02-13 2:58 ` [PATCH 3/9] " Peter Huewe
2013-02-13 2:58 ` [PATCH 4/9] staging/rtl8187se: Remove unused/unnecessary variables Peter Huewe
2013-02-13 3:05 ` Peter Huewe [this message]
2013-02-13 3:05 ` [PATCH 6/9] staging/rtl8187se: Remove temporary variable for return value Peter Huewe
2013-02-13 3:05 ` [PATCH 7/9] staging/rtl8187se: Remove unused functions PlatformIORead2Byte / PlatformIORead4Byte Peter Huewe
2013-02-13 3:05 ` [PATCH 8/9] staging/rtl8187se: Remove duplicated code by using an offset Peter Huewe
2013-02-13 3:05 ` [PATCH 9/9] staging/rtl8187se: Mark functions as static to silence sparse Peter Huewe
-- strict thread matches above, loose matches on Subject: below --
2013-02-13 2:54 [PATCH 1/9] staging/rtl8187se: Remove code without effect Peter Huewe
2013-02-13 2:54 ` [PATCH 5/9] staging/rtl8187se: Reuse ReadBBPortUchar to avoid duplicated code Peter Huewe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1360724726-2997-5-git-send-email-peterhuewe@gmx.de \
--to=peterhuewe@gmx.de \
--cc=amiller@amilx.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxtram95@gmail.com \
--cc=yamanetoshi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®