Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2139884imc; Tue, 12 Mar 2019 07:49:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4QMYqfOsGXmGaOFAZcKz8ffdeQvc2Q3f0Xzc5Gh3SjFx5snXDcLF5S1DstjLmjHyKsJmO X-Received: by 2002:a65:6149:: with SMTP id o9mr35348329pgv.315.1552402180701; Tue, 12 Mar 2019 07:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552402180; cv=none; d=google.com; s=arc-20160816; b=X7QZVSuEOrAYdJAumLLJV396S2dTttzqW9EW/3t+e5UXsN8o1oupfyfPfQ/mUbfUu9 wssoX8IvqXsbMQLo1eiTmGk66vQ0sr5i/d1LxKRTeN09l7D9UOpI0D4PHDdI+IYZrjjy gOr5CrhiTge9yFPc20ujVJWx6dXO1IbT/jwbuYnCgRac4l+R2bi2EWCbnqjwDyAfIrPE bMw6xuaW8Db8Ko31Sm2O53aBB3XAT1lIaf28ojxqHHhoPuJJ39j1sLkQJnTdz2PVOSm5 mAV921LIc+/NKU+BKyAf6sDhsIQ44ozmDVCQqDeNbK6t9+oLVd6M5U5COpbuYNeVva27 rflg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=3IMWMDMFyUYWCRk+k1pVkbD0HAZ+5jDZ5EBy63tOPhI=; b=t0ij2j7BzA/xYCR7xg8LOhGDou+dL8M7+1+1O1Ke2tJG8bhd9NW/SU3lLWlBNIWrFb GDfIIe0engcSsnxqW9V2DTV7IwCZ9/Gat13e4p0gk1r46tni3l+XzJ8dBdkqWgkUaNvn HeJK5vcs7kOJtoY4WtX91i0guziapef0VSVBs42/8/Per37/0/nCuE1hzTzMJcP91dtM QK9/JJwO9fi4WI3Tu6QWyLyJ6M8Ie2jLJIDV8w/EL+1jLmUCzcC2wz6ArJYLMEr9rgbp MP4CIh3h37Hz3rpWKNcpsemKz753tgK/K715e1Vfp06QjFvv8KeKz/T9jQ5131/M/4a/ Z/zA== 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 v9si7403761pgr.462.2019.03.12.07.49.24; Tue, 12 Mar 2019 07:49:40 -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 S1726853AbfCLOrw (ORCPT + 99 others); Tue, 12 Mar 2019 10:47:52 -0400 Received: from mga12.intel.com ([192.55.52.136]:1761 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbfCLOrv (ORCPT ); Tue, 12 Mar 2019 10:47:51 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Mar 2019 07:47:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,471,1544515200"; d="scan'208";a="130976207" Received: from mylly.fi.intel.com (HELO [10.237.72.56]) ([10.237.72.56]) by fmsmga008.fm.intel.com with ESMTP; 12 Mar 2019 07:47:49 -0700 Subject: Re: [PATCH 1/2] i2c: i2c-designware-platdrv: Allow a dynamic adap. nr without an ACPI fwnode To: Hans de Goede , Wolfram Sang , Andy Shevchenko , Mika Westerberg , Lee Jones Cc: linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190311112216.31391-1-hdegoede@redhat.com> <20190311112216.31391-2-hdegoede@redhat.com> From: Jarkko Nikula Message-ID: Date: Tue, 12 Mar 2019 16:47:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190311112216.31391-2-hdegoede@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On 3/11/19 1:22 PM, Hans de Goede wrote: > Before this commit the i2c-designware-platdrv assumes that if the pdev > has an apci-companion it should use a dynamic adapter-nr and otherwise > it will use pdev->id as adapter-nr. > > On some devices e.g. the Apollo Lake using Acer TravelMate Spin B118, > some of the LPSS i2c-adapters are enumerated through PCI and do not have > an ACPI fwnode. These devices are handled as mfd devices so they end up > using the i2c-designware-platdrv driver. > > This results in the i2c-adapter being registered with the mfd generated > pdev->id as adapter-nr, which conflicts with existing adapters, triggering > a WARN(id < 0, "couldn't get idr") in i2c-core-base.c and causing the > adapter registration to fail. > I went thinking would we get a regression if we switch the i2c-designware-platdrv to dynamic numbering unconditionally? Only drivers/mfd/intel-lpss.c and drivers/mfd/intel_quark_i2c_gpio.c register platform device "i2c_designware" and otherwise in the driver itself for known ACPI IDs and device tree bindings. Things should be fine for ACPI cases if slave devices are also described in ACPI tables. As far as I've understood with device tree matching adapter number is irrelevant in slave device registration? Andy: could you tell by commit 918fe70cf475 ("mfd: intel_quark_i2c_gpio: support devices behind i2c bus") are those devices described in ACPI or in some i2c_board_infos with referring to fixed adapter number either in or out of kernel tree code? Then drivers/platform/chrome/chromeos_laptop.c is the only code searching for adapter named as "Synopsys DesignWare I2C adapter" without assuming any fixed adapter numbering. What's unclear to me can there be device tree cases where i2c-designware probing comes with pdev->id not starting from zero or in different order? I.e. would it make difference do we use pdev->id or dynamic adapter numbering? -- Jarkko