Content-Disposition: inline; filename="ac92dc42d43221e09e9183c4a3f471b11d561be8..ec836476b0f41d2a54a99f2b8bf70607cf77ea15.patch"
Last-Modified: Sat, 12 Oct 2024 08:52:50 GMT
Expires: Tue, 10 Oct 2034 08:52:50 GMT

From ec836476b0f41d2a54a99f2b8bf70607cf77ea15 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Sun, 25 Oct 2009 09:37:27 +0000
Subject: ramips: remove unnecessary type-castings in the ethernet driver

SVN-Revision: 18146
---
 target/linux/ramips/files/drivers/net/ramips.c | 28 ++++++++++++++------------
 1 file changed, 15 insertions(+), 13 deletions(-)

(limited to 'target/linux/ramips')

diff --git a/target/linux/ramips/files/drivers/net/ramips.c b/target/linux/ramips/files/drivers/net/ramips.c
index 9ab9714447..338fa53992 100644
--- a/target/linux/ramips/files/drivers/net/ramips.c
+++ b/target/linux/ramips/files/drivers/net/ramips.c
@@ -58,7 +58,7 @@ static int
 ramips_alloc_dma(struct net_device *dev)
 {
 #define phys_to_bus(a)  (a & 0x1FFFFFFF)
-	struct raeth_priv *priv = (struct raeth_priv*)netdev_priv(dev);
+	struct raeth_priv *priv = netdev_priv(dev);
 	int i;
 
 	priv->skb_free_idx = 0;
@@ -107,7 +107,7 @@ ramips_alloc_dma(struct net_device *dev)
 static int
 ramips_eth_hard_start_xmit(struct sk_buff* skb, struct net_device *dev)
 {
-	struct raeth_priv *priv = (struct raeth_priv*)netdev_priv(dev);
+	struct raeth_priv *priv = netdev_priv(dev);
 	unsigned long tx;
 	unsigned int tx_next;
 
@@ -159,7 +159,7 @@ static void
 ramips_eth_rx_hw(unsigned long ptr)
 {
 	struct net_device *dev = (struct net_device*)ptr;
-	struct raeth_priv *priv = (struct raeth_priv*)netdev_priv(dev);
+	struct raeth_priv *priv = netdev_priv(dev);
 	int rx;
 	int max_rx = 16;
 
@@ -205,7 +205,7 @@ static void
 ramips_eth_tx_housekeeping(unsigned long ptr)
 {
 	struct net_device *dev = (struct net_device*)ptr;
-	struct raeth_priv *priv = (struct raeth_priv*)netdev_priv(dev);
+	struct raeth_priv *priv = netdev_priv(dev);
 
 	while((priv->tx[priv->skb_free_idx].txd2 & TX_DMA_DONE) &&
 		(priv->tx_skb[priv->skb_free_idx]))
@@ -223,7 +223,9 @@ ramips_eth_tx_housekeeping(unsigned long ptr)
 static struct net_device_stats*
 ramips_eth_get_stats(struct net_device *dev)
 {
-	return &((struct raeth_priv*)netdev_priv(dev))->stat;
+	struct raeth_priv *priv = netdev_priv(dev);
+
+	return &priv->stat;
 }
 
 static int
@@ -243,14 +245,15 @@ ramips_eth_set_mac_addr(struct net_device *dev, void *priv)
 static void
 ramips_eth_timeout(struct net_device *dev)
 {
-	tasklet_schedule(
-		&((struct raeth_priv*)netdev_priv(dev))->tx_housekeeping_tasklet);
+	struct raeth_priv *priv = netdev_priv(dev);
+
+	tasklet_schedule(&priv->tx_housekeeping_tasklet);
 }
 
 static irqreturn_t
 ramips_eth_irq(int irq, void *dev)
 {
-	struct raeth_priv *priv = (struct raeth_priv*)netdev_priv(dev);
+	struct raeth_priv *priv = netdev_priv(dev);
 	unsigned long fe_int = ramips_fe_rr(RAMIPS_FE_INT_STATUS);
 
 	if(fe_int & RAMIPS_RX_DLY_INT)
@@ -268,7 +271,7 @@ ramips_eth_irq(int irq, void *dev)
 static int
 ramips_eth_open(struct net_device *dev)
 {
-	struct raeth_priv *priv = (struct raeth_priv*)netdev_priv(dev);
+	struct raeth_priv *priv = netdev_priv(dev);
 
 	ramips_alloc_dma(dev);
 	ramips_fe_wr((ramips_fe_rr(RAMIPS_PDMA_GLO_CFG) & 0xff) |
@@ -301,7 +304,7 @@ ramips_eth_open(struct net_device *dev)
 static int
 ramips_eth_stop(struct net_device *dev)
 {
-	struct raeth_priv *priv = (struct raeth_priv*)netdev_priv(dev);
+	struct raeth_priv *priv = netdev_priv(dev);
 
 	ramips_fe_wr(RAMIPS_PDMA_GLO_CFG, ramips_fe_rr(RAMIPS_PDMA_GLO_CFG) &
 		~(RAMIPS_TX_WB_DDONE | RAMIPS_RX_DMA_EN | RAMIPS_TX_DMA_EN));
@@ -320,7 +323,7 @@ ramips_eth_stop(struct net_device *dev)
 static int __init
 ramips_eth_probe(struct net_device *dev)
 {
-	struct raeth_priv *priv = (struct raeth_priv*)netdev_priv(dev);
+	struct raeth_priv *priv = netdev_priv(dev);
 	struct sockaddr addr;
 
 	BUG_ON(!priv->plat->reset_fe);
@@ -345,8 +348,7 @@ static int
 ramips_eth_plat_probe(struct platform_device *plat)
 {
 	struct raeth_priv *priv;
-	struct ramips_eth_platform_data *data =
-		(struct ramips_eth_platform_data*)plat->dev.platform_data;
+	struct ramips_eth_platform_data *data = plat->dev.platform_data;
 	ramips_fe_base = ioremap_nocache(data->base_addr, PAGE_SIZE);
 	if(!ramips_fe_base)
 		return -ENOMEM;
-- 
cgit v1.2.3

>
<a id='n20' href='#n20'>20</a>
<a id='n21' href='#n21'>21</a>
<a id='n22' href='#n22'>22</a>
<a id='n23' href='#n23'>23</a>
<a id='n24' href='#n24'>24</a>
</pre></td>
<td class='lines'><pre><code><style>pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #ffffff; }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */</style><div class="highlight"><pre><span></span><span class="ch">#!/usr/bin/env bash</span>
<span class="o">[</span> -n <span class="s2">&quot;</span><span class="nv">$1</span><span class="s2">&quot;</span> -a -n <span class="s2">&quot;</span><span class="nv">$2</span><span class="s2">&quot;</span> <span class="o">]</span> <span class="o">||</span> <span class="o">{</span>
	<span class="nb">echo</span> <span class="s2">&quot;Usage: </span><span class="nv">$0</span><span class="s2"> &lt;file&gt; &lt;directory&gt;&quot;</span>
	<span class="nb">exit</span> <span class="m">1</span>
<span class="o">}</span>
<span class="o">[</span> -f <span class="s2">&quot;</span><span class="nv">$1</span><span class="s2">&quot;</span> -a -d <span class="s2">&quot;</span><span class="nv">$2</span><span class="s2">&quot;</span> <span class="o">]</span> <span class="o">||</span> <span class="o">{</span>
	<span class="nb">echo</span> <span class="s2">&quot;File/directory not found&quot;</span>
	<span class="nb">exit</span> <span class="m">1</span>
<span class="o">}</span>
cat <span class="s2">&quot;</span><span class="nv">$1</span><span class="s2">&quot;</span> <span class="p">|</span> <span class="o">(</span>
	<span class="nb">cd</span> <span class="s2">&quot;</span><span class="nv">$2</span><span class="s2">&quot;</span>
	<span class="k">while</span> <span class="nb">read</span> entry<span class="p">;</span> <span class="k">do</span>
		<span class="o">[</span> -n <span class="s2">&quot;</span><span class="nv">$entry</span><span class="s2">&quot;</span> <span class="o">]</span> <span class="o">||</span> <span class="nb">break</span>
		<span class="o">[</span> -f <span class="s2">&quot;</span><span class="nv">$entry</span><span class="s2">&quot;</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> rm -f <span class="nv">$entry</span>
	<span class="k">done</span>
<span class="o">)</span>
cat <span class="s2">&quot;</span><span class="nv">$1</span><span class="s2">&quot;</span> <span class="p">|</span> <span class="o">(</span>
	<span class="nb">cd</span> <span class="s2">&quot;</span><span class="nv">$2</span><span class="s2">&quot;</span>
	<span class="k">while</span> <span class="nb">read</span> entry<span class="p">;</span> <span class="k">do</span>
		<span class="o">[</span> -n <span class="s2">&quot;</span><span class="nv">$entry</span><span class="s2">&quot;</span> <span class="o">]</span> <span class="o">||</span> <span class="nb">break</span>
		<span class="o">[</span> -d <span class="s2">&quot;</span><span class="nv">$entry</span><span class="s2">&quot;</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> rmdir <span class="s2">&quot;</span><span class="nv">$entry</span><span class="s2">&quot;</span> &gt; /dev/null <span class="m">2</span>&gt;<span class="p">&amp;</span><span class="m">1</span>
	<span class="k">done</span>
<span class="o">)</span>
<span class="nb">true</span>
</pre></div>
</code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.25.1</a>) at 2024-10-12 08:52:50 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
