From patchwork Thu Nov 9 20:46:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oza Pawandeep X-Patchwork-Id: 10051857 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0DB9A60632 for ; Thu, 9 Nov 2017 20:47:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3C152B0F7 for ; Thu, 9 Nov 2017 20:47:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8CD62B115; Thu, 9 Nov 2017 20:47:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DF932B111 for ; Thu, 9 Nov 2017 20:47:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751348AbdKIUrS (ORCPT ); Thu, 9 Nov 2017 15:47:18 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:60768 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133AbdKIUrR (ORCPT ); Thu, 9 Nov 2017 15:47:17 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 24EF160818; Thu, 9 Nov 2017 20:47:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1510260437; bh=zom8DpUt16vqlqjGyL5y4smtYbWYKkhjLk/lYnEeP0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B+m6OClgc1JQ3d3y6uaI5L+p2dsnVXtSwxInegtlTnzUcuZjr949yF4hgZvHJmhB1 /zjaZJ85pgJ1vHBpiF4NDHQWn70haX/CXfInVfDWfyC8f3kMO8cpYGCgQeTsmkK+hy ODcW/XJfewrOl7Vvle2AmxB53Yh20qLWHYT5jikI= Received: from blr-ubuntu-poza.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: poza@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 49CA460818; Thu, 9 Nov 2017 20:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1510260436; bh=zom8DpUt16vqlqjGyL5y4smtYbWYKkhjLk/lYnEeP0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BuY+Z7B6ce06vaFw6KHdapRZvKkrrNnwoY7CBjfyGZblL9lSB+QBUPKcxz2u9+NhF ua3uflnmAhwiuvJZxW27SK0zQYo21oNxp8Hlv8EaZtl0cTjP9/y5ZKxBgdS+b4RBGk wfsvjmVabcU+aYuvojJxsyqV6O+3lglSZ3V1rbqI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 49CA460818 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=poza@codeaurora.org From: Pawandeep Oza To: linux-pci@vger.kernel.org, timur@codeaurora.org Cc: Bjorn Helgaas , Dongdong Liu , Gabriele Paoloni , Thomas Gleixner , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Oza Pawandeep Subject: [PATCH 2/4] PCI/portdrv: Add/Remove port services to the list Date: Fri, 10 Nov 2017 02:16:37 +0530 Message-Id: <1510260399-14886-3-git-send-email-poza@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1510260399-14886-1-git-send-email-poza@codeaurora.org> References: <1510260399-14886-1-git-send-email-poza@codeaurora.org> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Oza Pawandeep This patch adds and removes the port service to the service list. Signed-off-by: Oza Pawandeep diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index a592103..6bfe986 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -454,6 +454,8 @@ static int pcie_port_probe_service(struct device *dev) if (status) return status; + list_add_tail(&pciedev->slist, &pciedev->port->service_list); + get_device(dev); return 0; } @@ -477,6 +479,9 @@ static int pcie_port_remove_service(struct device *dev) pciedev = to_pcie_device(dev); driver = to_service_driver(dev->driver); + + list_del(&pciedev->slist); + if (driver && driver->remove) { driver->remove(pciedev); put_device(dev); diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h index b69769d..9d05621 100644 --- a/include/linux/pcieport_if.h +++ b/include/linux/pcieport_if.h @@ -31,6 +31,7 @@ struct pcie_device { u32 service; /* Port service this device represents */ void *priv_data; /* Service Private Data */ struct device device; /* Generic Device Interface */ + struct list_head slist; /* List of services */ }; #define to_pcie_device(d) container_of(d, struct pcie_device, device)