From patchwork Sun Jul 29 22:03:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 10548323 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-2.web.codeaurora.org (Postfix) with ESMTP id 8742F14BC for ; Sun, 29 Jul 2018 22:03:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A1A7288DD for ; Sun, 29 Jul 2018 22:03:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EA4228BDF; Sun, 29 Jul 2018 22:03:51 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 19D0F288DD for ; Sun, 29 Jul 2018 22:03:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727565AbeG2Xfu (ORCPT ); Sun, 29 Jul 2018 19:35:50 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:35124 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726835AbeG2Xfu (ORCPT ); Sun, 29 Jul 2018 19:35:50 -0400 Received: by mail-wr1-f65.google.com with SMTP id a3-v6so10678926wrt.2 for ; Sun, 29 Jul 2018 15:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=5rREM2wRF7mL4V/ejc1r6p8IayXtMGdf6OEbsOTl1AM=; b=S+oASW91C2L3Wd1DeLxU5BIFNvtpc6Fkl+18m7TznwivWokzP7nIvmVb7wwh8oJ0uv Lzh3rDKqHhsXj/1fx4JqPp5DQJ94y2FCC0uzP938e+Zw/Y55BFBdbKOS+LsOyXTZl8TX nDgdTlaMH8H//txsFM+HdXt+XiU9hLwCisdqFnTAze3K3keYuK4v4Yn1kPQjiw3sAFxi uWaZ+SkUexr6yEfcUGDXhw4hS0RwSvY/QtVTUzg9OXXTRMVYsGNst2fQ2ebc/bLaOHk6 MaKlTw/dSUq5VueFpuoPJlczz3W+0C9NYMpjqO84qBMWhdFWYEl8n6oAzUhUOZvm6T/D qZzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=5rREM2wRF7mL4V/ejc1r6p8IayXtMGdf6OEbsOTl1AM=; b=Bsqp7ep51RsfCY2ffrNO48u520tx7f5uyRFAtd/IsKOrSCyhioMLh1yIPiMgfbQZpm sevbTZQwOAaW8ojMMDPmcS8yDnmuhYNEbnCXaus+jXYFN2lkZ8eOM8nZz6vDz11Ak3qr 4UtpPVHBeM/WPRiUNn61ZRCEsWW1Oq3C/nZTiXTYhPPF1WXEzXbkCwBk0cRAg85sLlOw ETw3eWw+Tvb8XbWaJKECsn9UyweqXyX1YLX4jlvv6wUGPo7UG4VHCIaey8CauuG4yfkx syCHMRm58nxFAr9DaCBpbFJkS8uMGUT9u8fz8hIFYT7D5DUnxAnJVfXtrnWlYTqNFzog 95jw== X-Gm-Message-State: AOUpUlHKivcym7QqdywCbbThKnUwBpmSRvS907iPQMh2E42EU6oYdVdg wtCsfZPYfynPzdhtDffuQ0ZDhG3C X-Google-Smtp-Source: AAOMgpdr9TieCvhc7SlCZMHXziYFejnlS2VMC4u6N35A9Jl/2EGWxNmJiincPZ2Bp8FkHaDmE+44Dg== X-Received: by 2002:adf:8541:: with SMTP id 59-v6mr14239575wrh.223.1532901828712; Sun, 29 Jul 2018 15:03:48 -0700 (PDT) Received: from ?IPv6:2003:ea:8bd4:d600:658c:bbc9:fe8b:9d71? (p200300EA8BD4D600658CBBC9FE8B9D71.dip0.t-ipconnect.de. [2003:ea:8bd4:d600:658c:bbc9:fe8b:9d71]) by smtp.googlemail.com with ESMTPSA id c10-v6sm9880146wrs.6.2018.07.29.15.03.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Jul 2018 15:03:48 -0700 (PDT) To: Bjorn Helgaas Cc: "linux-pci@vger.kernel.org" From: Heiner Kallweit Subject: [PATCH] PCI: let pci_request_irq properly deal with threaded interrupts Message-ID: Date: Mon, 30 Jul 2018 00:03:42 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Language: en-US 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 If we have a threaded interrupt with the handler being NULL, then request_threaded_irq() -> __setup_irq() will complain and bail out if the IRQF_ONESHOT flag isn't set. Therefore check for the handler being NULL and set IRQF_ONESHOT in this case. This change is needed to migrate the mei_me driver to pci_alloc_irq_vectors() and pci_request_irq(). Signed-off-by: Heiner Kallweit --- drivers/pci/irq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/irq.c b/drivers/pci/irq.c index 2a808e10..a1de501a 100644 --- a/drivers/pci/irq.c +++ b/drivers/pci/irq.c @@ -86,13 +86,17 @@ int pci_request_irq(struct pci_dev *dev, unsigned int nr, irq_handler_t handler, va_list ap; int ret; char *devname; + unsigned long irqflags = IRQF_SHARED; + + if (!handler) + irqflags |= IRQF_ONESHOT; va_start(ap, fmt); devname = kvasprintf(GFP_KERNEL, fmt, ap); va_end(ap); ret = request_threaded_irq(pci_irq_vector(dev, nr), handler, thread_fn, - IRQF_SHARED, devname, dev_id); + irqflags, devname, dev_id); if (ret) kfree(devname); return ret;