From patchwork Wed Nov 25 12:04:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kenji Kaneshige X-Patchwork-Id: 62761 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAPC3VeA016032 for ; Wed, 25 Nov 2009 12:04:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758726AbZKYMEo (ORCPT ); Wed, 25 Nov 2009 07:04:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758743AbZKYMEo (ORCPT ); Wed, 25 Nov 2009 07:04:44 -0500 Received: from fgwmail7.fujitsu.co.jp ([192.51.44.37]:59962 "EHLO fgwmail7.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758726AbZKYMEn (ORCPT ); Wed, 25 Nov 2009 07:04:43 -0500 Received: from m5.gw.fujitsu.co.jp ([10.0.50.75]) by fgwmail7.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id nAPC4nth001320 for (envelope-from kaneshige.kenji@jp.fujitsu.com); Wed, 25 Nov 2009 21:04:49 +0900 Received: from smail (m5 [127.0.0.1]) by outgoing.m5.gw.fujitsu.co.jp (Postfix) with ESMTP id 38D1845DE51 for ; Wed, 25 Nov 2009 21:04:49 +0900 (JST) Received: from s5.gw.fujitsu.co.jp (s5.gw.fujitsu.co.jp [10.0.50.95]) by m5.gw.fujitsu.co.jp (Postfix) with ESMTP id 0CEC445DE4E for ; Wed, 25 Nov 2009 21:04:49 +0900 (JST) Received: from s5.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s5.gw.fujitsu.co.jp (Postfix) with ESMTP id E88491DB803C for ; Wed, 25 Nov 2009 21:04:48 +0900 (JST) Received: from m108.s.css.fujitsu.com (m108.s.css.fujitsu.com [10.249.87.108]) by s5.gw.fujitsu.co.jp (Postfix) with ESMTP id A292D1DB8038 for ; Wed, 25 Nov 2009 21:04:48 +0900 (JST) Received: from m108.css.fujitsu.com (m108 [127.0.0.1]) by m108.s.css.fujitsu.com (Postfix) with ESMTP id 7A3ED428057; Wed, 25 Nov 2009 21:04:48 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.100.137]) by m108.s.css.fujitsu.com (Postfix) with ESMTP id 277A2428054; Wed, 25 Nov 2009 21:04:48 +0900 (JST) X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Received: from KANE-LIFEBOOK[10.124.100.137] by KANE-LIFEBOOK (FujitsuOutboundMailChecker v1.3.1/9992[10.124.100.137]); Wed, 25 Nov 2009 21:04:34 +0900 (JST) Message-ID: <4B0D1D4E.3090709@jp.fujitsu.com> Date: Wed, 25 Nov 2009 21:04:30 +0900 From: Kenji Kaneshige User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: linux-pci@vger.kernel.org, jbarnes@virtuousgeek.org Subject: [PATCH 7/11] portdrv: enable device before irq initialization References: <4B0D1C19.8060201@jp.fujitsu.com> In-Reply-To: <4B0D1C19.8060201@jp.fujitsu.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Index: 20091125/drivers/pci/pcie/portdrv_core.c =================================================================== --- 20091125.orig/drivers/pci/pcie/portdrv_core.c +++ 20091125/drivers/pci/pcie/portdrv_core.c @@ -302,6 +302,12 @@ int pcie_port_device_register(struct pci port_data->port_type = dev->pcie_type; pci_set_drvdata(dev, port_data); + /* Enable PCI Express port device */ + status = pci_enable_device(dev); + if (status) + goto error_kfree; + pci_set_master(dev); + /* * Initialize service irqs. Don't use service devices that * require interrupts if there is no way to generate them. @@ -310,14 +316,9 @@ int pcie_port_device_register(struct pci if (status) { capabilities &= PCIE_PORT_SERVICE_VC; if (!capabilities) - goto Error; + goto error_disable; } - status = pci_enable_device(dev); - if (status) - goto Error; - pci_set_master(dev); - /* Allocate child services if any */ for (i = 0, nr_serv = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { int service = 1 << i; @@ -330,14 +331,14 @@ int pcie_port_device_register(struct pci nr_serv++; } if (!nr_serv) { - pci_disable_device(dev); status = -ENODEV; - goto Error; + goto error_disable; } - return 0; - Error: +error_disable: + pci_disable_device(dev); +error_kfree: kfree(port_data); return status; }