From patchwork Fri Apr 27 15:16:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 155522 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A2AC5B6FA5 for ; Sat, 28 Apr 2012 01:25:58 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760480Ab2D0PUI (ORCPT ); Fri, 27 Apr 2012 11:20:08 -0400 Received: from mail-pz0-f51.google.com ([209.85.210.51]:38951 "EHLO mail-pz0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760473Ab2D0PUG (ORCPT ); Fri, 27 Apr 2012 11:20:06 -0400 Received: by dadz8 with SMTP id z8so1147938dad.10 for ; Fri, 27 Apr 2012 08:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=OHbUjd5sxXm3wkNOVZ7Fnzz/+FYqqH/MgIGRhIWX60w=; b=E7ZsI1cdfT2uOmOW67I+YgQx6HeJLy7KSADfBIi3Oo5Gbhyj+VCU5z28sWzQpAEmxJ SFQu3ji2SdUaxeUsVNAEg9qAWFrewPrqGSBtOZ53KmpJh3uDS+IgAh7Brm7jSJYyz2v3 RTE0gB0/hlKlPCePjhMbz6ck8UCdV5BD5NepxUdjC4Ml77pNT2expw0xtwtQ7wG5CYVt 01bSIk1PxtCmNUFpjvPLbsMdIAFIiuQdS9oHAQpZ1tpWFO0h6LPZfmhvpnOLFtsL6Few 5pGWxGL1gyPS0ECO1bv+Onwol+3JoOlkR+/fJ9Nxg9BhsdbL0FknxLZ/AuL/JuqQlp1s w8vA== Received: by 10.68.233.37 with SMTP id tt5mr1657657pbc.104.1335540005473; Fri, 27 Apr 2012 08:20:05 -0700 (PDT) Received: from localhost.localdomain ([221.221.26.142]) by mx.google.com with ESMTPS id 2sm6743917pbw.57.2012.04.27.08.19.56 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Apr 2012 08:20:04 -0700 (PDT) From: Jiang Liu To: Yinghai Lu , Kenji Kaneshige , Bjorn Helgaas , Don Dutile , Greg KH Cc: Jiang Liu , Keping Chen , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Jiang Liu Subject: [PATCH v2 01/19] PCI: introduce pci_bus_get()/pci_bus_put() to hide PCI implementation details Date: Fri, 27 Apr 2012 23:16:42 +0800 Message-Id: <1335539820-11232-2-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1335539820-11232-1-git-send-email-jiang.liu@huawei.com> References: <1335539820-11232-1-git-send-email-jiang.liu@huawei.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Jiang Liu Introduce pci_bus_get()/pci_bus_put() to hide PCI implementation details. Signed-off-by: Jiang Liu --- drivers/pci/bus.c | 15 +++++++++++++++ include/linux/pci.h | 2 ++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 4ce5ef2..50f9c5d 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -35,6 +35,21 @@ void pci_add_resource_offset(struct list_head *resources, struct resource *res, } EXPORT_SYMBOL(pci_add_resource_offset); +struct pci_bus *pci_bus_get(struct pci_bus *bus) +{ + if (bus) + get_device(&bus->dev); + return bus; +} +EXPORT_SYMBOL(pci_bus_get); + +void pci_bus_put(struct pci_bus *bus) +{ + if (bus) + put_device(&bus->dev); +} +EXPORT_SYMBOL(pci_bus_put); + void pci_add_resource(struct list_head *resources, struct resource *res) { pci_add_resource_offset(resources, res, 0); diff --git a/include/linux/pci.h b/include/linux/pci.h index e444f5b..0603a60 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -912,6 +912,8 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *); void pci_release_selected_regions(struct pci_dev *, int); /* drivers/pci/bus.c */ +struct pci_bus *pci_bus_get(struct pci_bus *bus); +void pci_bus_put(struct pci_bus *bus); void pci_add_resource(struct list_head *resources, struct resource *res); void pci_add_resource_offset(struct list_head *resources, struct resource *res, resource_size_t offset);