From patchwork Wed Feb 5 10:32:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 3585571 Return-Path: X-Original-To: patchwork-linux-acpi@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 D5110C02DC for ; Wed, 5 Feb 2014 10:32:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3BED201C7 for ; Wed, 5 Feb 2014 10:32:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 725F82017B for ; Wed, 5 Feb 2014 10:32:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751368AbaBEKc2 (ORCPT ); Wed, 5 Feb 2014 05:32:28 -0500 Received: from smtp-out002.kontent.com ([81.88.40.216]:49665 "EHLO smtp-out002.kontent.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750980AbaBEKc1 (ORCPT ); Wed, 5 Feb 2014 05:32:27 -0500 Received: from linux-fkkt.site (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: neukum_org@smtp-out002.kontent.com) by smtp-out002.kontent.com (Postfix) with ESMTPSA id 2F08810058694; Wed, 5 Feb 2014 11:32:25 +0100 (CET) From: oliver@neukum.org To: trenn@suse.de, lenb@kernel.org, rjw@rjwysocki.net, linux-acpi@vger.kernel.org Cc: Oliver Neukum Subject: [PATCH] pciehp: Ignore missing surprise bit on some hosts Date: Wed, 5 Feb 2014 11:32:22 +0100 Message-Id: <1391596342-27191-1-git-send-email-oliver@neukum.org> X-Mailer: git-send-email 1.8.4 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.4 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 From: Oliver Neukum Some hosts have an internal card reader which connects or disconnects based on the presence of a medium. Some of those do not correctly advertise a surprise removal capability of those devices. Handling events despite an unannounced capability breaks some other hosts. So a DMI based table is added. Signed-off-by: Oliver Neukum Reviewed-by: Thomas Renninger --- drivers/pci/hotplug/pciehp.h | 3 ++- drivers/pci/hotplug/pciehp_core.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 838f571..e68ce86 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h @@ -44,6 +44,7 @@ extern int pciehp_poll_mode; extern int pciehp_poll_time; extern int pciehp_debug; extern int pciehp_force; +extern bool pciehp_surprise; extern struct workqueue_struct *pciehp_wq; extern struct workqueue_struct *pciehp_ordered_wq; @@ -123,7 +124,7 @@ struct controller { #define MRL_SENS(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_MRLSP) #define ATTN_LED(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_AIP) #define PWR_LED(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_PIP) -#define HP_SUPR_RM(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_HPS) +#define HP_SUPR_RM(ctrl) (pciehp_surprise || (ctrl)->slot_cap & PCI_EXP_SLTCAP_HPS) #define EMI(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_EIP) #define NO_CMD_CMPL(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_NCCS) #define PSN(ctrl) ((ctrl)->slot_cap >> 19) diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 67b6c54..900fb17 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c @@ -36,12 +36,14 @@ #include "pciehp.h" #include #include +#include /* Global variables */ int pciehp_debug; int pciehp_poll_mode; int pciehp_poll_time; int pciehp_force; +bool pciehp_surprise = false; struct workqueue_struct *pciehp_wq; struct workqueue_struct *pciehp_ordered_wq; @@ -349,10 +351,33 @@ static struct dmi_system_id __initdata pcieph_dmi_table[] = { }; MODULE_DEVICE_TABLE(dmi, pcieph_dmi_table); +static struct dmi_system_id __initdata pcieph_dmi_surprise_table[] = { + { + /* HP Probook 445 */ + .ident = "HP ProBook 445", + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook 445 G1"), + }, + }, + { + /* HP Probook 455 */ + .ident = "HP ProBook 455", + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook 455 G1"), + }, + }, + {} /* terminating entry */ +}; + static int __init pcied_init(void) { int retval = 0; + if (dmi_check_system(pcieph_dmi_surprise_table)) { + pciehp_surprise = true; + info(DRIVER_DESC " accepting unannounced surprise event\n"); + } + pciehp_wq = alloc_workqueue("pciehp", 0, 0); if (!pciehp_wq) return -ENOMEM;