Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3643935ybd; Tue, 25 Jun 2019 06:13:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZQwavx9VJGqacPNHIa61QCzRLk3kicVPiOUu2K8zZ0f/kRYl+ASWjSb1RBBumFgBkRB9f X-Received: by 2002:a17:902:848c:: with SMTP id c12mr151981810plo.17.1561468389900; Tue, 25 Jun 2019 06:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561468389; cv=none; d=google.com; s=arc-20160816; b=othhTBIJCw+ehpB2eTOPtn85bbubTDK+WPSCvtqAw1V3a28hwpXJF/i9ZgoNam0865 9IFQCWU0v6e3ZVT55xRId3FKNH3upCGBAHOMtRFGHv2l18bMHdxNmLlCNpv260bMu+pO 9rOJKvSutZbcgMvLF6m4+UKdc4byUD88bViz0mx+Zu4iiOYLFRSMqWNiVbZP3m6aR1PV 898m2Aub5JH2NorDYBFAD6eqnQWCP+6zlz24Z+Z68m5zLVreZzDgiNCaB8WgPstZ45cm 2lUWVq1PxFiaXgy7eZAef7IBgYXPGLmTNKVfjmcrbJCLa5XeIIxQjBWwYHBjTpQtptcP 1yUQ== 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=VNAHUEHW+oBRAkXsKkZ4ToVSA5dNCQH5CLTtaufs1iw=; b=Qk/BvkrglAWxOAmsqWjPMI418DaYSYaH6lJWXuj2DpqF7/DFQNOQUKtWDrJTWwyKzP FFtcGeknyuY961yVseQ0eiNE+laWunrijgtWmEcLSva1FBRqp5SXTkMRumrOa5oaCrqP 2DXqnt5XLZ3do5xLaH8N5F6LWb8epCTTGta1F6JvD4m/QwIunhG3Ft9oTzmTn2R4F3pa OJyju7H6694S2wF57E3o0lUdpA5bcay78jrq9ejMChn7dkGSHiKs6SCu4MMzxBV5T8Nh ho/eQQmHxaIDl0YbQ9fFke9IdlB9DdmZUQoiLG9EKzyc2i8mQaQ2ex1NA2enmqIHmQfI 09OQ== 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 p6si344372plq.30.2019.06.25.06.12.54; Tue, 25 Jun 2019 06:13:09 -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 S1732090AbfFYLuS (ORCPT + 99 others); Tue, 25 Jun 2019 07:50:18 -0400 Received: from mga18.intel.com ([134.134.136.126]:5186 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726931AbfFYLuS (ORCPT ); Tue, 25 Jun 2019 07:50:18 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jun 2019 04:50:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,415,1557212400"; d="scan'208";a="182871497" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by fmsmga001.fm.intel.com with SMTP; 25 Jun 2019 04:50:12 -0700 Received: by lahna (sSMTP sendmail emulation); Tue, 25 Jun 2019 14:50:11 +0300 Date: Tue, 25 Jun 2019 14:50:11 +0300 From: Mika Westerberg To: Charles Keepax Cc: wsa@the-dreams.de, jarkko.nikula@linux.intel.com, andriy.shevchenko@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 v6 4/7] i2c: core: Make i2c_acpi_get_irq available to the rest of the I2C core Message-ID: <20190625115011.GE2640@lahna.fi.intel.com> References: <20190621100815.12417-1-ckeepax@opensource.cirrus.com> <20190621100815.12417-5-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190621100815.12417-5-ckeepax@opensource.cirrus.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 21, 2019 at 11:08:12AM +0100, Charles Keepax wrote: > In preparation for more refactoring make i2c_acpi_get_irq available > outside i2c-core-acpi.c. > > Signed-off-by: Charles Keepax > --- > > Changes since v5: > - Pass a struct device rather than acpi_device to i2c_acpi_get_irq, > note this is more awkward than I would have liked as I am very > unconvinced that adev->dev can actually be passed to > ACPI_COMPANION. If anyone can answer that for sure that would be > very helpful. I don't think you can do that. I probably missed some previous discussion but what's wrong passing struct i2c_client instead and use ACPI_COMPANION() for that? > > Thanks, > Charles > > drivers/i2c/i2c-core-acpi.c | 13 +++++++++++-- > drivers/i2c/i2c-core.h | 7 +++++++ > 2 files changed, 18 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c > index c91492eaacd93..37bf80b35365f 100644 > --- a/drivers/i2c/i2c-core-acpi.c > +++ b/drivers/i2c/i2c-core-acpi.c > @@ -145,8 +145,17 @@ static int i2c_acpi_add_resource(struct acpi_resource *ares, void *data) > return 1; > } > > -static int i2c_acpi_get_irq(struct acpi_device *adev) > +/** > + * i2c_acpi_get_irq - get device IRQ number from ACPI > + * @client: Pointer to the I2C client device I think this should be @dev now. > + * > + * Find the IRQ number used by a specific client device. > + * > + * Return: The IRQ number or an error code. > + */ > +int i2c_acpi_get_irq(struct device *dev) > { > + struct acpi_device *adev = container_of(dev, struct acpi_device, dev); > struct list_head resource_list; > int irq = -ENOENT; > int ret; > @@ -199,7 +208,7 @@ static int i2c_acpi_get_info(struct acpi_device *adev, > *adapter_handle = lookup.adapter_handle; > > /* Then fill IRQ number if any */ > - info->irq = i2c_acpi_get_irq(adev); > + info->irq = i2c_acpi_get_irq(&adev->dev); > if (info->irq < 0) > return info->irq; > > diff --git a/drivers/i2c/i2c-core.h b/drivers/i2c/i2c-core.h > index 2a3b28bf826b1..1735ac17a957a 100644 > --- a/drivers/i2c/i2c-core.h > +++ b/drivers/i2c/i2c-core.h > @@ -63,6 +63,8 @@ const struct acpi_device_id * > i2c_acpi_match_device(const struct acpi_device_id *matches, > struct i2c_client *client); > void i2c_acpi_register_devices(struct i2c_adapter *adap); > + > +int i2c_acpi_get_irq(struct device *dev); > #else /* CONFIG_ACPI */ > static inline void i2c_acpi_register_devices(struct i2c_adapter *adap) { } > static inline const struct acpi_device_id * > @@ -71,6 +73,11 @@ i2c_acpi_match_device(const struct acpi_device_id *matches, > { > return NULL; > } > + > +static inline int i2c_acpi_get_irq(struct device *dev) > +{ > + return 0; > +} > #endif /* CONFIG_ACPI */ > extern struct notifier_block i2c_acpi_notifier; > > -- > 2.11.0