Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2958576lqz; Wed, 3 Apr 2024 13:39:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWXxu10X30PdOXii5h3fDT4ScPaog9nvCBFZoF0TUT6O1Nr2S/vIlZaTSTt82dB11uCwB53+1VmVRvfAielJiR+1Z7qZBC9xDySmRWrBg== X-Google-Smtp-Source: AGHT+IFokK0Eyt3c8UQ44n1V2hKfuYzKk0vMsJK7tt3pUnB4oDHnRQvZ5KTZu5mccg7F/h3TOwF2 X-Received: by 2002:a05:651c:a:b0:2d6:f96c:d84d with SMTP id n10-20020a05651c000a00b002d6f96cd84dmr488005lja.16.1712176753008; Wed, 03 Apr 2024 13:39:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712176752; cv=pass; d=google.com; s=arc-20160816; b=MjDKKROAkA5Uv6pyBx7MMvHWwkAhM6uSozL3Y/h0wRf/fdMSdB7Ie6hpiirbt3IX4s kH2xoxpvz8GDDn9m5CAhU1QjptPefw9WRKIpYrN45itjjH/s8ugt4TDFg16L7Rfzn8PJ daus2LuVUJGylFNRR68pNYgldp73LM+1zJjdVaKfZaLAJ4FbQ+1asQMt5gKWJMsZcSv1 SJzDQgDw+tL3m/5j/q1TsFGF0GUTLmHuAivB1wwZ513/5M0laRE0xEqcAQlCvdvdZlW0 +Sue9RVQXLxFbsjePrOQnW1O2/a2buKpjQaLutHxNrC1PEjBElJdQkR/aMnBV2d/Z7sk qiDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6DEGN4nAIfd3RQhP5Fz/NRZUeXyTFS4FPVxxybZT31Y=; fh=i+PExZ+cimXKTWL25Jq1zMyFJQ7RC4yt/V5YiI3xmjw=; b=cpf4RIcAfD7U/RAr7JCNXWPrVgDefBDZ0q4l5eHtLHuLO12YKSUV2b2qgzyNLuYjYv yLcvAIzr+ESyKxmaM+NZzsDqWSaKmqbhMF25zsx2mTalCghOrdhQ5yDzzZVkvfbXb5AG YL/ziVxu2LqKpdaI6mAqgnnD5MQ5krVfH8qYLVYpWEFCF1KGN4xisJaEx1JH1lo01eUw DhrdGoWd3Tp8DavTa982B4kl5Hj9LnFWt2fpCuUC+9UZyVaknB0XGWIDcqZAYx9UROVg dXExP9cWI84TOJ8xk7Yhpdejkqelm7HSfSyUYbkFgKkOi/05j4rfFfdk2/pz7N6Og4+j BlhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tL8k3L59; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-130564-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130564-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m25-20020a50c199000000b0056c38f7295fsi6922773edf.602.2024.04.03.13.39.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 13:39:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130564-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tL8k3L59; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-130564-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130564-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B410D1F20FF4 for ; Wed, 3 Apr 2024 20:39:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31BA3157499; Wed, 3 Apr 2024 20:37:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="tL8k3L59" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (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 82D00156F45; Wed, 3 Apr 2024 20:37:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176625; cv=none; b=H9B3GxeZIqkmG+mCRzYU8dgD1vMkHx308zgtPLPTFMyiVllOYAbSD+M1ogst7BxZzdm0i4XHiaBiFgKQayBeckdTC2nU989kwTtWrRrWyoa6hzpjerZ4amKhbKEIIxDeE/zQ97ImmOoBayqlPAuwJzp7hkpsEN5U+2qclg1B8Ic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176625; c=relaxed/simple; bh=dd77OrNZL5J3wZAkMZdRnvSHJ1xLyAd8ySxxVnUvM9M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hlRghMeqyhlnPhD6O47uZ64mnFdK+qDchcR5+VyGxm25BFMpk/F374Urr54aolvgbf/h1CbjYhDM+cMpTzhbnuvZis+JmvNHsUg0r8kZZnwNuZrILSxISS4sdF9F08Cr6kII1lAEhuYQdx7Uplps+xVJCH4hDlti9NOaQ2s71VA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=tL8k3L59; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kaewl076324; Wed, 3 Apr 2024 15:36:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176600; bh=6DEGN4nAIfd3RQhP5Fz/NRZUeXyTFS4FPVxxybZT31Y=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tL8k3L59ZZ1D7VSEcLOL4NCYJmux4djtub4yGFuRjcY9tnfaNEwcLmGxJD+b8g2AI umXjc9WX6QfPA9Vj5fqHhA5HuMZvi7Ob1DpErhNLWj4BYFA0fiNH9cgyPUP6tB41uS 0lqktePlPsiKlJK10bhfavwxwS+k1FAIw66GEag4= Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KaecH115284 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:40 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 3 Apr 2024 15:36:40 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Wed, 3 Apr 2024 15:36:40 -0500 Received: from fllvsmtp8.itg.ti.com ([10.249.42.149]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 433KaYFx080324; Wed, 3 Apr 2024 15:36:40 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 18/31] hwmon: (lm95234) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:20 -0500 Message-ID: <20240403203633.914389-19-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240403203633.914389-1-afd@ti.com> References: <20240403203633.914389-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 The function i2c_match_id() is used to fetch the matching ID from the i2c_device_id table. This is often used to then retrieve the matching driver_data. This can be done in one step with the helper i2c_get_match_data(). This helper has a couple other benefits: * It doesn't need the i2c_device_id passed in so we do not need to have that forward declared, allowing us to remove those or move the i2c_device_id table down to its more natural spot with the other module info. * It also checks for device match data, which allows for OF and ACPI based probing. That means we do not have to manually check those first and can remove those checks. Signed-off-by: Andrew Davis --- drivers/hwmon/lm95234.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/lm95234.c b/drivers/hwmon/lm95234.c index 67b9d7636ee42..be00a374632d3 100644 --- a/drivers/hwmon/lm95234.c +++ b/drivers/hwmon/lm95234.c @@ -677,10 +677,9 @@ static int lm95234_init_client(struct i2c_client *client) return 0; } -static const struct i2c_device_id lm95234_id[]; - static int lm95234_probe(struct i2c_client *client) { + enum chips type = (uintptr_t)i2c_get_match_data(client); struct device *dev = &client->dev; struct lm95234_data *data; struct device *hwmon_dev; @@ -699,7 +698,7 @@ static int lm95234_probe(struct i2c_client *client) return err; data->groups[0] = &lm95234_common_group; - if (i2c_match_id(lm95234_id, client)->driver_data == lm95234) + if (type == lm95234) data->groups[1] = &lm95234_group; hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, -- 2.39.2