From patchwork Mon Apr 16 16:28:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 152925 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 84F96B700D for ; Tue, 17 Apr 2012 02:32:16 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752082Ab2DPQcP (ORCPT ); Mon, 16 Apr 2012 12:32:15 -0400 Received: from mail-pz0-f52.google.com ([209.85.210.52]:37352 "EHLO mail-pz0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752677Ab2DPQcP (ORCPT ); Mon, 16 Apr 2012 12:32:15 -0400 Received: by mail-pz0-f52.google.com with SMTP id e40so7132053dak.11 for ; Mon, 16 Apr 2012 09:32:15 -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=Q+BZM6ZYlm/TpaTy9G4+kWO9ZQR06q9og+FF/XqOLbI=; b=jNIPbumPsf3UPxOwM4utrEcrEej05igwmxbjhAValcvWm8JQ38Vpuw2Fm3A+XDK6V7 ss8yuJtVH3UvVBEcB04VvKviHDoDUIFmKORm7qyN9/F4Yunc0aEyNFXXyo+v0jFAiMpC LDAiQX1/gNKrTNDYbDGiVrzMitCNcHkuoSKd/q3icrt3+sxoP0KRT2lkpt61p0JAr984 fjl/EomaCCeFCQNKmFPEPZNxDT90gXEAtMjUDHp1vFMfQziMb/BHhyuD8t2Z9eFF0diP 7xmy08XIRLanO6LKeFWrQlhvsSEbQgXhUcpjCE0L5OX5/yIXzwko84bw3FLWctJR/k1R TvoA== Received: by 10.68.195.38 with SMTP id ib6mr28822599pbc.28.1334593935096; Mon, 16 Apr 2012 09:32:15 -0700 (PDT) Received: from localhost.localdomain ([221.221.22.162]) by mx.google.com with ESMTPS id v1sm18106794pbk.10.2012.04.16.09.32.06 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Apr 2012 09:32:12 -0700 (PDT) From: Jiang Liu To: Yinghai Lu , Kenji Kaneshige , Bjorn Helgaas Cc: Jiang Liu , Jiang Liu , Keping Chen , linux-pci@vger.kernel.org Subject: [PATCH RFC 01/17] PCI: introduce pci_bus_get()/pci_bus_put() to hide PCI implementation details Date: Tue, 17 Apr 2012 00:28:55 +0800 Message-Id: <1334593751-5916-2-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1334593751-5916-1-git-send-email-jiang.liu@huawei.com> References: <1334593751-5916-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 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);