Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1766265ybz; Sun, 26 Apr 2020 03:50:11 -0700 (PDT) X-Google-Smtp-Source: APiQypIwbgo1KPaSTS9fnwJbVArt/WBMZC92oltxLNDU7CYisDv/YlV3wGpkuoIlaafUJtCqbZVR X-Received: by 2002:aa7:dd95:: with SMTP id g21mr14377992edv.148.1587898211712; Sun, 26 Apr 2020 03:50:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587898211; cv=none; d=google.com; s=arc-20160816; b=oZ91pOo1lmP4Dvn2caZRASpZfw9jbzaTq8XnUwJco/LIaTJNb+14oegu3CKMIe5IAb 72HF1rRYyYU42vy2282HKDlphMZ/dsT/wfmfq4lwbQIHX5HJaQCt69EKTUYNsSdCVqBh f/4QNfgtXwJexywq7jQcDbnF3JXYv05HQ1oZCczpH7mLtmG9RoIOnjLF3qTv5q2ug7QZ CIb26p/+IMOfjy1UJ+84DJzJW8ZzmzSYMgFQP7uz//ulfed+pzHzXHGU/fnj3bz0kUm6 OE1CQs9mUyYqKqE3OQBHv2p444d/ihEULiJbPZKmeek0EyuaPxClRVG2F/SJKzL4zsMi zZFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rR1VWAX5n/MzP2zWX8Dox7ig/TvsvH/ThCSY7sIXksw=; b=O/TOM1VI+iycgWjuxHwD9og14uZsw0EFcYUkIUFKO9rppkl6IkGwLQRnTpRRHSDi09 ntFgUw+IxHoPEpJAWstxMLMlp44Ik9xfJRfLFRKHjqCtqWJ9KpbHxEzfmpFRFjqNfT/V C+P9XhfaXdvKrqqu2DfumCe7BNK2fPRP4hV+Ih0eAcKEgP85prGalQuwgsA78v3zvqV/ aihkIgLMZB8wL3W27SPJGSDPUIhsthmIr8rVWtN0BD1jAJxKVvdFWHhghkmJ+wKKBWTZ /skBIVfPm4RzV6X2tvoXPB726iIwHT7o3uPALNiFdtuM/gi0G3NjXE5DQ4+yrxQID0uk V5aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="cO16BoF/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k18si2347825edx.296.2020.04.26.03.49.48; Sun, 26 Apr 2020 03:50:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="cO16BoF/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726174AbgDZKr2 (ORCPT + 99 others); Sun, 26 Apr 2020 06:47:28 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:57588 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726146AbgDZKr1 (ORCPT ); Sun, 26 Apr 2020 06:47:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587898045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rR1VWAX5n/MzP2zWX8Dox7ig/TvsvH/ThCSY7sIXksw=; b=cO16BoF/DtP0qwtMropNdth8UtneFMXS6ZfMGz3X0mCZjLe0+uClp1NLBHKiTpJm4MHZqP Ir6yd7Xbchwt3juLpEs4MXA/bKAzQvA5ZcSnYNuMk8P6+NCU0/kKMPuD00WrRXJOEnGkxx Z1D76X3s5eiKv3vvh8YRqlnQkvNBt5E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-268-oY_6SS6PNzqWjCWyv53M5A-1; Sun, 26 Apr 2020 06:47:21 -0400 X-MC-Unique: oY_6SS6PNzqWjCWyv53M5A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7C11107ACCA; Sun, 26 Apr 2020 10:47:19 +0000 (UTC) Received: from x1.localdomain.com (ovpn-112-32.ams2.redhat.com [10.36.112.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2356E5D716; Sun, 26 Apr 2020 10:47:17 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Len Brown , Darren Hart , Andy Shevchenko Cc: Hans de Goede , linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] platform/x86: i2c-multi-instantiate: Add flag for passing fwnode Date: Sun, 26 Apr 2020 12:47:12 +0200 Message-Id: <20200426104713.216896-2-hdegoede@redhat.com> In-Reply-To: <20200426104713.216896-1-hdegoede@redhat.com> References: <20200426104713.216896-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In some cases the driver for the i2c_client-s which i2c-multi-instantiate instantiates may need access some fields / methods from to the ACPI fwnod= e for which i2c_clients are being instantiated. An example of this are CPLM3218 ACPI device-s. These contain CPM0 and CPM1 packages with various information (e.g. register init values) which the driver needs. Passing the fwnode through the i2c_board_info struct also gives the i2c-core access to it, and if we do not pass an IRQ then the i2c-core will use the fwnode to get an IRQ, see i2c_acpi_get_irq(). This is a problem when there is only an IRQ for 1 of the clients describe= d in the ACPI device we are instantiating clients for. If we unconditionall= y pass the fwnode, then i2c_acpi_get_irq() will assign the same IRQ to all clients instantiated, leading to kernel-oopses like this (BSG1160 device)= : [ 27.340557] genirq: Flags mismatch irq 76. 00002001 (bmc150_magn_event= ) vs. 00000001 (bmc150_accel_event) [ 27.340567] Call Trace: ... So we cannot simply always pass the fwnode. This commit adds a PASS_FWNOD= E flag, which can be used to pass the fwnode in cases where we do not have the IRQ problem and the driver for the instantiated client(s) needs acces= s to the fwnode. Signed-off-by: Hans de Goede --- drivers/platform/x86/i2c-multi-instantiate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/platform/x86/i2c-multi-instantiate.c b/drivers/platf= orm/x86/i2c-multi-instantiate.c index 6acc8457866e..dcafb1a29d17 100644 --- a/drivers/platform/x86/i2c-multi-instantiate.c +++ b/drivers/platform/x86/i2c-multi-instantiate.c @@ -20,6 +20,8 @@ #define IRQ_RESOURCE_GPIO 1 #define IRQ_RESOURCE_APIC 2 =20 +#define PASS_FWNODE BIT(2) + struct i2c_inst_data { const char *type; unsigned int flags; @@ -93,6 +95,10 @@ static int i2c_multi_inst_probe(struct platform_device= *pdev) snprintf(name, sizeof(name), "%s-%s.%d", dev_name(dev), inst_data[i].type, i); board_info.dev_name =3D name; + + if (inst_data[i].flags & PASS_FWNODE) + board_info.fwnode =3D dev->fwnode; + switch (inst_data[i].flags & IRQ_RESOURCE_TYPE) { case IRQ_RESOURCE_GPIO: ret =3D acpi_dev_gpio_irq_get(adev, inst_data[i].irq_idx); --=20 2.26.0