From patchwork Tue Oct 23 02:40:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 193315 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id A83672C0109 for ; Tue, 23 Oct 2012 13:42:13 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C1E144A250; Tue, 23 Oct 2012 04:41:50 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E0UfRlrf5-CN; Tue, 23 Oct 2012 04:41:50 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CEC8D4A261; Tue, 23 Oct 2012 04:41:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 267444A21C for ; Tue, 23 Oct 2012 04:41:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iJta2Rw+UvV2 for ; Tue, 23 Oct 2012 04:41:02 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by theia.denx.de (Postfix) with ESMTPS id 39B8D4A22A for ; Tue, 23 Oct 2012 04:40:55 +0200 (CEST) Received: by mail-pb0-f44.google.com with SMTP id ro8so84647pbb.3 for ; Mon, 22 Oct 2012 19:40:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=64YpfJAGsZXh2WcYfI5qvJcy7aX4H94ZXo1W0rBbEAI=; b=kPdnniYseDxpaPGbxPTW6dkKlDxSZViDvE1XVqzpJSHtCtNKxo/LdJX3QkaZM9HHSG WXYsxOxUow3wVEOO8l81l2lbh1ukgYqiP7LetjbzR8o1jkSBXm4LZ4i7YRnywEpHRtWI 4Vj6/acEaQQXfLOpYHbPSPBmb+sWB/z38Z9VLbQaTkXZKhXNylcBkcDb+gBfO8LfqO7U SxgNb25bAsqDWWggto5h62WHXXYKpb9zEOzydDmDHKfdtsj3Y2AmFejRaffO/nTTvv1Z zEZHj6prMirtO8nQCPb9++CLT+Jz7xpj76rHYewH/WHyefcGX9YpQ84bPg3l3co7fYoK z8Ag== Received: by 10.66.72.134 with SMTP id d6mr31184166pav.13.1350960053094; Mon, 22 Oct 2012 19:40:53 -0700 (PDT) Received: from officeserver-2 ([70.96.116.236]) by mx.google.com with ESMTPS id rw5sm6873618pbc.54.2012.10.22.19.40.49 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Oct 2012 19:40:51 -0700 (PDT) Received: from tkisky by officeserver-2 with local (Exim 4.76) (envelope-from ) id 1TQUQj-00066T-9n; Mon, 22 Oct 2012 19:41:21 -0700 From: Troy Kisky To: u-boot@lists.denx.de, Joe Hershberger , sbabic@denx.de, dirk.behme@googlemail.com Date: Mon, 22 Oct 2012 19:40:44 -0700 Message-Id: <1350960047-23404-7-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1350960047-23404-1-git-send-email-troy.kisky@boundarydevices.com> References: <1345502918-18305-1-git-send-email-troy.kisky@boundarydevices.com> <1350960047-23404-1-git-send-email-troy.kisky@boundarydevices.com> X-Gm-Message-State: ALoCoQkxSR8qCzd7Id6sZo2VfGcrqK37iCCitspJt9zYxilBcLFbSX7PBghWEXPaotkf+RnnlrRK Cc: afleming@gmail.com Subject: [U-Boot] [PATCH V3 6/9] net: fec_mxc: use fec_set_dev_name to set name X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This allows us to create the phydev before calling fec_probe in later patch. Signed-off-by: Troy Kisky --- drivers/net/fec_mxc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index f7384ad..7e27210 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -915,6 +915,11 @@ static int fec_recv(struct eth_device *dev) return len; } +static void fec_set_dev_name(char *dest, int dev_id) +{ + sprintf(dest, (dev_id == -1) ? "FEC" : "FEC%i", dev_id); +} + static int fec_probe(bd_t *bd, int dev_id, int phy_id, uint32_t base_addr) { struct eth_device *edev; @@ -967,13 +972,8 @@ static int fec_probe(bd_t *bd, int dev_id, int phy_id, uint32_t base_addr) fec_reg_setup(fec); - if (dev_id == -1) { - sprintf(edev->name, "FEC"); - fec->dev_id = 0; - } else { - sprintf(edev->name, "FEC%i", dev_id); - fec->dev_id = dev_id; - } + fec_set_dev_name(edev->name, dev_id); + fec->dev_id = (dev_id == -1) ? 0 : dev_id; fec->phy_id = phy_id; bus = mdio_alloc(); @@ -984,7 +984,7 @@ static int fec_probe(bd_t *bd, int dev_id, int phy_id, uint32_t base_addr) } bus->read = fec_phy_read; bus->write = fec_phy_write; - sprintf(bus->name, edev->name); + fec_set_dev_name(bus->name, dev_id); #ifdef CONFIG_MX28 /* * The i.MX28 has two ethernet interfaces, but they are not equal.