diff mbox

[3/3] sh_eth: get rid of bb_{set|clr|read}()

Message ID 2620242.OINoAeziLK@wasted.cogentembedded.com (mailing list archive)
State Awaiting Upstream
Delegated to: Simon Horman
Headers show

Commit Message

Sergei Shtylyov Dec. 7, 2015, 9:41 p.m. UTC
After the MDIO bitbang code consolidation, there's no need anymore for
bb_{set|clr}() as well as bb_read() -- just expand them inline, thus
saving more LoCs...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 drivers/net/ethernet/renesas/sh_eth.c |   27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Simon Horman Dec. 8, 2015, 12:42 a.m. UTC | #1
On Tue, Dec 08, 2015 at 12:41:43AM +0300, Sergei Shtylyov wrote:
> After the MDIO bitbang code consolidation, there's no need anymore for
> bb_{set|clr}() as well as bb_read() -- just expand them inline, thus
> saving more LoCs...
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Acked-by: Simon Horman <horms+renesas@verge.net.au>

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -1015,35 +1015,20 @@  struct bb_info {
 	void *addr;
 };
 
-/* PHY bit set */
-static void bb_set(void *addr, u32 msk)
-{
-	iowrite32(ioread32(addr) | msk, addr);
-}
-
-/* PHY bit clear */
-static void bb_clr(void *addr, u32 msk)
-{
-	iowrite32((ioread32(addr) & ~msk), addr);
-}
-
-/* PHY bit read */
-static int bb_read(void *addr, u32 msk)
-{
-	return (ioread32(addr) & msk) != 0;
-}
-
 static void sh_mdio_ctrl(struct mdiobb_ctrl *ctrl, u32 mask, int set)
 {
 	struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl);
+	u32 pir;
 
 	if (bitbang->set_gate)
 		bitbang->set_gate(bitbang->addr);
 
+	pir = ioread32(bitbang->addr);
 	if (set)
-		bb_set(bitbang->addr, mask);
+		pir |=  mask;
 	else
-		bb_clr(bitbang->addr, mask);
+		pir &= ~mask;
+	iowrite32(pir, bitbang->addr);
 }
 
 /* Data I/O pin control */
@@ -1066,7 +1051,7 @@  static int sh_get_mdio(struct mdiobb_ctr
 	if (bitbang->set_gate)
 		bitbang->set_gate(bitbang->addr);
 
-	return bb_read(bitbang->addr, PIR_MDI);
+	return (ioread32(bitbang->addr) & PIR_MDI) != 0;
 }
 
 /* MDC pin control */