Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp59684rdb; Wed, 20 Dec 2023 06:20:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEK48ybKHOwjoNLeHtdJg0Y9ie34eafjHeM4X6mp9MK0FL4CmnaMLblcM8VEunJudga8BpR X-Received: by 2002:a05:620a:248c:b0:780:e5d6:eb38 with SMTP id i12-20020a05620a248c00b00780e5d6eb38mr6744107qkn.86.1703082013664; Wed, 20 Dec 2023 06:20:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703082013; cv=none; d=google.com; s=arc-20160816; b=V1oOeeAN+ORkkz1ueRQSxZGGqzf5WTPV6oIUnp4flB/djWdpLKSglQ6UHw8a098hDC RpXmhMIfth/UchloeMGUCf1/KwCmkkcoNMoNOQUEu4Bt27RXuIcwma2xaeI5kxpRnUIa IQvJzN0pd0on7t9oEiC9cTx0iHFOQ4ogwUrcJGACcqKDqWMZp+1NlbwbzAjZPfOnVZEz CkRvD2PisySeMZaHLXiTLdlkoGx6Eb9gAW58E7+RqtKs9+6h+8UHWbkZJcvSMLWZ53Vk pdXyMewKocMU4D1HBWDxShHkMTFpIzCbtHOgI9paRuPThdZF2zXnQPgCQS7NUulBr1/L H9fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=Ghihl9ac8wS1nxSQnIDplCycwGk8sdWzAz5lDvJkyn0=; fh=IAan2q73USk3b3qchze0otV7KkguFi8vp3SVNa2z3os=; b=FWsIIfXKMGMwPpx4r9dSasVqxMS6MZWskbv1wGe3blQdLErGQIuUcgBwHEepNZ37dx 5XWuOtCw3NW+r1E9ulkzrhir82gLVy+v+x7xwuHcL4F9Yrwrj01fzquz5hT47TiR9vsE nkUa2Ms2FNWM2Pck3LbU2YqPIZiWygDhEVvB37l/yQCJXTcspHOHHvDm/FJV1mnaC0pF JLu5cGBtpdYlTMFSlJp+sWZ1cL4esbdtTmDik+L9Guy4auKvI2Sgvdetk642Es4CcKvx 2cSP9h3tZZgetR87+J6IhL6ACT1tjnbZDrGMQO1sXIuZhpE6VvVwM7T/4Qro7mGlzcUE 1u9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-7050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7050-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x18-20020ae9e912000000b0077d88739d00si27805751qkf.730.2023.12.20.06.20.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 06:20:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-7050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7050-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6E66C1C229DB for ; Wed, 20 Dec 2023 14:20:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE44838DDC; Wed, 20 Dec 2023 14:20:05 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5E5B38DDF; Wed, 20 Dec 2023 14:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=kernel.org X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="375309609" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="375309609" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 06:20:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="866987944" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="866987944" Received: from smile.fi.intel.com ([10.237.72.54]) by FMSMGA003.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 06:20:00 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rFxQT-00000007YXL-3LxH; Wed, 20 Dec 2023 16:19:57 +0200 Date: Wed, 20 Dec 2023 16:19:57 +0200 From: Andy Shevchenko To: xiongxin Cc: fancer.lancer@gmail.com, hoan@os.amperecomputing.com, linus.walleij@linaro.org, brgl@bgdev.pl, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, stable@kernel.org, Riwen Lu Subject: Re: [PATCH v5] gpio: dwapb: mask/unmask IRQ when disable/enale it Message-ID: References: <20231219101620.4617-1-xiongxin@kylinos.cn> <20231220022901.29158-1-xiongxin@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231220022901.29158-1-xiongxin@kylinos.cn> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Wed, Dec 20, 2023 at 10:29:01AM +0800, xiongxin wrote: > In the hardware implementation of the I2C HID driver based on DesignWare > GPIO IRQ chip, when the user continues to use the I2C HID device in the > suspend process, the I2C HID interrupt will be masked after the resume > process is finished. > > This is because the disable_irq()/enable_irq() of the DesignWare GPIO > driver does not synchronize the IRQ mask register state. In normal use > of the I2C HID procedure, the GPIO IRQ irq_mask()/irq_unmask() functions > are called in pairs. In case of an exception, i2c_hid_core_suspend() > calls disable_irq() to disable the GPIO IRQ. With low probability, this > causes irq_unmask() to not be called, which causes the GPIO IRQ to be > masked and not unmasked in enable_irq(), raising an exception. > > Add synchronization to the masked register state in the > dwapb_irq_enable()/dwapb_irq_disable() function. mask the GPIO IRQ > before disabling it. After enabling the GPIO IRQ, unmask the IRQ. ... > v5: > * fix typo in patch description Thank you! This looks perfect! -- With Best Regards, Andy Shevchenko