* [PATCH] ep93xx eth driver: Reorder functions to eliminate need for prototypes
[not found] <339372749e251d51e46eedacfabaf293b59ca9f7.1265058811.git.matthias@kaehlcke.net>
@ 2010-02-01 21:17 ` Matthias Kaehlcke
2010-02-02 7:37 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Matthias Kaehlcke @ 2010-02-01 21:17 UTC (permalink / raw)
To: barebox
ep93xx eth driver: Define ep93xx_eth_send_packet() and ep93xx_eth_rcv_packet()
before ep93xx_eth_probe(), and eliminate their prototype declarations
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
---
drivers/net/ep93xx.c | 238 ++++++++++++++++++++++++-------------------------
1 files changed, 117 insertions(+), 121 deletions(-)
diff --git a/drivers/net/ep93xx.c b/drivers/net/ep93xx.c
index ac5d6fd..a63eac1 100644
--- a/drivers/net/ep93xx.c
+++ b/drivers/net/ep93xx.c
@@ -40,10 +40,6 @@
#include <mach/ep93xx-regs.h>
#include "ep93xx.h"
-static int ep93xx_eth_send_packet(struct eth_device *edev,
- void *packet, int length);
-static int ep93xx_eth_rcv_packet(struct eth_device *edev);
-
static int ep93xx_phy_read(struct miiphy_device *mdev, uint8_t phy_addr,
uint8_t phy_reg, uint16_t *value);
static int ep93xx_phy_write(struct miiphy_device *mdev, uint8_t phy_addr,
@@ -318,123 +314,6 @@ static void ep93xx_eth_halt(struct eth_device *edev)
pr_debug("-ep93xx_eth_halt\n");
}
-static int ep93xx_eth_get_ethaddr(struct eth_device *edev,
- unsigned char *mac_addr)
-{
- struct mac_regs *regs = ep93xx_get_regs(edev);
- uint32_t value;
-
- value = readl(®s->indad);
- mac_addr[0] = value & 0xFF;
- mac_addr[1] = (value >> 8) & 0xFF;
- mac_addr[2] = (value >> 16) & 0xFF;
- mac_addr[3] = (value >> 24) & 0xFF;
-
- value = readl(®s->indad_upper);
- mac_addr[4] = value & 0xFF;
- mac_addr[5] = (value >> 8) & 0xFF;
-
- return 0;
-}
-
-static int ep93xx_eth_set_ethaddr(struct eth_device *edev,
- unsigned char *mac_addr)
-{
- struct mac_regs *regs = ep93xx_get_regs(edev);
-
- writel(AFP_IAPRIMARY, ®s->afp);
-
- writel(mac_addr[0] | (mac_addr[1] << 8) |
- (mac_addr[2] << 16) | (mac_addr[3] << 24),
- ®s->indad);
- writel(mac_addr[4] | (mac_addr[5] << 8), ®s->indad_upper);
-
- return 0;
-}
-
-static int ep93xx_eth_probe(struct device_d *dev)
-{
- struct eth_device *edev;
- struct ep93xx_eth_priv *priv;
- int ret = -1;
-
- pr_debug("ep93xx_eth_probe()\n");
-
- edev = xzalloc(sizeof(struct eth_device) +
- sizeof(struct ep93xx_eth_priv));
- dev->type_data = edev;
- edev->priv = (struct ep93xx_eth_priv *)(edev + 1);
-
- priv = edev->priv;
- priv->regs = (struct mac_regs *)MAC_BASE;
-
- edev->init = ep93xx_eth_init_dev;
- edev->open = ep93xx_eth_open;
- edev->send = ep93xx_eth_send_packet;
- edev->recv = ep93xx_eth_rcv_packet;
- edev->halt = ep93xx_eth_halt;
- edev->get_ethaddr = ep93xx_eth_get_ethaddr;
- edev->set_ethaddr = ep93xx_eth_set_ethaddr;
-
- priv->miiphy.read = ep93xx_phy_read;
- priv->miiphy.write = ep93xx_phy_write;
- priv->miiphy.address = 0;
- priv->miiphy.flags = 0;
-
- priv->tx_dq.base = calloc(NUMTXDESC,
- sizeof(struct tx_descriptor));
- if (priv->tx_dq.base == NULL) {
- pr_err("calloc() failed: tx_dq.base");
- goto eth_probe_failed_0;
- }
-
- priv->tx_sq.base = calloc(NUMTXDESC,
- sizeof(struct tx_status));
- if (priv->tx_sq.base == NULL) {
- pr_err("calloc() failed: tx_sq.base");
- goto eth_probe_failed_1;
- }
-
- priv->rx_dq.base = calloc(NUMRXDESC,
- sizeof(struct rx_descriptor));
- if (priv->rx_dq.base == NULL) {
- pr_err("calloc() failed: rx_dq.base");
- goto eth_probe_failed_2;
- }
-
- priv->rx_sq.base = calloc(NUMRXDESC,
- sizeof(struct rx_status));
- if (priv->rx_sq.base == NULL) {
- pr_err("calloc() failed: rx_sq.base");
- goto eth_probe_failed_3;
- }
-
- miiphy_register(&priv->miiphy);
- eth_register(edev);
-
- ret = 0;
-
- goto eth_probe_done;
-
-eth_probe_failed_3:
- free(priv->rx_dq.base);
- /* Fall through */
-
-eth_probe_failed_2:
- free(priv->tx_sq.base);
- /* Fall through */
-
-eth_probe_failed_1:
- free(priv->tx_dq.base);
- /* Fall through */
-
-eth_probe_failed_0:
- /* Fall through */
-
-eth_probe_done:
- return ret;
-}
-
/**
* Copy a frame of data from the MAC into the protocol layer for further
* processing.
@@ -560,6 +439,123 @@ eth_send_failed_0:
return ret;
}
+static int ep93xx_eth_get_ethaddr(struct eth_device *edev,
+ unsigned char *mac_addr)
+{
+ struct mac_regs *regs = ep93xx_get_regs(edev);
+ uint32_t value;
+
+ value = readl(®s->indad);
+ mac_addr[0] = value & 0xFF;
+ mac_addr[1] = (value >> 8) & 0xFF;
+ mac_addr[2] = (value >> 16) & 0xFF;
+ mac_addr[3] = (value >> 24) & 0xFF;
+
+ value = readl(®s->indad_upper);
+ mac_addr[4] = value & 0xFF;
+ mac_addr[5] = (value >> 8) & 0xFF;
+
+ return 0;
+}
+
+static int ep93xx_eth_set_ethaddr(struct eth_device *edev,
+ unsigned char *mac_addr)
+{
+ struct mac_regs *regs = ep93xx_get_regs(edev);
+
+ writel(AFP_IAPRIMARY, ®s->afp);
+
+ writel(mac_addr[0] | (mac_addr[1] << 8) |
+ (mac_addr[2] << 16) | (mac_addr[3] << 24),
+ ®s->indad);
+ writel(mac_addr[4] | (mac_addr[5] << 8), ®s->indad_upper);
+
+ return 0;
+}
+
+static int ep93xx_eth_probe(struct device_d *dev)
+{
+ struct eth_device *edev;
+ struct ep93xx_eth_priv *priv;
+ int ret = -1;
+
+ pr_debug("ep93xx_eth_probe()\n");
+
+ edev = xzalloc(sizeof(struct eth_device) +
+ sizeof(struct ep93xx_eth_priv));
+ dev->type_data = edev;
+ edev->priv = (struct ep93xx_eth_priv *)(edev + 1);
+
+ priv = edev->priv;
+ priv->regs = (struct mac_regs *)MAC_BASE;
+
+ edev->init = ep93xx_eth_init_dev;
+ edev->open = ep93xx_eth_open;
+ edev->send = ep93xx_eth_send_packet;
+ edev->recv = ep93xx_eth_rcv_packet;
+ edev->halt = ep93xx_eth_halt;
+ edev->get_ethaddr = ep93xx_eth_get_ethaddr;
+ edev->set_ethaddr = ep93xx_eth_set_ethaddr;
+
+ priv->miiphy.read = ep93xx_phy_read;
+ priv->miiphy.write = ep93xx_phy_write;
+ priv->miiphy.address = 0;
+ priv->miiphy.flags = 0;
+
+ priv->tx_dq.base = calloc(NUMTXDESC,
+ sizeof(struct tx_descriptor));
+ if (priv->tx_dq.base == NULL) {
+ pr_err("calloc() failed: tx_dq.base");
+ goto eth_probe_failed_0;
+ }
+
+ priv->tx_sq.base = calloc(NUMTXDESC,
+ sizeof(struct tx_status));
+ if (priv->tx_sq.base == NULL) {
+ pr_err("calloc() failed: tx_sq.base");
+ goto eth_probe_failed_1;
+ }
+
+ priv->rx_dq.base = calloc(NUMRXDESC,
+ sizeof(struct rx_descriptor));
+ if (priv->rx_dq.base == NULL) {
+ pr_err("calloc() failed: rx_dq.base");
+ goto eth_probe_failed_2;
+ }
+
+ priv->rx_sq.base = calloc(NUMRXDESC,
+ sizeof(struct rx_status));
+ if (priv->rx_sq.base == NULL) {
+ pr_err("calloc() failed: rx_sq.base");
+ goto eth_probe_failed_3;
+ }
+
+ miiphy_register(&priv->miiphy);
+ eth_register(edev);
+
+ ret = 0;
+
+ goto eth_probe_done;
+
+eth_probe_failed_3:
+ free(priv->rx_dq.base);
+ /* Fall through */
+
+eth_probe_failed_2:
+ free(priv->tx_sq.base);
+ /* Fall through */
+
+eth_probe_failed_1:
+ free(priv->tx_dq.base);
+ /* Fall through */
+
+eth_probe_failed_0:
+ /* Fall through */
+
+eth_probe_done:
+ return ret;
+}
+
/* -----------------------------------------------------------------------------
* EP93xx ethernet MII functionality.
*/
--
1.6.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ep93xx eth driver: Reorder functions to eliminate need for prototypes
2010-02-01 21:17 ` [PATCH] ep93xx eth driver: Reorder functions to eliminate need for prototypes Matthias Kaehlcke
@ 2010-02-02 7:37 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2010-02-02 7:37 UTC (permalink / raw)
To: Matthias Kaehlcke; +Cc: barebox
On Mon, Feb 01, 2010 at 10:17:09PM +0100, Matthias Kaehlcke wrote:
> ep93xx eth driver: Define ep93xx_eth_send_packet() and ep93xx_eth_rcv_packet()
> before ep93xx_eth_probe(), and eliminate their prototype declarations
This one too
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-02-02 7:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <339372749e251d51e46eedacfabaf293b59ca9f7.1265058811.git.matthias@kaehlcke.net>
2010-02-01 21:17 ` [PATCH] ep93xx eth driver: Reorder functions to eliminate need for prototypes Matthias Kaehlcke
2010-02-02 7:37 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox