Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2021646ybi; Thu, 20 Jun 2019 07:52:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDNjrae48WqgEuvvJVL7xhDATQxkbDaNEp6yTFFI9rQrzkwMdAcLlHZ5jRALBnLY20wpL5 X-Received: by 2002:a17:902:2f:: with SMTP id 44mr64229410pla.5.1561042379437; Thu, 20 Jun 2019 07:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561042379; cv=none; d=google.com; s=arc-20160816; b=dvMJaZDQzwkzaq/xJsOsq84iNrJOfdwpsu7rSZO5YhL9suXm3vgi/OHnV7Xf+qXGMU XzHj2xe4ZXx8Iv27p0Snr4hrKGaWPlV2Eob9EnBQ2RoUFlxdQqVjzzEb8MTkIlDyhpL/ KdHbLxzA9M+CGZndv9JPRl/w82CQt2PBQHtSy3pi4oQaoQ+4nGovjBsY4zd8iKuz2lZ+ cQAc53twPBTVlykkU6B04EMaNM+6jfurr43XFcUixZ85SUvnBFSOsRrIrDT0Mh00VFF0 6OtWvZPQG7LdMI+P0rkpxnTjYtB5eSyv+x5i2Uu6WutJCtMgXxRLHy+GE1l62sFUDgNM 8d7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=vDIDF3Fpe3qmnJTWf1iekm5vMmx1J/xglJGH2qMwdUw=; b=qS11RBbpcZOGhZgjTcF2bCmny1e56XVQ+quGy0ptUo+NYCsE3yDIFv1y/FqHYVNJV8 tXje7Ud1VqYhX+Eqb3xtmdooflRpZg951503HJ+fr/fLgTIwvFLPShJENxJ5i6h36/vb wnsSWy+YOG/LLpcWweWv/5KmZGAxrqwrsQGA3vyuemdiDSxqy8Q2HWhG4ighwCN8/lbk 3wGF2jlqZkMGG4MQLhy5+Gcx4Yf140p3zzCrvEkAPlMx+Yek2F7dA9poTom+aeI24Xnf zdb9x8Vp0LIoCjtzCv9Hqy5R7uBAAorQfVJfozyL8RVHdQkvOCsyeMxvYrL/xqYhKAea EdIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y134si3121023pfc.285.2019.06.20.07.52.43; Thu, 20 Jun 2019 07:52:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731931AbfFTOw1 (ORCPT + 99 others); Thu, 20 Jun 2019 10:52:27 -0400 Received: from mga02.intel.com ([134.134.136.20]:38054 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726582AbfFTOw0 (ORCPT ); Thu, 20 Jun 2019 10:52:26 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2019 07:52:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,397,1557212400"; d="scan'208";a="243650599" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.145]) by orsmga001.jf.intel.com with ESMTP; 20 Jun 2019 07:52:23 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hdyQH-0001LG-V7; Thu, 20 Jun 2019 17:52:21 +0300 Date: Thu, 20 Jun 2019 17:52:21 +0300 From: Andy Shevchenko To: Charles Keepax Cc: wsa@the-dreams.de, mika.westerberg@linux.intel.com, jarkko.nikula@linux.intel.com, linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, benjamin.tissoires@redhat.com, jbroadus@gmail.com, patches@opensource.cirrus.com Subject: Re: [PATCH v5 2/7] i2c: acpi: Use available IRQ helper functions Message-ID: <20190620145221.GC9224@smile.fi.intel.com> References: <20190620133420.4632-1-ckeepax@opensource.cirrus.com> <20190620133420.4632-3-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190620133420.4632-3-ckeepax@opensource.cirrus.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 20, 2019 at 02:34:15PM +0100, Charles Keepax wrote: > Use the available IRQ helper functions, most of the functions have > additional helpful side affects like configuring the trigger type of the > IRQ. > > Reviewed-by: Mika Westerberg > Reviewed-by: Andy Shevchenko > Signed-off-by: Charles Keepax Some last minute observations / questions. > + struct resource r; > + > + if (*irq <= 0 && acpi_dev_resource_interrupt(ares, 0, &r)) > + *irq = i2c_dev_irq_from_resources(&r, 1); > + > + return 1; /* No need to add resource to the list */ If we don't add it to the list, do we still need to manage the empty resource_list below? > /* Then fill IRQ number if any */ > INIT_LIST_HEAD(&resource_list); > - ret = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); > + ret = acpi_dev_get_resources(adev, &resource_list, > + i2c_acpi_add_resource, &irq); > if (ret < 0) > return -EINVAL; > > - resource_list_for_each_entry(entry, &resource_list) { > - if (resource_type(entry->res) == IORESOURCE_IRQ) { > - info->irq = entry->res->start; > - break; > - } > - } > + if (irq > 0) > + info->irq = irq; Hmm... can't we just assign it directly inside the _add_resource() call back as original code did? -- With Best Regards, Andy Shevchenko