diff mbox

net: fec: Remove macaddr option

Message ID 1328289904-22401-1-git-send-email-fabio.estevam@freescale.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Fabio Estevam Feb. 3, 2012, 5:25 p.m. UTC
"macaddr" option allows users to pass the MAC address via kernel command line.

Feedbacks from Alan Cox and David Miller (http://www.spinics.net/lists/linux-usb/msg57821.html )
mention that this is not a good idea, so remove it.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/net/ethernet/freescale/fec.c |   37 ++++++++++-----------------------
 1 files changed, 11 insertions(+), 26 deletions(-)

Comments

David Miller Feb. 4, 2012, 9:29 p.m. UTC | #1
From: Fabio Estevam <fabio.estevam@freescale.com>
Date: Fri, 3 Feb 2012 15:25:04 -0200

> "macaddr" option allows users to pass the MAC address via kernel command line.
> 
> Feedbacks from Alan Cox and David Miller (http://www.spinics.net/lists/linux-usb/msg57821.html )
> mention that this is not a good idea, so remove it.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Whilst we can prevent new additions of such module options, you can't
just go and remove them from existing drivers without potentially
breaking things for people.

In this FEC case, the option was added more than a year ago.

I'm not applying this patch.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Paul Gortmaker Feb. 5, 2012, 10:18 p.m. UTC | #2
On Sat, Feb 4, 2012 at 4:29 PM, David Miller <davem@davemloft.net> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> Date: Fri, 3 Feb 2012 15:25:04 -0200
>
>> "macaddr" option allows users to pass the MAC address via kernel command line.
>>
>> Feedbacks from Alan Cox and David Miller (http://www.spinics.net/lists/linux-usb/msg57821.html )
>> mention that this is not a good idea, so remove it.
>>
>> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
>
> Whilst we can prevent new additions of such module options, you can't
> just go and remove them from existing drivers without potentially
> breaking things for people.
>
> In this FEC case, the option was added more than a year ago.
>
> I'm not applying this patch.

How about a patch to feature-removal-schedule.txt instead?  I don't
know Fabio from a bar of soap, but to his credit, it seems he has been
paying attention to recent netdev threads, and is trying to improve things
based on what he has seen recently -- even if he's not aware of the
general linux intent to not break things that worked in the past.

Most of these "create MAC at random" threads are supported by people
pointing at existing instances, and making the common mistake of thinking
that crimes of the past justify similar crimes in the present.  (Hint - no they
do not.)   So to that end, removing another instance is probably good -- if it
is communicated in advance...  even if delayed via feature-removal.

To my knowledge, the platforms using FEC are pretty limited, and if the
folks at Freescale want to remove the MAC setting option, then great.

Paul.

> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Feb. 5, 2012, 10:41 p.m. UTC | #3
From: Paul Gortmaker <paul.gortmaker@windriver.com>
Date: Sun, 5 Feb 2012 17:18:36 -0500

> On Sat, Feb 4, 2012 at 4:29 PM, David Miller <davem@davemloft.net> wrote:
>> From: Fabio Estevam <fabio.estevam@freescale.com>
>> Date: Fri, 3 Feb 2012 15:25:04 -0200
>>
>>> "macaddr" option allows users to pass the MAC address via kernel command line.
>>>
>>> Feedbacks from Alan Cox and David Miller (http://www.spinics.net/lists/linux-usb/msg57821.html )
>>> mention that this is not a good idea, so remove it.
>>>
>>> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
>>
>> Whilst we can prevent new additions of such module options, you can't
>> just go and remove them from existing drivers without potentially
>> breaking things for people.
>>
>> In this FEC case, the option was added more than a year ago.
>>
>> I'm not applying this patch.
> 
> How about a patch to feature-removal-schedule.txt instead?

No.

--
To unsubscribe from this list: send the line "unsubscribe netdev" 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

diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index e5885cc..560c3c7 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -114,10 +114,6 @@  static const struct of_device_id fec_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, fec_dt_ids);
 
-static unsigned char macaddr[ETH_ALEN];
-module_param_array(macaddr, byte, NULL, 0);
-MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
-
 #if defined(CONFIG_M5272)
 /*
  * Some hardware gets it MAC address out of local flash memory.
@@ -795,31 +791,24 @@  static void __inline__ fec_get_mac(struct net_device *ndev)
 	struct fec_enet_private *fep = netdev_priv(ndev);
 	struct fec_platform_data *pdata = fep->pdev->dev.platform_data;
 	unsigned char *iap, tmpaddr[ETH_ALEN];
-
-	/*
-	 * try to get mac address in following order:
-	 *
-	 * 1) module parameter via kernel command line in form
-	 *    fec.macaddr=0x00,0x04,0x9f,0x01,0x30,0xe0
-	 */
-	iap = macaddr;
+	iap = tmpaddr;
 
 #ifdef CONFIG_OF
 	/*
-	 * 2) from device tree data
+	 * try to get mac address in the following order:
+	 *
+	 * 1) from device tree data
 	 */
-	if (!is_valid_ether_addr(iap)) {
-		struct device_node *np = fep->pdev->dev.of_node;
-		if (np) {
-			const char *mac = of_get_mac_address(np);
-			if (mac)
-				iap = (unsigned char *) mac;
-		}
+	struct device_node *np = fep->pdev->dev.of_node;
+	if (np) {
+		const char *mac = of_get_mac_address(np);
+		if (mac)
+			iap = (unsigned char *) mac;
 	}
 #endif
 
 	/*
-	 * 3) from flash or fuse (via platform data)
+	 * 2) from flash or fuse (via platform data)
 	 */
 	if (!is_valid_ether_addr(iap)) {
 #ifdef CONFIG_M5272
@@ -832,7 +821,7 @@  static void __inline__ fec_get_mac(struct net_device *ndev)
 	}
 
 	/*
-	 * 4) FEC mac registers set by bootloader
+	 * 3) FEC mac registers set by bootloader
 	 */
 	if (!is_valid_ether_addr(iap)) {
 		*((unsigned long *) &tmpaddr[0]) =
@@ -843,10 +832,6 @@  static void __inline__ fec_get_mac(struct net_device *ndev)
 	}
 
 	memcpy(ndev->dev_addr, iap, ETH_ALEN);
-
-	/* Adjust MAC if using macaddr */
-	if (iap == macaddr)
-		 ndev->dev_addr[ETH_ALEN-1] = macaddr[ETH_ALEN-1] + fep->dev_id;
 }
 
 /* ------------------------------------------------------------------------- */