Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c370d95 authored by Peter Huewe's avatar Peter Huewe Committed by Greg Kroah-Hartman
Browse files

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: default avatarPeter Huewe <peterhuewe@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8a26aefd
Loading
Loading
Loading
Loading
+7 −23
Original line number Original line Diff line number Diff line
@@ -287,35 +287,19 @@ u16 RF_ReadReg(struct net_device *dev, u8 offset)
	return reg;
	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 */
/* 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);
	PlatformIOWrite4Byte(dev, PhyAddr, Data);
	/* for(TimeoutCounter = 10; TimeoutCounter > 0; TimeoutCounter--) */
	ReadBBPortUchar(dev, Data);
	{
		PlatformIOWrite4Byte(dev, PhyAddr, Data & 0xffffff7f);
		RegisterContent = PlatformIORead1Byte(dev, PhyDataR);
		/*if(UCharData == RegisterContent)	*/
		/*	break;	*/
	}
}
}


u8 ReadBBPortUchar(struct net_device *dev, u32 addr)
{
	/*u8	TimeoutCounter; */
	u8	RegisterContent;

	PlatformIOWrite4Byte(dev, PhyAddr, addr & 0xffffff7f);
	RegisterContent = PlatformIORead1Byte(dev, PhyDataR);

	return RegisterContent;
}
/*
/*
 *	Description:
 *	Description:
 *	Perform Antenna settings with antenna diversity on 87SE.
 *	Perform Antenna settings with antenna diversity on 87SE.