netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Pisati <p.pisati@gmail.com>
To: netdev@vger.kernel.org
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Kristoffer Glembo <kristoffer@gaisler.com>
Subject: [PATCH 5/6] sunhme: remove mac address handling as a module parameter
Date: Tue, 23 Oct 2012 19:15:32 +0200	[thread overview]
Message-ID: <1351012533-3524-6-git-send-email-p.pisati@gmail.com> (raw)
In-Reply-To: <1351012533-3524-1-git-send-email-p.pisati@gmail.com>

Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
---
 drivers/net/ethernet/sun/sunhme.c |   69 +++++++++----------------------------
 1 file changed, 16 insertions(+), 53 deletions(-)

diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index cf14ab9..b5e70d5 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -9,8 +9,6 @@
  * 2000/11/11 Willy Tarreau <willy AT meta-x.org>
  *   - port to non-sparc architectures. Tested only on x86 and
  *     only currently works with QFE PCI cards.
- *   - ability to specify the MAC address at module load time by passing this
- *     argument : macaddr=0x00,0x10,0x20,0x30,0x40,0x50
  */
 
 #include <linux/module.h>
@@ -74,12 +72,6 @@ MODULE_AUTHOR(DRV_AUTHOR);
 MODULE_DESCRIPTION("Sun HappyMealEthernet(HME) 10/100baseT ethernet driver");
 MODULE_LICENSE("GPL");
 
-static int macaddr[6];
-
-/* accept MAC address of the form macaddr=0x08,0x00,0x20,0x30,0x40,0x50 */
-module_param_array(macaddr, int, NULL, 0);
-MODULE_PARM_DESC(macaddr, "Happy Meal MAC address to set");
-
 #ifdef CONFIG_SBUS
 static struct quattro *qfe_sbus_list;
 #endif
@@ -2631,8 +2623,9 @@ static int __devinit happy_meal_sbus_probe_one(struct platform_device *op, int i
 	struct quattro *qp = NULL;
 	struct happy_meal *hp;
 	struct net_device *dev;
-	int i, qfe_slot = -1;
+	int i, len, qfe_slot = -1;
 	int err = -ENODEV;
+	const unsigned char *addr;
 
 	sbus_dp = op->dev.parent->of_node;
 
@@ -2660,28 +2653,12 @@ static int __devinit happy_meal_sbus_probe_one(struct platform_device *op, int i
 	if (hme_version_printed++ == 0)
 		printk(KERN_INFO "%s", version);
 
-	/* If user did not specify a MAC address specifically, use
-	 * the Quattro local-mac-address property...
-	 */
-	for (i = 0; i < 6; i++) {
-		if (macaddr[i] != 0)
-			break;
-	}
-	if (i < 6) { /* a mac address was given */
-		for (i = 0; i < 6; i++)
-			dev->dev_addr[i] = macaddr[i];
-		macaddr[5]++;
-	} else {
-		const unsigned char *addr;
-		int len;
-
-		addr = of_get_property(dp, "local-mac-address", &len);
 
-		if (qfe_slot != -1 && addr && len == 6)
-			memcpy(dev->dev_addr, addr, 6);
-		else
-			memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
-	}
+	addr = of_get_property(dp, "local-mac-address", &len);
+	if (qfe_slot != -1 && addr && len == 6)
+		memcpy(dev->dev_addr, addr, 6);
+	else
+		memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
 
 	hp = netdev_priv(dev);
 
@@ -2945,9 +2922,10 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev,
 	struct net_device *dev;
 	void __iomem *hpreg_base;
 	unsigned long hpreg_res;
-	int i, qfe_slot = -1;
+	int i, len, qfe_slot = -1;
 	char prom_name[64];
 	int err;
+	const unsigned char *addr;
 
 	/* Now make sure pci_dev cookie is there. */
 #ifdef CONFIG_SPARC
@@ -3018,31 +2996,16 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev,
 		goto err_out_free_res;
 	}
 
-	for (i = 0; i < 6; i++) {
-		if (macaddr[i] != 0)
-			break;
-	}
-	if (i < 6) { /* a mac address was given */
-		for (i = 0; i < 6; i++)
-			dev->dev_addr[i] = macaddr[i];
-		macaddr[5]++;
-	} else {
 #ifdef CONFIG_SPARC
-		const unsigned char *addr;
-		int len;
-
-		if (qfe_slot != -1 &&
-		    (addr = of_get_property(dp, "local-mac-address", &len))
-			!= NULL &&
-		    len == 6) {
-			memcpy(dev->dev_addr, addr, 6);
-		} else {
-			memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
-		}
+	if (qfe_slot != -1 &&
+	    (addr = of_get_property(dp, "local-mac-address", &len)) != NULL &&
+	    len == 6)
+		memcpy(dev->dev_addr, addr, 6);
+	else
+		memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
 #else
-		get_hme_mac_nonsparc(pdev, &dev->dev_addr[0]);
+	get_hme_mac_nonsparc(pdev, &dev->dev_addr[0]);
 #endif
-	}
 
 	/* Layout registers. */
 	hp->gregs      = (hpreg_base + 0x0000UL);
-- 
1.7.9.5

  parent reply	other threads:[~2012-10-23 17:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-23 17:15 [PATCH 0/6] kernel parameters: introduce "macaddr" to set mac address Paolo Pisati
2012-10-23 17:15 ` [PATCH 1/6] macaddr kernel bootargs implementation Paolo Pisati
2012-10-23 17:15 ` [PATCH 2/6] stmmac: remove mac address handling as a module parameter Paolo Pisati
2012-10-23 17:15 ` [PATCH 3/6] ksz884x: " Paolo Pisati
2012-10-23 17:15 ` [PATCH 4/6] greth: " Paolo Pisati
2012-10-23 17:15 ` Paolo Pisati [this message]
2012-10-23 17:15 ` [PATCH 6/6] fec: " Paolo Pisati
2012-10-23 17:20 ` [PATCH 0/6] kernel parameters: introduce "macaddr" to set mac address David Miller
2012-10-24  8:07   ` Paolo Pisati

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=1351012533-3524-6-git-send-email-p.pisati@gmail.com \
    --to=p.pisati@gmail.com \
    --cc=kristoffer@gaisler.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.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;
as well as URLs for NNTP newsgroup(s).