From patchwork Wed Sep 23 17:37:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 54072 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 8D44B22E14 for ; Wed, 23 Sep 2015 17:38:55 +0000 (UTC) Received: by wisv5 with SMTP id v5sf28648337wis.0 for ; Wed, 23 Sep 2015 10:38:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=G4GCuZ8TEF7lACoGTsX3z1C4zXG3rf0gJr0Xa6QpOJo=; b=ap8au1yLcz+HJfQ813m9poybnruxdcLfWaqngSHQqdvlTyBWantPSTkPXo5YnVhpuL G2yD+UiYa6UHroGpFmXVQroQARo1mhlCFXdF3cN+oTb1FTbaaKM/vVkgtdLnxQhbu5yr meTJndfKiyCfvv3W944gGe1tKEeB8n1p87Na4OC0+R/oSfG3rxQSzeN0fp+5Hz90wWNr cxd9G9K/J0QcD1GHKSp90Nc/3xlOQMb8EH3VWZfppaYTs5dZXxbjc4IvWpza0EUy5zD5 xHhzFeA3GBWP8ianBL8JKhwzRK9pqXnb/px90PTrom0dJvCZDUvuks5ewGfz1+dTpiFB iPQA== X-Gm-Message-State: ALoCoQmu9HdBNuMn13mvZn/Br/gWXF0M3Fw7Ru2T071gka2SD7AR55grMH3458j1QTr3pofq99Tl X-Received: by 10.112.138.170 with SMTP id qr10mr3489499lbb.4.1443029934858; Wed, 23 Sep 2015 10:38:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.20.230 with SMTP id 99ls142239lfu.32.gmail; Wed, 23 Sep 2015 10:38:54 -0700 (PDT) X-Received: by 10.112.140.232 with SMTP id rj8mr11875736lbb.2.1443029934690; Wed, 23 Sep 2015 10:38:54 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id e2si4546796lae.170.2015.09.23.10.38.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Sep 2015 10:38:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lagj9 with SMTP id j9so59842667lag.2 for ; Wed, 23 Sep 2015 10:38:54 -0700 (PDT) X-Received: by 10.25.211.201 with SMTP id k192mr4314409lfg.32.1443029934559; Wed, 23 Sep 2015 10:38:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp28865lbq; Wed, 23 Sep 2015 10:38:53 -0700 (PDT) X-Received: by 10.68.65.70 with SMTP id v6mr39162412pbs.23.1443029933547; Wed, 23 Sep 2015 10:38:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mk6si12103106pab.21.2015.09.23.10.38.51; Wed, 23 Sep 2015 10:38:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756648AbbIWRiu (ORCPT + 30 others); Wed, 23 Sep 2015 13:38:50 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:39924 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755972AbbIWRg6 (ORCPT ); Wed, 23 Sep 2015 13:36:58 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8NHauIT009739; Wed, 23 Sep 2015 12:36:56 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8NHauHP030093; Wed, 23 Sep 2015 12:36:56 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Wed, 23 Sep 2015 12:36:56 -0500 Received: from ula0868495.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8NHarOU021888; Wed, 23 Sep 2015 12:36:55 -0500 From: Murali Karicheri To: , , , , , CC: Subject: [PATCH 3/7] net: netcp: move netcp_register_interface() to after attach module Date: Wed, 23 Sep 2015 13:37:07 -0400 Message-ID: <1443029831-22035-4-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443029831-22035-1-git-send-email-m-karicheri2@ti.com> References: <1443029831-22035-1-git-send-email-m-karicheri2@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m-karicheri2@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The netcp interface is not fully initialized before attach the module to the interface. For example, the tx pipe/rx pipe is initialized in ethss module as part of attach(). So until this is complete, the interface can't be registered. So move registration of interface to net device outside the current loop that attaches the modules to the interface. Signed-off-by: Murali Karicheri --- drivers/net/ethernet/ti/netcp_core.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c index c0bc4b9..cf693de 100644 --- a/drivers/net/ethernet/ti/netcp_core.c +++ b/drivers/net/ethernet/ti/netcp_core.c @@ -291,13 +291,6 @@ static int netcp_module_probe(struct netcp_device *netcp_device, interface_list) { struct netcp_intf_modpriv *intf_modpriv; - /* If interface not registered then register now */ - if (!netcp_intf->netdev_registered) - ret = netcp_register_interface(netcp_intf); - - if (ret) - return -ENODEV; - intf_modpriv = devm_kzalloc(dev, sizeof(*intf_modpriv), GFP_KERNEL); if (!intf_modpriv) @@ -323,6 +316,18 @@ static int netcp_module_probe(struct netcp_device *netcp_device, continue; } } + + /* Now register the interface with netdev */ + list_for_each_entry(netcp_intf, + &netcp_device->interface_head, + interface_list) { + /* If interface not registered then register now */ + if (!netcp_intf->netdev_registered) { + ret = netcp_register_interface(netcp_intf); + if (ret) + return -ENODEV; + } + } return 0; }