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 C4B61C38A2D for ; Wed, 26 Oct 2022 13:29:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232679AbiJZN3m (ORCPT ); Wed, 26 Oct 2022 09:29:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233525AbiJZN3l (ORCPT ); Wed, 26 Oct 2022 09:29:41 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C460FF0 for ; Wed, 26 Oct 2022 06:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666790980; x=1698326980; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=wwFJdid6P8Fmn3jQqKqvdTo0DF64piBBWIUEgVJhEOc=; b=I3IexPq0LDQYmQRXMOwsWSRFTaDfLuo/WQT7SUXRL3MXljWIEAsUAHzR AvgNVxrl6fNnj2JT9DZB0n/D7mOJjJDOeBNhAuL3rGmyDVt7dJev1jsnF 5A1HSwgbejP0mefZgl0G57NdaI6ofNyJxndZJag+yo0nDApAf9kNv59n3 ikqdD2zinTN3OdHGDn/BV+6RUFrlwxxyxggNZMhDY7yfgv5jC95Qsa2wV HfCR5DCvprX57lHaEog6tc8tAXcdIGZzgekcPQr9tAogwdCdPxvGEbLOE e1lgStI29nDS/vkwnMbfW2vbEXFGWUHgFCX4gBPomFWineaGJY++LMUFi g==; X-IronPort-AV: E=McAfee;i="6500,9779,10512"; a="305558013" X-IronPort-AV: E=Sophos;i="5.95,214,1661842800"; d="scan'208";a="305558013" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2022 06:29:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10512"; a="665284085" X-IronPort-AV: E=Sophos;i="5.95,214,1661842800"; d="scan'208";a="665284085" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga001.jf.intel.com with ESMTP; 26 Oct 2022 06:29:37 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1ongTP-002fPH-08; Wed, 26 Oct 2022 16:29:35 +0300 Date: Wed, 26 Oct 2022 16:29:34 +0300 From: Andy Shevchenko To: Jarkko Nikula Cc: linux-i2c@vger.kernel.org, Wolfram Sang , Mika Westerberg , Jan Dabros , Michael Wu , Tian Ye , Luis Oliveira Subject: Re: [PATCH 07/11] i2c: designware: Do not process interrupt when device is suspended Message-ID: References: <20221026123912.2833271-1-jarkko.nikula@linux.intel.com> <20221026123912.2833271-8-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org On Wed, Oct 26, 2022 at 04:28:59PM +0300, Andy Shevchenko wrote: > On Wed, Oct 26, 2022 at 03:39:08PM +0300, Jarkko Nikula wrote: > > Do not return with interrupt handled if host controller is off and thus > > interrupt is originating from other device or is spurious. > > > > Add a check to detect when controller is runtime suspended or > > transitioning/reset. In latter case all raw interrupt status register > > bits may read one. In both cases return IRQ_NONE to indicate interrupt > > was not from this device. ... > > dev_dbg(dev->dev, "enabled=%#x stat=%#x\n", enabled, stat); > > if (!enabled || !(stat & ~DW_IC_INTR_ACTIVITY)) > > return IRQ_NONE; > > + if (pm_runtime_suspended(dev->dev) || stat == ~0) > > + return IRQ_NONE; > > I haven't checked the type of 'stat', but usually be careful with ~0. > Due to integer promotion it may give the unexpected results. That said, GENMASK(hi, 0) in this case is better. -- With Best Regards, Andy Shevchenko