Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2142342imc; Tue, 12 Mar 2019 07:52:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyagocn9OX9h1MFO51FuurZv+iHvVgCGLPJymehMl21Pn75Dvy0uF3fQOrnQTfzP02sGApF X-Received: by 2002:a17:902:a60c:: with SMTP id u12mr4117240plq.301.1552402363270; Tue, 12 Mar 2019 07:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552402363; cv=none; d=google.com; s=arc-20160816; b=AupVxoy5hdgHAh2S9Mk9/qVUzwVsKHJ5lEGOfRMVf2j8UODlLli1N7k5QwWZkI4iYR mLp+PDcQ7Z/5EJ1zfC9DQ0H7TbXYxFWsO8cdRyksD/MoGhN87GE1E69JMWYtdMybGa5Q 2Q8fooHuMFrPkxjajr3ot+yI56FrrVmoBUG+gjPDMvPQZ+ldHWYy2NfvztHaHLUjzqQF 5l+dtHE3SoLot97jWOi1hLLzQ/XTfFqpz6Ic1bjuypWi8w7PNjKqpLohmqzKDYVDF+8R MEcNTl5E2FKoLl50jtE289kzbe83fzzKcpyDT0f7enceDFSpwVmgIMe8SzGQlqzhmsID PVHg== 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=gqBj8nH0pazADWytM/e0oIVEVNfp64FgxLQOymyNMA0=; b=HzClP9fCjehPTd1EMb1NKxGQ1YPvVTf2KUEAqAJNEsnRWIJtTAcB5D1nACvkEmzzqf Atx3F3gBhs9LRp6FeNzOJE/nN9+0xJRIhTI2vhGaLBmVaF8eODGzE4f6ic5kAEhCynme 4aa/0uPNGV4wwu8Rx9XLTyFOIj/pxF1I72LrIw9Clha5SzqMrgcdChN1SZG16PnT7EHS 0JPLD50FaYYKVf+f6Esain1Ac/lVawHKR4LZuE+YmlekslkkSxw5goD1aRLKziiS0P3V byzGAtw6olujV51s4wpINg15A2IAj3vVMytmYzWd9l3S3I00ndYFahkncraJfSC7HHfi gp+Q== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12si7725020pgm.447.2019.03.12.07.52.26; Tue, 12 Mar 2019 07:52:43 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726639AbfCLOvz (ORCPT + 99 others); Tue, 12 Mar 2019 10:51:55 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:41917 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbfCLOvy (ORCPT ); Tue, 12 Mar 2019 10:51:54 -0400 Received: by mail-ed1-f66.google.com with SMTP id n14so2534268edv.8 for ; Tue, 12 Mar 2019 07:51:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gqBj8nH0pazADWytM/e0oIVEVNfp64FgxLQOymyNMA0=; b=cazKa5SZg50YtR4UhOAI6N9pChENEOY5gKPFsrNeK8aCFB7PNXNXkAfZpRZiYJaQ+z vpXuOapdNI4iW/KQvTm57TzaxB2AYr/+t+IkJXdMrkyGCbxU7EovmhvaGxxKLraI5tXj tgxpT6WsOgn9vfRMMUVMVbCZjHQYLyaTPs2Dd2YwZwwwtquuFRhzt+74zFzbA1AodqvG pWHg2me8Nf4pPFxjosvI5JYBcIGzOX2IDu9V5zvzrx3EVLBqjmlbu3vYCU1gv+dol865 BGsmfP6PmpWSgWA11YgTiyshdVtVla4TDaVCk0J7pqoLin6KQwrS/JLOx0qG8Y3B7yGe 3LcQ== X-Gm-Message-State: APjAAAXsO4JORchGB/xsTdT/oXQGOCbTaVFQgUwjRdgu8jwPVNTFs2O1 TMuZSHB6WdnquSAv1UbXuKoLSmnB28A= X-Received: by 2002:a17:906:288d:: with SMTP id o13mr26416110ejd.66.1552402312677; Tue, 12 Mar 2019 07:51:52 -0700 (PDT) Received: from shalem.localdomain (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id k3sm449809edn.43.2019.03.12.07.51.51 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 07:51:51 -0700 (PDT) Subject: Re: [PATCH 1/2] i2c: i2c-designware-platdrv: Allow a dynamic adap. nr without an ACPI fwnode To: Jarkko Nikula , 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: Hans de Goede Message-ID: <4b54ad0b-c3a7-3286-08bb-fda1cd243285@redhat.com> Date: Tue, 12 Mar 2019 15:51:51 +0100 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: 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 12-03-19 15:47, Jarkko Nikula wrote: > 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? I've just completed analyzing all ways a designware_i2c (or compatible) platform device can be instantiated and I've come to the conclusion that always using dynamic adapter-nrs is fine and is a proper, clean fix for this. Also see my reply to Andy which I send about the same time you send your reply :) Regards, Hans