From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE566C2BB3F for ; Wed, 15 Nov 2023 20:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343907AbjKOU4m (ORCPT ); Wed, 15 Nov 2023 15:56:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343908AbjKOU4l (ORCPT ); Wed, 15 Nov 2023 15:56:41 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86CE4B7 for ; Wed, 15 Nov 2023 12:56:38 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2812C4E777; Wed, 15 Nov 2023 20:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700081798; bh=bYSV7UN883lOPrhpw7djLbMmcUVhG7XNHmXeLI/9NyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1udA18zdNXkZq2UZqqo/5OGNu/3bBVJONCoHvfiGE8sM81DvOTzCcXD4FpxzEhker //QgxN3cPmshxp3B8d20P4ikBhhnpNGuVKIuF1pzVzrk9HDl7LFtjDMKnqK9KFVrtx 03mdfNkwkAdJ/VU7Grbab5xz84gYBngD0Sa4grq4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Danny Kaehn , Benjamin Tissoires , Sasha Levin Subject: [PATCH 5.10 106/191] hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip Date: Wed, 15 Nov 2023 15:46:21 -0500 Message-ID: <20231115204650.934539331@linuxfoundation.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231115204644.490636297@linuxfoundation.org> References: <20231115204644.490636297@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Danny Kaehn [ Upstream commit dc3115e6c5d9863ec1a9ff1acf004ede93c34361 ] Previously cp2112_gpio_irq_shutdown() always cancelled the gpio_poll_worker, even if other IRQs were still active, and did not set the gpio_poll flag to false. This resulted in any call to _shutdown() resulting in interrupts no longer functioning on the chip until a _remove() occurred (a.e. the cp2112 is unplugged or system rebooted). Only cancel polling if all IRQs are disabled/masked, and correctly set the gpio_poll flag, allowing polling to restart when an interrupt is next enabled. Signed-off-by: Danny Kaehn Fixes: 13de9cca514e ("HID: cp2112: add IRQ chip handling") Link: https://lore.kernel.org/r/20231011182317.1053344-1-danny.kaehn@plexus.com Signed-off-by: Benjamin Tissoires Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-cp2112.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -1171,7 +1171,10 @@ static void cp2112_gpio_irq_shutdown(str struct gpio_chip *gc = irq_data_get_irq_chip_data(d); struct cp2112_device *dev = gpiochip_get_data(gc); - cancel_delayed_work_sync(&dev->gpio_poll_worker); + if (!dev->irq_mask) { + dev->gpio_poll = false; + cancel_delayed_work_sync(&dev->gpio_poll_worker); + } } static int cp2112_gpio_irq_type(struct irq_data *d, unsigned int type)