From patchwork Fri May 13 11:15:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 9090501 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6B7989F441 for ; Fri, 13 May 2016 11:17:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8E3542024C for ; Fri, 13 May 2016 11:17:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5E7902021A for ; Fri, 13 May 2016 11:17:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752552AbcEMLRB (ORCPT ); Fri, 13 May 2016 07:17:01 -0400 Received: from mailout2.hostsharing.net ([83.223.90.233]:42794 "EHLO mailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751625AbcEMLRA (ORCPT ); Fri, 13 May 2016 07:17:00 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mailout2.hostsharing.net (Postfix) with ESMTPS id 39E5D1017130E; Fri, 13 May 2016 13:16:58 +0200 (CEST) Received: from localhost (6-38-90-81.adsl.cmo.de [81.90.38.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id 03F84603E03D; Fri, 13 May 2016 13:16:56 +0200 (CEST) X-Mailbox-Line: From a73a2e066e43e2e9d15d670be52fe920f013e5d1 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Lukas Wunner Date: Fri, 13 May 2016 13:15:31 +0200 Subject: [PATCH v2 06/13] PCI: pciehp: Support runtime pm To: linux-pci@vger.kernel.org, linux-pm@vger.kernel.org Cc: Andreas Noever Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Resume the port for the duration of board_added() and remove_board(). When plugging a device in, the port stays active as long as it has active children. When nothing is plugged in, the port may suspend since hotplug detection continues to work during D3hot. Thus further runtime refs need not be acquired. Signed-off-by: Lukas Wunner --- drivers/pci/hotplug/pciehp_ctrl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 880978b..edf8b0e 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "../pci.h" #include "pciehp.h" @@ -432,7 +433,9 @@ int pciehp_enable_slot(struct slot *p_slot) pciehp_get_latch_status(p_slot, &getstatus); + pm_runtime_get_sync(&ctrl->pcie->port->dev); rc = board_added(p_slot); + pm_runtime_put(&ctrl->pcie->port->dev); if (rc) pciehp_get_latch_status(p_slot, &getstatus); @@ -445,6 +448,7 @@ int pciehp_enable_slot(struct slot *p_slot) int pciehp_disable_slot(struct slot *p_slot) { u8 getstatus = 0; + int rc; struct controller *ctrl = p_slot->ctrl; if (!p_slot->ctrl) @@ -459,7 +463,10 @@ int pciehp_disable_slot(struct slot *p_slot) } } - return remove_board(p_slot); + pm_runtime_get_sync(&ctrl->pcie->port->dev); + rc = remove_board(p_slot); + pm_runtime_put(&ctrl->pcie->port->dev); + return rc; } int pciehp_sysfs_enable_slot(struct slot *p_slot)