From patchwork Tue May 5 12:37:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 219885 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84F38C47258 for ; Tue, 5 May 2020 12:38:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5BA4620735 for ; Tue, 5 May 2020 12:38:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="VtOxdcZo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729124AbgEEMiq (ORCPT ); Tue, 5 May 2020 08:38:46 -0400 Received: from mail-eopbgr680041.outbound.protection.outlook.com ([40.107.68.41]:21169 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729075AbgEEMih (ORCPT ); Tue, 5 May 2020 08:38:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WyZOdAUg06ZPSarKOwtVZeDHOB5QqqBM6oeH/U9/a9aL3Z3XhEOPxEqPlUauJ5SHNPWfvFKHWEQTk36DIzORMjHXZy7pTQNmk+znvsmu3wgKuKvId7/lD/9qWzX313FU2S6S9hmPtVdJUMxoH77XhvFNezDZ247/w0icTGyX1C1cvyas9eDVrfJoTBPRkD+fSk3lVoFiBTgTefANlcPm4/BNQ7oLBRiadRMFB4HWcyKsYCcjOVZDyYb8WODopulRzw3ZPbl+qB6FHb5R7Ego3dsP6Zph1f8gRGoFGfgAw14VzuEOZLT4rqpfCEWdGmgxw1qXf5boLS6f0hsqLUfFkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NMpfck1aDMqtJrUHlkcbaq7MiZYLPBmRtELEHKBmXaQ=; b=FBNElqP6deGRhtAE2CTWGyOiTAJX5UPQ21yDmQHT1lylZEtHRFVkRU325JLPiuyWMlp0gxiUuQrYbGpB503yUU/25wPsEkZ+whSRCLTrTO0qL+8WngnD45jaNrm7k1KD86RBQcSLiUTpH5cX+6j6FuxUDEK+db4Wbhhnm3Ni7h+CLXHhjsgSOSMoKDpoeM98PXKsFyqPvVm4tTDDD2rpxilUqFyX6sXn2beuKK39s7W1xrx0P3y1SABewnjnIhHl6/65FPZ1DnqLI9edi4H0g+Uca81wGXRskCLiQFsNp7k7eAzwiWlLdmCoq0gQT8upOe2tPh3uG7gwZ7kDZcOXow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NMpfck1aDMqtJrUHlkcbaq7MiZYLPBmRtELEHKBmXaQ=; b=VtOxdcZoe9IM8wislvQNVjnuSKt5EV8B5RdS9GnwoOYfc0oKWU5V6CVyzWpnLKd9yv5lmtQIaEHmhDFwOYeCz0fMEwhUpyLZ6G41DeFz4T3B+JwzdOyM6Az4Qn4IhT6Ik7W7U7kBwDocKC5jmK2BizJi0QSr/bwx7Qn86BVoZUA= Authentication-Results: driverdev.osuosl.org; dkim=none (message not signed) header.d=none; driverdev.osuosl.org; dmarc=none action=none header.from=silabs.com; Received: from MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) by MWHPR11MB1824.namprd11.prod.outlook.com (2603:10b6:300:110::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19; Tue, 5 May 2020 12:38:24 +0000 Received: from MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::81d5:b62b:3770:ffbe]) by MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::81d5:b62b:3770:ffbe%10]) with mapi id 15.20.2958.030; Tue, 5 May 2020 12:38:24 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH 06/15] staging: wfx: use threaded IRQ with SPI Date: Tue, 5 May 2020 14:37:48 +0200 Message-Id: <20200505123757.39506-7-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200505123757.39506-1-Jerome.Pouiller@silabs.com> References: <20200505123757.39506-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR3P189CA0022.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:52::27) To MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.home (2a01:e35:2435:66a0:1265:30ff:fefd:6e7f) by PR3P189CA0022.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:52::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Tue, 5 May 2020 12:38:22 +0000 X-Mailer: git-send-email 2.26.1 X-Originating-IP: [2a01:e35:2435:66a0:1265:30ff:fefd:6e7f] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dcd27bac-09f5-4129-ba2d-08d7f0f133c1 X-MS-TrafficTypeDiagnostic: MWHPR11MB1824: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 0394259C80 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uWhmmeoW26eetYjWVYZOOZ3K51gB59q7Tt0Ck9YNqsJ8IXbefmLyTNgQZStLfh/9dnINXjfjsdtBgec5Qqdru2p0TGHDXBy/CWxLA0hlpAxqwCkJNSlpvD2Yhd43SjXIgd7rLsfclcT0j/2WShkXmNjHl7QHHWKggbxu+rjldSzxnxxcm6tWJj7+FHPOzv5xgIRKi0xJy6ZH+U2VfNJMADR3oqUjUe/U9S0WrP9/1erV9oCkoXY7Tai5mtovnxB4zerlvt+egNaVn0//yDtLgSf4+fVrSB+DOCZnuyZm/zBfwf/nngdXopjjdsnyQ6iFVD1gxjOMErrhyMCuY51W/aQb96XevJPCUVwBuTEIWhBlBf/WRA3gfN1kOh/2l2WIo68LDVVznz5BfIBlDUv5j+bYojM2rNaWk80l9uvxAmV4i1Vsq6zUhaTb3yb95Hj2MbS0z0PWs6mjUldNaech3RhwXTS6USWIZeO1WSNPJKBmU2PKtTBamF2jcCfSSJplTs7K7AQv/7sWCD8ENXNoPg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1775.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(136003)(396003)(39850400004)(366004)(376002)(346002)(33430700001)(86362001)(6666004)(107886003)(8886007)(1076003)(6512007)(6486002)(66574012)(36756003)(5660300002)(2906002)(66476007)(6506007)(16526019)(186003)(52116002)(66946007)(66556008)(54906003)(2616005)(4326008)(8936002)(8676002)(316002)(33440700001)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: I4+zS1QYWZB+VTgBCAv2GA+dJeMROXNC3rUi8qVVTbM7skaaMt0qV3j5vJQZYPss/zvGt16CcRhulZ6iv4PJPBYRRO+pifNn7iIShGxQ0yb9tcVNCy5VwCAh4czs/6Gy4SUKxYmUgaQrjqo0jBhaPxEcOWpNQMj2L4CvRA9UUfkAYvHng4gFAjfn1+csquvr1/k7JUL1Pvzp046DtGaEiDfR48n0XdAKsVb6Zz70ryccYFUBZHJkveDaI4najpbV/w8lDoGL+gDqap46hTXOlGNmTt4jlsz//xIHn1gsBem47rQ81q5t5oc5Kosdv0gxTfTUKzaDNaFI0U6sNpas3g7NlaULkKccq8sSOl6SmYTn7+OCdK3jJK0nfpLJNDgKtEoqYQ9bukZ9/4X2sf0ymSdbscRqsQ0IPcnufKNbCUSPiMWuKqk2xapfjwk8INLRykC4a33rYdb2OGK9NE1rj3Mn4zptlJZkx+sJ24IeMxw33kxaal7qJ4swksZE4GzP0YcajRf1yXvafu5NNxKEpuDc1rrAq6LRbV81rIcGWL+pyOWqd3BRGF/R6qJOhaLfFVzdNQ9Qmxr8+YErT9DNXOKWzpb/T00Tu5Ep2rB0xqD+GYIiQKpZnJJHPXs+1IATnhWIPGp+1pZLOBU2yWiC952Kg4Xln+sW04RwLOi+qQmSE/PdcuOoVrie9At3PCX8NGoh64E4hOjttQB9uKUZvneI9T4erdXNmukv84/koMhLYAXvKG1lBx9RcFU2A7rhyXd5ZQaOjq9C7boKbdB8baWeAtdjGbL2fZ3xmxeWiOSp78hCpy8L/Oe1LLgmd7SbSlt2b/oxwpLp/GH0ELtzNUAYSjoRoJ85cIMemo5Z/yE= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: dcd27bac-09f5-4129-ba2d-08d7f0f133c1 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2020 12:38:24.6181 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Cn3lY4Ul+kogQxEYLoEsyfeSDJm0VTWLDVBFGmKl/mfnQP7+W8leBkqCPaYRANhYOxl6wStid8axk9T5canVqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1824 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller Currently, the SPI implementation use a workqueue to acknowledge IRQ while the SDIO-OOB implementation use a threaded IRQ. The threaded also offers the advantage to allow level triggered IRQs. Uniformize the code and use threaded IRQ in both case. Therefore, prefer level triggered IRQs if the user does not specify it in the DT. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/bus_spi.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c index 03f95e65d2f9..00613d046c3f 100644 --- a/drivers/staging/wfx/bus_spi.c +++ b/drivers/staging/wfx/bus_spi.c @@ -39,7 +39,6 @@ struct wfx_spi_priv { struct spi_device *func; struct wfx_dev *core; struct gpio_desc *gpio_reset; - struct work_struct request_rx; bool need_swab; }; @@ -140,21 +139,21 @@ static irqreturn_t wfx_spi_irq_handler(int irq, void *priv) { struct wfx_spi_priv *bus = priv; - queue_work(system_highpri_wq, &bus->request_rx); - return IRQ_HANDLED; -} - -static void wfx_spi_request_rx(struct work_struct *work) -{ - struct wfx_spi_priv *bus = - container_of(work, struct wfx_spi_priv, request_rx); - wfx_bh_request_rx(bus->core); + return IRQ_HANDLED; } -static void wfx_flush_irq_work(void *w) +static int wfx_spi_irq_subscribe(struct wfx_spi_priv *bus) { - flush_work(w); + u32 flags; + + flags = irq_get_trigger_type(bus->func->irq); + if (!flags) + flags = IRQF_TRIGGER_HIGH; + flags |= IRQF_ONESHOT; + return devm_request_threaded_irq(&bus->func->dev, bus->func->irq, NULL, + wfx_spi_irq_handler, IRQF_ONESHOT, + "wfx", bus); } static size_t wfx_spi_align_size(void *priv, size_t size) @@ -212,21 +211,12 @@ static int wfx_spi_probe(struct spi_device *func) usleep_range(2000, 2500); } - INIT_WORK(&bus->request_rx, wfx_spi_request_rx); bus->core = wfx_init_common(&func->dev, &wfx_spi_pdata, &wfx_spi_hwbus_ops, bus); if (!bus->core) return -EIO; - ret = devm_add_action_or_reset(&func->dev, wfx_flush_irq_work, - &bus->request_rx); - if (ret) - return ret; - - ret = devm_request_irq(&func->dev, func->irq, wfx_spi_irq_handler, - IRQF_TRIGGER_RISING, "wfx", bus); - if (ret) - return ret; + wfx_spi_irq_subscribe(bus); return wfx_probe(bus->core); }