From patchwork Sat Mar 12 22:51:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Green X-Patchwork-Id: 534 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:43:24 -0000 Delivered-To: patches@linaro.org Received: by 10.224.45.75 with SMTP id d11cs13761qaf; Sat, 12 Mar 2011 14:51:13 -0800 (PST) Received: by 10.227.60.194 with SMTP id q2mr3963691wbh.63.1299970273001; Sat, 12 Mar 2011 14:51:13 -0800 (PST) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id n33si10971004wei.90.2011.03.12.14.51.12 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 12 Mar 2011 14:51:12 -0800 (PST) Received-SPF: pass (google.com: domain of andy.warmcat.com@googlemail.com designates 74.125.82.50 as permitted sender) client-ip=74.125.82.50; Authentication-Results: mx.google.com; spf=pass (google.com: domain of andy.warmcat.com@googlemail.com designates 74.125.82.50 as permitted sender) smtp.mail=andy.warmcat.com@googlemail.com; dkim=pass (test mode) header.i=@googlemail.com Received: by mail-ww0-f50.google.com with SMTP id 33so4669225wwc.31 for ; Sat, 12 Mar 2011 14:51:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:sender:from:subject:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version:content-type :content-transfer-encoding; bh=lMwvkeM7OfSPD+5p15b4nLXjhENJPu5JBgUAQYpuomE=; b=D3gEptLS85Sry/RUQIFV4EvT6HYkHzfoJ1hGiFV3n1OfjU8pZpPRJSXkasQm22p+Jl eJ+wNvSC3YuJRruu0FcbuUCuQWzSfXlvl31YuQLgPoAEbhbUy0U3uLq6XkPsfsToq5T3 Fz3Tl40bC775plUNgL6flmomwm1IOmQPJOrzc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=sender:from:subject:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; b=d0g+cdlCcDHajPFKlT0vHbIr71IdQ95PYvcC5Y2CoDGEbuQSJLjaJbdQPaPMHVzY3G DuLGzlVuBJRM65XO5h+gciJj2Zvi4lKl7ypKSEH4R/3ykMxt5hECDgLTmmCJqE6TPWWn 42rkxxV4QoPglTXs3BiFqfEGtfjR6//pBESOE= Received: by 10.216.25.136 with SMTP id z8mr847121wez.93.1299970272252; Sat, 12 Mar 2011 14:51:12 -0800 (PST) Received: from otae.warmcat.com (s15404224.onlinehome-server.info [87.106.134.80]) by mx.google.com with ESMTPS id h39sm2975606wes.5.2011.03.12.14.51.11 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 12 Mar 2011 14:51:11 -0800 (PST) Sender: Andy Green From: Andy Green Subject: [RFC PATCH 5/5] USBNET: SMSC95XX: if mac set in platform data no need for random one To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: patches@linaro.org, Steve Glendinning , Andy Green Date: Sat, 12 Mar 2011 22:51:09 +0000 Message-ID: <20110312225109.27728.88417.stgit@otae.warmcat.com> In-Reply-To: <20110312224440.27728.60593.stgit@otae.warmcat.com> References: <20110312224440.27728.60593.stgit@otae.warmcat.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 This is part of an RFC patch series introducing asynchronous platform data, which may be attached to discovered bus devices at probe time based on the device path. As part of the series, platform_data is enabled in usbnet layer. This patch allows smsc95xx usbnet driver to understand that the MAC setting was handled by plaform_data sent into usbnet, and that it does not need to overwrite the already correct MAC with a random one. Cc: Steve Glendinning Signed-off-by: Andy Green --- drivers/net/usb/smsc95xx.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index bc86f4b..1d09cad 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -639,6 +639,16 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) static void smsc95xx_init_mac_address(struct usbnet *dev) { + struct usbnet_platform_data *pdata = dev->udev->dev.platform_data; + + /* + * if netdev platform data has taken responsibility for forcing + * the MAC then nothing to do here + */ + + if (pdata && pdata->flags & USBNET_PLATDATA_FLAG__USE_MAC) + return; + /* try reading mac address from EEPROM */ if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, dev->net->dev_addr) == 0) {