From patchwork Mon Aug 12 20:39:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13761012 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46D9D19413B for ; Mon, 12 Aug 2024 20:40:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723495222; cv=none; b=rhhnJ0n9lauEACVeSGBLCgIJqp/0PLZ4VAJtvq0axflV9NUBxU64RSn2xFb6IawKoAKfPXVbFjA0KhB5bbj4IUsV9qtZH7wJhhww6jkyNnbqHNMxKSEMc5WGEz3bMOnau3nQg+Kw3DtL4Uj390/esWJvS3vMjk0OYZFy87WYCJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723495222; c=relaxed/simple; bh=5+h7LrxRm2YP0UvKXqib4x8gTfADd9a1hcAQyjkyqr4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=D/yQL86a9LvOga4k96ltXRUvA/YC0Wa1xhrzPtU1Dcl5EcBVRQQP3piRXfObZDKRA4icp39KWv+uVHD8c3JiBA/YUd/M7th7u7hnkHnWuxz/MwiN4J7F3l9XjPqutWzmiM/TAp0WveaGsjEhUs0Yhfb7WUpz+MnbwANpiWKd65k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=IX48+AT1; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IX48+AT1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723495220; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y1NPK68/C9CpkA3feqUMOCzmmRt9IgwIJp7CsoumXfc=; b=IX48+AT1iOx18hzK8ApMev3d5ky/OH3QZf0gQsVJL/PNZxCm65ETen6RP7KQs2t2iAl5yX QS7aK1q2ch+cz8Ny3Ma1Rjn+g3SHAwdyMCCcJcxvp8ktP8M0lwnvhwrrzPnFnWEAOKunQc UtyCEbgN2L4r9DUdyc1CGzAR2fhp4Fs= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-522-NGbTQ0JJP2eYvlfhlKSrww-1; Mon, 12 Aug 2024 16:40:15 -0400 X-MC-Unique: NGbTQ0JJP2eYvlfhlKSrww-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DBAEB18EB22A; Mon, 12 Aug 2024 20:40:11 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.50]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D4C3019560A3; Mon, 12 Aug 2024 20:40:04 +0000 (UTC) From: Hans de Goede To: =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Ilpo_J=C3=A4rvi?= =?utf-8?q?nen?= , Andy Shevchenko , Paul Menzel , Wolfram Sang Cc: Hans de Goede , eric.piel@tremplin-utc.net, Marius Hoch , Dell.Client.Kernel@dell.com, Kai Heng Feng , platform-driver-x86@vger.kernel.org, Jean Delvare , Andi Shyti , linux-i2c@vger.kernel.org Subject: [PATCH v8 2/6] i2c: i801: Use a different adapter-name for IDF adapters Date: Mon, 12 Aug 2024 22:39:48 +0200 Message-ID: <20240812203952.42804-3-hdegoede@redhat.com> In-Reply-To: <20240812203952.42804-1-hdegoede@redhat.com> References: <20240812203952.42804-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 On chipsets with a second 'Integrated Device Function' SMBus controller use a different adapter-name for the second IDF adapter. This allows platform glue code which is looking for the primary i801 adapter to manually instantiate i2c_clients on to differentiate between the 2. This allows such code to find the primary i801 adapter by name, without needing to duplicate the PCI-ids to feature-flags mapping from i2c-i801.c. Reviewed-by: Pali Rohár Signed-off-by: Hans de Goede Acked-by: Wolfram Sang --- Changes in v4: - Use a single snprintf() with a conditional argument for the 2 names - Add a comment that the adapter-name is used by platform code Changes in v3: - This is a new patch in v3 of this patch-set --- drivers/i2c/busses/i2c-i801.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 328c0dab6b14..299fe9d3afab 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1763,8 +1763,15 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) i801_add_tco(priv); + /* + * adapter.name is used by platform code to find the main I801 adapter + * to instantiante i2c_clients, do not change. + */ snprintf(priv->adapter.name, sizeof(priv->adapter.name), - "SMBus I801 adapter at %04lx", priv->smba); + "SMBus %s adapter at %04lx", + (priv->features & FEATURE_IDF) ? "I801 IDF" : "I801", + priv->smba); + err = i2c_add_adapter(&priv->adapter); if (err) { platform_device_unregister(priv->tco_pdev);