Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2959973lqz; Wed, 3 Apr 2024 13:42:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWDf7jffVRWHfnyTq9/QkB0uJxkf5pONXIfwQDCN0ijqxFlaCgWveXqeeKIi4Zzxe1yl1SvtYB9kiEmfUJnk4ux1B6O19lu9EmzdEOBOA== X-Google-Smtp-Source: AGHT+IFurTojOuu01EcLXWqIpbt29jsK27f659gO+feI0zS33/ftJSs75Vu8CUXuJ24t1iIOLvtU X-Received: by 2002:a17:90b:364c:b0:2a2:5678:2d75 with SMTP id nh12-20020a17090b364c00b002a256782d75mr746155pjb.9.1712176946590; Wed, 03 Apr 2024 13:42:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712176946; cv=pass; d=google.com; s=arc-20160816; b=ESTfQET9SLBdh4tP1WBhRghA1WYQnvEWz7eC3PKKGq6ykkJ3yeTT6z9EpRcjgPf4NW fha1e3lBLUM+rSkRqGJGETuPaQ6cVanYno7/0MyfShZYkQiLxa670CajMWEDdxJ0tQcd dy1+BghsQXZaYvJ0E4hB0LQaxfutO36DgQaqBl02Q0qEybYz05Lv+P9N25m4hYd1jPr+ 6byszRryIohbVJ5YNhGfMMX8csznfd7uH0+MG7IWf19J5n8UfamqA2j4xVyw8c5NSTBn aX3W6sPOrL5BHmt45QrWCKoRmyEk1/pWZbB6NU0IkgYxeQBRIia+RvhTksxRSjEnfRsF uvEg== 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=kN8uor3TFZ1XDxUmVKlBH/TOnvxRGZwHhs7wYGaT+2E=; fh=i+PExZ+cimXKTWL25Jq1zMyFJQ7RC4yt/V5YiI3xmjw=; b=l1HOHyjUabLC58lDyI5uLNluxtvqVXPBkmPDkOYIuV+rC8VS6nufFgIekmB3r2AIPw DAlX1iKN4n0b5ue4erUkwuYRXVJFsrSTTLydL61qfFjMA61Y90gKSC0Eub5SbI05zN35 YILk1SQTrZI5NijMy9auMSgZhIwWwhnSjzJA69dX4uGnrjNlZHzS8uvDp0p1WESYtQe3 M2jJ4xJ8cfijWrtnV7ODwrD7Xq4xqXlVxmckIkrswvPyPSc/wgPk9+wf+YAWQHAsS4V9 glj3iq9p00nmTEYOvyb5987/I6CQgbeGPIIPit9cHuW4QFGJjxNTiXLKa2eg6esbiXgv 2AgQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=dAfrhcC8; 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-130580-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130580-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id mh15-20020a17090b4acf00b002a161b13a14si232320pjb.93.2024.04.03.13.42.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 13:42:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130580-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=dAfrhcC8; 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-130580-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130580-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AE0EF286E86 for ; Wed, 3 Apr 2024 20:42:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31922156873; Wed, 3 Apr 2024 20:37:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="dAfrhcC8" Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (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 AB7E91586E0; Wed, 3 Apr 2024 20:37:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.142 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176633; cv=none; b=Jof5x+s+r7azW3BS+7/V4vzS5ffuGXfpw5yURMM9LgSkHUjK/s8M39/zlH51I4uowyq0r4DxFA8Zpb9qnAwHQRbWsm/en238Kd6udbz7oF5/Oy2WFr3hif5H8+hQuxzanEeO8ZNcw8U7HO0NBtYeL/VgPgdZCcsrtInJjiAbm6M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176633; c=relaxed/simple; bh=P02+nXdJbqfYxf4tQf2Pbpb0u9iI7e2xMOts+NOqO5w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JgrA7ML1eOYwculNoKYxCalzCVeUpcedHavQH3F4D3pXxuYuc+qQy68dMqaPkA+lJ4XZDBvWlYeLdgl4SzhFTieO0bLSjqICtaqe+UQAyDPHGGWUuwr4dxRGN3ef03Or6G7zuSmQClKuPkyuTQTaFOO76HgG8AlgEnDlODldh+g= 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=dAfrhcC8; arc=none smtp.client-ip=198.47.19.142 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 fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KahUQ038556; Wed, 3 Apr 2024 15:36:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176603; bh=kN8uor3TFZ1XDxUmVKlBH/TOnvxRGZwHhs7wYGaT+2E=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dAfrhcC8JFnS+fZguTPZkrDrYSbGR3YJoHjpdrnKn96qtXo98EoHrE3cGtmV8MzNW TOAt1lj+XwLjTfT/7o21rQYmaEp6MwN1sdOZ+OmZzCkMiFeotdAgbtyhTu5ZxlKMXv tiJuaODsIiLSI95PYVZkYEVTQrBBhMLKBO/6YqmY= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433Kahsi115311 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:43 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE108.ent.ti.com (157.170.170.38) 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:43 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE114.ent.ti.com (157.170.170.25) 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:43 -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 433KaYG7080324; Wed, 3 Apr 2024 15:36:42 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 26/31] hwmon: (thmc50) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:28 -0500 Message-ID: <20240403203633.914389-27-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/thmc50.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwmon/thmc50.c b/drivers/hwmon/thmc50.c index 68ba26bc90142..0cbdb91698b1f 100644 --- a/drivers/hwmon/thmc50.c +++ b/drivers/hwmon/thmc50.c @@ -377,8 +377,6 @@ static void thmc50_init_client(struct thmc50_data *data) i2c_smbus_write_byte_data(client, THMC50_REG_CONF, config); } -static const struct i2c_device_id thmc50_id[]; - static int thmc50_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -391,7 +389,7 @@ static int thmc50_probe(struct i2c_client *client) return -ENOMEM; data->client = client; - data->type = i2c_match_id(thmc50_id, client)->driver_data; + data->type = (uintptr_t)i2c_get_match_data(client); mutex_init(&data->update_lock); thmc50_init_client(data); -- 2.39.2