From patchwork Mon Jan 13 22:26:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 3481091 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CF53EC02DC for ; Mon, 13 Jan 2014 22:26:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 88F9A20172 for ; Mon, 13 Jan 2014 22:26:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB44D20161 for ; Mon, 13 Jan 2014 22:26:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751423AbaAMW0x (ORCPT ); Mon, 13 Jan 2014 17:26:53 -0500 Received: from mga09.intel.com ([134.134.136.24]:5274 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751924AbaAMW0e (ORCPT ); Mon, 13 Jan 2014 17:26:34 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 13 Jan 2014 14:22:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,655,1384329600"; d="scan'208";a="438263402" Received: from dcgshare.lm.intel.com ([10.232.118.254]) by orsmga001.jf.intel.com with ESMTP; 13 Jan 2014 14:26:33 -0800 Received: by dcgshare.lm.intel.com (Postfix, from userid 1017) id 3348BE00EA; Mon, 13 Jan 2014 15:26:33 -0700 (MST) From: Keith Busch To: linux-pci@vger.kernel.org, alex.williamson@redhat.com, bhelgaas@google.com Cc: Keith Busch Subject: [PATCHv2 1/2] PCI: call pci reset callback to pci_driver on FLR Date: Mon, 13 Jan 2014 15:26:27 -0700 Message-Id: <1389651988-27392-2-git-send-email-keith.busch@intel.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1389651988-27392-1-git-send-email-keith.busch@intel.com> References: <1389651988-27392-1-git-send-email-keith.busch@intel.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 A user can issue a pci function level reset to a device using sysfs entry /sys/bus/pci/devices/.../reset. A kernel driver handling the pci device probably would like to know that such a reset has occured, so this patch calls the pci_driver's slot_reset pci_error_handler. Signed-off-by: Keith Busch --- drivers/pci/pci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b127fbda..1bfddc5 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3584,6 +3584,12 @@ int pci_reset_function(struct pci_dev *dev) pci_dev_restore(dev); + if (!rc) { + const struct pci_error_handlers *err_handler = dev->driver ? + dev->driver->err_handler : NULL; + if (err_handler && err_handler->slot_reset) + err_handler->slot_reset(dev); + } return rc; } EXPORT_SYMBOL_GPL(pci_reset_function);