From patchwork Wed Apr 3 20:36:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616700 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 95B1E158A1C; Wed, 3 Apr 2024 20:37:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176635; cv=none; b=uDtu3Wg5FnaSp5G09dHs6ayjZwDMrN/aaOTnCrd39WCiHQWJ/xk17LNPw83NlshIUw3652E6ss9Dd5cxTZQLNEb/IcFEP7hePJ7it2q/eONLPZKsfeImf6nC6Tr2kUPSVptZmTHmEXlfFvs0Ps1AuxzmPCPNLahrf/ZrRskLFP8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176635; c=relaxed/simple; bh=+L3wPgJG2F5w/3XKBeCEb5SvyQSpcS6LqZCOy3EyN5E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=blPZioFSICMRBZTlFDmN8PFCQkZPeMo7F0IaQ3YEoNtqkqusV6Cv4IFeZOV9GkjQS7R6Q7OKvB6VaAL8N/WDdgRbjvb30r9oHiu8LMs7oh/XilWs31klqsl20q1kx4dMWoL/d61nT+Otxm+i1CIO++z9tdVakQl51+MfPXy1dYE= 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=JMOlb70M; arc=none smtp.client-ip=198.47.19.141 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="JMOlb70M" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KaZrO076384; Wed, 3 Apr 2024 15:36:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176595; bh=n/lQYuX5u/cQQZZkgcKo4jIV9eSG7CRNsMGVGa/PAr0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JMOlb70MDC6V+qYeJpq6cA/PMi9qDedLtbTCSXQ1tp+TljkRZlwVfQRwZzFvpKw1x 5vOXU+TTxb32g8vL3pdPA2LMQtn63qMLY7Dc09KvEhC5MYV1wH+9o4gCMlEz77r0o3 2admnkllr3/Dy5mtEacuTDAFMa9dJh6DGW6wMhCA= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KaZ1e000488 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:35 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE111.ent.ti.com (157.170.170.22) 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:35 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE103.ent.ti.com (157.170.170.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:35 -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 433KaYFg080324; Wed, 3 Apr 2024 15:36:34 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 01/31] hwmon: (ad7418) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:03 -0500 Message-ID: <20240403203633.914389-2-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/ad7418.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/hwmon/ad7418.c b/drivers/hwmon/ad7418.c index 4829f83ff52e3..7a132accdf8a3 100644 --- a/drivers/hwmon/ad7418.c +++ b/drivers/hwmon/ad7418.c @@ -230,8 +230,6 @@ static void ad7418_init_client(struct i2c_client *client) } } -static const struct i2c_device_id ad7418_id[]; - static int ad7418_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -252,10 +250,7 @@ static int ad7418_probe(struct i2c_client *client) mutex_init(&data->lock); data->client = client; - if (dev->of_node) - data->type = (uintptr_t)of_device_get_match_data(dev); - else - data->type = i2c_match_id(ad7418_id, client)->driver_data; + data->type = (uintptr_t)i2c_get_match_data(client); switch (data->type) { case ad7416: From patchwork Wed Apr 3 20:36:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616686 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 4D30C157E6E; Wed, 3 Apr 2024 20:37:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176630; cv=none; b=rLJmrvBh61zIMbFeLvQE14R9/jKEqONAutdmWUb7qHJPiZB9aRdQeCIRkRbagfT/f+SOSHEumkJzzmWRiNKsJEVD0C9wkJlZC4gch06eLwVgy4jk+43BUVS6dEuvtZWk+PduLNvTsHhkaa/TSmWDBekupSXPLw8xExwBAeLTvS8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176630; c=relaxed/simple; bh=NqGjmDEiTmVXUb0XDnMYpVdBDiAkNMDsmBrzSBd12AU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cRMARC+fpK8DvG4CVG9nloO4IgAMPWYCKGJRyfmCpWCiVp3rlRLOqq0arXUQWidohjvXZlibjf08XupPBQxxIlX4KBZhilc2WHvrnk14Iyqh7e0vgzWJXKAGX4MVU2fAZlg3EhnSD3uQrnJri4BATBtouEj0P8NjfTFrOm355es= 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=NyReIWmu; arc=none smtp.client-ip=198.47.23.248 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="NyReIWmu" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KaZLo079567; Wed, 3 Apr 2024 15:36:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176595; bh=m/N3CzMxaS7yhX0k7iLE7QjhuIiupwLxVyAaTqmAzeA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=NyReIWmu5N1TL8HhMeraskEkpT++N7yolDcmZtyYjod9FWyUpC2rPN4a3tXkI6J5X bg/V3Sf3gYD2iHR6HvUUUYO7mhfgtNpz9cNHpo87oQucvgvL5xDG3jIrHkLos5l0aA Kd2GV36K3ZYkzQAK4Qu5e8SU1h6bPa0f3PKb24ls= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KaZd1000493 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:35 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) 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:35 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE110.ent.ti.com (157.170.170.21) 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:35 -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 433KaYFh080324; Wed, 3 Apr 2024 15:36:35 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 02/31] hwmon: (adm1021) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:04 -0500 Message-ID: <20240403203633.914389-3-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/adm1021.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index 7c15398ebb378..87b42e0cfd2ef 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c @@ -440,8 +440,6 @@ static void adm1021_init_client(struct i2c_client *client) i2c_smbus_write_byte_data(client, ADM1021_REG_CONV_RATE_W, 0x04); } -static const struct i2c_device_id adm1021_id[]; - static int adm1021_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -453,7 +451,7 @@ static int adm1021_probe(struct i2c_client *client) return -ENOMEM; data->client = client; - data->type = i2c_match_id(adm1021_id, client)->driver_data; + data->type = (uintptr_t)i2c_get_match_data(client); mutex_init(&data->update_lock); /* Initialize the ADM1021 chip */ From patchwork Wed Apr 3 20:36:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616692 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 007851581EA; Wed, 3 Apr 2024 20:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176631; cv=none; b=rZ3ZnYGSwFtSArGaln18J/DUJluRoWRCtYWrW54aDeLJfmVXNMQrHJXQXkRq4dalZ+vDYA3LXROYnnq0xInjQSwZJSsnPzUNC1k+T/uauGYLTaenkUVoqy12PuwzfYoImkIBBh+IjMMY+Y3gBM+n8nl+85sMCpMh7u3KGo5TF4M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176631; c=relaxed/simple; bh=htYl1xEKTxhf+91LyIRRinKUV2fmdiibhEQeoLxwBaA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OGag/Q76WWdgPQwbrlGgY4OWj9EjkkJhfoNBAEoRVs8XnaBqWMocc6gHrFPBxTOXbxo6peIbW7aDQ63ItMsXmmKKZKzN+ocX4UnX5FAovG1XZk0GY+bX2MYGSPEZ7w/kpgaPE5TXRJJ6Y477Zco3cFg7R+3mqmTTpUia4bIdgOs= 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=GAWQIJBX; arc=none smtp.client-ip=198.47.23.248 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="GAWQIJBX" Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KaaZ7079571; Wed, 3 Apr 2024 15:36:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176596; bh=vLG7nR3cXKqdnmHs0sRyFkgQxJmyQMwMWdu+b28S8xk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=GAWQIJBXnDF3pCwa6hkTnjJgFBrxfsnxvV+X2tFZ2KzY+vWrN1PUydgAIuA51kpCt hsqeqW3d0Jmv3Ac/KGZrsO9A/fG9EOi/ObUHw8cYNlF8T2ZWX9NdvhDFc3+l0mTAsv aS5swoLdt9Pnx4uAoPmfNIJKTcDjc8AM7brWgd4Q= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KaaUR115231 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:36 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE115.ent.ti.com (157.170.170.26) 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:35 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE106.ent.ti.com (157.170.170.36) 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:35 -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 433KaYFi080324; Wed, 3 Apr 2024 15:36:35 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 03/31] hwmon: (adm1031) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:05 -0500 Message-ID: <20240403203633.914389-4-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/adm1031.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 88c7e0d62d089..343118532cdb4 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c @@ -1021,8 +1021,6 @@ static void adm1031_init_client(struct i2c_client *client) data->update_interval = update_intervals[i]; } -static const struct i2c_device_id adm1031_id[]; - static int adm1031_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -1035,7 +1033,7 @@ static int adm1031_probe(struct i2c_client *client) i2c_set_clientdata(client, data); data->client = client; - data->chip_type = i2c_match_id(adm1031_id, client)->driver_data; + data->chip_type = (uintptr_t)i2c_get_match_data(client); mutex_init(&data->update_lock); if (data->chip_type == adm1030) From patchwork Wed Apr 3 20:36:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616703 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 D567D158A24; Wed, 3 Apr 2024 20:37:13 +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=1712176637; cv=none; b=TQlHwD4akgVc04ljXIQeR8stZo4KcQXRbhV3u0/z4Jp+79ynsKy2X3MrG+c32JDQ26+ZVrGdW6s6CU87yjmfftPpgFsKT/HqJGBKr7WNswrWkwu72WrRhjg9RT0Kezb1HmdIVtK/qTqP4eEKIAT4Q/wTYu7djb4E2XZe5EkhiHQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176637; c=relaxed/simple; bh=DcJqhwHAqxnaGiAFyieMHYH+qxPUuLYnJBVlpdIApVw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FOPhatDrj6SviuVSkV+kfNV+gcCpRaraBPKu/qhVCUZxPcls0Nz0L1DyYyKwqPfhp8C7KzYQqtGaj3qPmi5Y+yyiPInxyr3j+dGh6VlwhMpL022cKpZvk7Xp7/kiPicl1+/pkWPlnfzvcOpZkzpeKUD+PpIC8HU0sQML18qx54s= 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=BYHPS/q5; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="BYHPS/q5" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kaavv038522; Wed, 3 Apr 2024 15:36:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176596; bh=vO3CrxDkXJKU7WHeaTF/07p+El0Cl3/7dNxjIIWuxBA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=BYHPS/q5eT+Ouncd/sa3IE+mkOB3vVlJ0kGb5RNgWkreWy9AnATvYgsNKhL+N26pU eqzeM2tuKkOkC5PjEzkPWXR6lVI/HjCzQKk8kJg7GhyW72/NxY2dKhXtxvIRnatJJV Yab51GiQipZPPI2dDarbZshQXkoA3iQs6j1DxE/c= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433Kaa4K000507 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:36 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE115.ent.ti.com (157.170.170.26) 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:36 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE115.ent.ti.com (157.170.170.26) 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:36 -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 433KaYFj080324; Wed, 3 Apr 2024 15:36:35 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 04/31] hwmon: (ads7828) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:06 -0500 Message-ID: <20240403203633.914389-5-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/ads7828.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c index 809e830f52a6b..436637264056c 100644 --- a/drivers/hwmon/ads7828.c +++ b/drivers/hwmon/ads7828.c @@ -99,8 +99,6 @@ static const struct regmap_config ads2830_regmap_config = { .val_bits = 8, }; -static const struct i2c_device_id ads7828_device_ids[]; - static int ads7828_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -138,10 +136,7 @@ static int ads7828_probe(struct i2c_client *client) } } - if (client->dev.of_node) - chip = (uintptr_t)of_device_get_match_data(&client->dev); - else - chip = i2c_match_id(ads7828_device_ids, client)->driver_data; + chip = (uintptr_t)i2c_get_match_data(client); /* Bound Vref with min/max values */ vref_mv = clamp_val(vref_mv, ADS7828_EXT_VREF_MV_MIN, From patchwork Wed Apr 3 20:36:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616674 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 5E4EF15625C; Wed, 3 Apr 2024 20:36:56 +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=1712176618; cv=none; b=UihXsl71lg/dpdK+SOvchyKrw89PfGYrG6IychRWfo0S/yKnX59lb8cPdVYoVQgH0wde1NZH3yHV/XOa8onLy6fgdGnHtxR/tG6UeP1EfDM8WA07t+aKmpLBIP3Q7G+HHlRroup6xO/NUl3xFid4ZIMQCTVSBrm6uH07KXqrmps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176618; c=relaxed/simple; bh=YAfBzgHyxT/OlQjSIEKq5otHy5Sx3imuMxJ0Pv0RfP8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OtnYIs/jYpTDXDexOT/VSDskWUeEOcvrP8SWt+M7VeDBVaJmRufGC56BDwaYz+jQHznOu0j4GQ3yANFFyOI3LXnYeo92EtSJ7vwBpEoDuOqIk+6nT+8rzrd6sf0l1IRLW05Nu3Ww/QNfqJ7VKnbK0kWbJ5Lz+X8Kp2u/KfX/HCo= 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=cyw/WEH9; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="cyw/WEH9" Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kaa3G076293; Wed, 3 Apr 2024 15:36:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176596; bh=wUqUo35lVw+/wFCUc/qn97gM/nTw5m4+tR7JON2D8aY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=cyw/WEH9SDJUigjqq4x9/wHN6TRj+ObYzjlDWzIDQkD0MMMeBA6Wfvs9BcpP6Bk4y 47oQRuwUcbIVQtkSVdorHlaZEiOI4NpMYsx2vLhTnFelQEHzqIR4mwgVj5+5KcRz3S NYM7gk6dxb0aDQWp5tC7V7Zjqhl+08togu2+TDc4= Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KaaLi092348 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:36 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) 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:36 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE107.ent.ti.com (10.64.6.28) 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:36 -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 433KaYFk080324; Wed, 3 Apr 2024 15:36:36 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 05/31] hwmon: (adt7475) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:07 -0500 Message-ID: <20240403203633.914389-6-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/adt7475.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index 4224ffb304832..5f78e66330187 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c @@ -1676,7 +1676,6 @@ static int adt7475_probe(struct i2c_client *client) struct device *hwmon_dev; int i, ret = 0, revision, group_num = 0; u8 config3; - const struct i2c_device_id *id = i2c_match_id(adt7475_id, client); data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); if (data == NULL) @@ -1686,10 +1685,7 @@ static int adt7475_probe(struct i2c_client *client) data->client = client; i2c_set_clientdata(client, data); - if (client->dev.of_node) - chip = (uintptr_t)of_device_get_match_data(&client->dev); - else - chip = id->driver_data; + chip = (uintptr_t)i2c_get_match_data(client); /* Initialize device-specific values */ switch (chip) { @@ -1717,7 +1713,7 @@ static int adt7475_probe(struct i2c_client *client) if (!(config3 & CONFIG3_SMBALERT)) data->has_pwm2 = 1; /* Meaning of this bit is inverted for the ADT7473-1 */ - if (id->driver_data == adt7473 && revision >= 1) + if (chip == adt7473 && revision >= 1) data->has_pwm2 = !data->has_pwm2; data->config4 = adt7475_read(REG_CONFIG4); @@ -1730,12 +1726,12 @@ static int adt7475_probe(struct i2c_client *client) * because 2 different pins (TACH4 and +2.5 Vin) can be used for * this function */ - if (id->driver_data == adt7490) { + if (chip == adt7490) { if ((data->config4 & CONFIG4_PINFUNC) == 0x1 && !(config3 & CONFIG3_THERM)) data->has_fan4 = 1; } - if (id->driver_data == adt7476 || id->driver_data == adt7490) { + if (chip == adt7476 || chip == adt7490) { if (!(config3 & CONFIG3_THERM) || (data->config4 & CONFIG4_PINFUNC) == 0x1) data->has_voltage |= (1 << 0); /* in0 */ @@ -1745,7 +1741,7 @@ static int adt7475_probe(struct i2c_client *client) * On the ADT7476, the +12V input pin may instead be used as VID5, * and VID pins may alternatively be used as GPIO */ - if (id->driver_data == adt7476) { + if (chip == adt7476) { u8 vid = adt7475_read(REG_VID); if (!(vid & VID_VIDSEL)) data->has_voltage |= (1 << 4); /* in4 */ @@ -1829,7 +1825,7 @@ static int adt7475_probe(struct i2c_client *client) } dev_info(&client->dev, "%s device, revision %d\n", - names[id->driver_data], revision); + names[chip], revision); if ((data->has_voltage & 0x11) || data->has_fan4 || data->has_pwm2) dev_info(&client->dev, "Optional features:%s%s%s%s%s\n", (data->has_voltage & (1 << 0)) ? " in0" : "", From patchwork Wed Apr 3 20:36:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616699 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 A856E15885C; Wed, 3 Apr 2024 20:37:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176634; cv=none; b=GrY8XQaOYYuSvFDCuNKN6sH2+oGkB6CvRET6lw1kKqEU57eV1tE1CT0oeXiJhadgXoc0bW3eDX7+mtFF74qF7UbzteO5aCtUCHE4NtsrOZ/ILNSXbY7vZGqBYzhelq4CF7qFyR85GbQ/vjliuqzAO74iLHABWDuiqLEHAp8pEBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176634; c=relaxed/simple; bh=OuyFG07uniwB23FrwfjyibbHLOUKBP2QbqqS5rtW5Kw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZJGQ438sLdWAK7pbnGWbNf3ejHRoxfZW85TN/PJmuOQcG9LtIb2v/cmwh9Z9ffempwvr8FvHOjxvZem8GRzqn0SRQbI1+ycRRc/GoXWb3NYM4jSKu8M/g0VkvAV4R6iII/+/YXdm/Dkz3ZRzMhFvILPmBZDVNeVKavZtAHJ7WWA= 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=qkvTq5ki; arc=none smtp.client-ip=198.47.19.141 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="qkvTq5ki" Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kabbb076389; Wed, 3 Apr 2024 15:36:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176597; bh=P9m8XX8RkK7F9kUnAd6NeB+F6XpajJFyRRLbsFk3hWY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=qkvTq5ki8JM08wmpYmi6lROYyTNc11PHe+sioJitcB9+GP+yLAxCzuG/grcFirpcp afDTokK2y3+QgPwfGps4AL6WOUJ0salYMI/AHtbf5dRMFa+yerX1D/7Q5rgCuiU1FW mF6C4FftYFiw8uuohFEG2ri7dGkoL7Gud4DFnRLM= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KabWi115241 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:37 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) 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; Wed, 3 Apr 2024 15:36:36 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE101.ent.ti.com (157.170.170.31) 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:36 -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 433KaYFl080324; Wed, 3 Apr 2024 15:36:36 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 06/31] hwmon: (aht10) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:08 -0500 Message-ID: <20240403203633.914389-7-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/aht10.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/hwmon/aht10.c b/drivers/hwmon/aht10.c index f136bf3ff40ad..312ef3e987540 100644 --- a/drivers/hwmon/aht10.c +++ b/drivers/hwmon/aht10.c @@ -331,8 +331,7 @@ static const struct hwmon_chip_info aht10_chip_info = { static int aht10_probe(struct i2c_client *client) { - const struct i2c_device_id *id = i2c_match_id(aht10_id, client); - enum aht10_variant variant = id->driver_data; + enum aht10_variant variant = (uintptr_t)i2c_get_match_data(client); struct device *device = &client->dev; struct device *hwmon_dev; struct aht10_data *data; From patchwork Wed Apr 3 20:36:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616673 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 5E51B15625F; Wed, 3 Apr 2024 20:36:56 +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=1712176618; cv=none; b=cAPkTXy7j/ed+TJMWRUzsqMj9DzlXSRccOdpSorw+uv1a8D4oL0gV/RZoXKZHOTg/EPbjGfE+bLXDwevZs7n6BK/wXPvCM35FYTiGixq7yhIerLsCqrkqT0OkRE2yIAIoUOcj0crXNwrqVkgzAdBL0W23Bqgn67NBm4Ca8cV/90= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176618; c=relaxed/simple; bh=AmutkIMXoFoI+xlbdmM8YrB8Y5IthRp4+Pww6eKMnOk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PgvV06orn6oXVyAqPkkZhg+h39OSi9d7auL1eZiqsFNYe2u1wH3mWP880oWYfX4xrKOuXDF7PNLeICsrsDfGsAqjdyOc8oPxy4rCdGQbZdLXcoT7fZK9KzwqCvzxp9h60bTGZj36+4KdLs1hfIGO31iULqFe6awlI251VKJSrgA= 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=vvTen/Kx; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="vvTen/Kx" Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KaboY076297; Wed, 3 Apr 2024 15:36:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176597; bh=s0eXc4e7+KokmvhKQNCW52y6DVPW/nkE8HC0W8JHKPQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=vvTen/KxyPGjFL9as658R1PWVvcPs9oWzXISlI68wU0Ab07oVH/rhOKZO3RqBkDnX ZjCn5jC8Hf9cqfNJLyJN0FIGIT2RNGekPogARw1/IdX/ce2tGdJfZqYYoLaPf+Qg/Q LqLjep7zDyzrsgR4RxzM4/bkwn/zhNT/f//fwDnU= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433Kabxt092362 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:37 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE108.ent.ti.com (10.64.6.29) 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:37 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE106.ent.ti.com (10.64.6.27) 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:37 -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 433KaYFm080324; Wed, 3 Apr 2024 15:36:36 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 07/31] hwmon: (dme1737) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:09 -0500 Message-ID: <20240403203633.914389-8-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/dme1737.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index 3dcef221041d0..1a9b28dc91e64 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c @@ -2461,8 +2461,6 @@ static int dme1737_i2c_detect(struct i2c_client *client, return 0; } -static const struct i2c_device_id dme1737_id[]; - static int dme1737_i2c_probe(struct i2c_client *client) { struct dme1737_data *data; @@ -2474,7 +2472,7 @@ static int dme1737_i2c_probe(struct i2c_client *client) return -ENOMEM; i2c_set_clientdata(client, data); - data->type = i2c_match_id(dme1737_id, client)->driver_data; + data->type = (uintptr_t)i2c_get_match_data(client); data->client = client; data->name = client->name; mutex_init(&data->update_lock); From patchwork Wed Apr 3 20:36:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616682 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 5FFB1156F52; Wed, 3 Apr 2024 20:37:04 +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=1712176626; cv=none; b=Pmwl8Kxdk4qUN1hAesBJEj75nbTUkjhWEVoJBZlQN3tWNgR16k3MjjzHnrV/+vdpu7wUXHN2+NVootOiRu0jyFyFBr2y0mF5gLcMKYEqtxofoxXdbrHy9LBqTihLKGGKOXP6XAtfgas/+hBQYkHRMZMD3yQIYCBoKBhuLgLUcWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176626; c=relaxed/simple; bh=Fcsy7U0/zN4YmwfH+1lI8fpDJuJo06ipaQB7zIKzDkw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mk5lI+cOyGz0Y+gJTRbHumh9T6I46OYIJHQREfoNb+4tpcJ0Jvp5lYuyF+3GSmwTRAu10lX1TNHDMfM155GNqOlqcnsfgkkpsK0NFqiuwHPIQu/vHEnm/YgrGbcHFhKsHxGfHrKUbKjez4xZng4fswspXq8GS16YQ4OyWfya0FA= 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=HmMY0tAM; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="HmMY0tAM" Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KabcX076301; Wed, 3 Apr 2024 15:36:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176597; bh=blgQGHWD87ZJY8vnu2bep0EjvDVDGNrPkRIBtJghVk8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=HmMY0tAMhdfdouDPjzAN2+sw9c//xoMa7P7RbhZgXAPRZcfUV62vm/deSm+2x4c3U DmPMsKVeRb9NYa4gBcR9mMHAVephocVYigUgaP5MepbGfnCQdoViIzi7ZfBjthVwkB Tu7yY7xfM2ALmGRML4yFOGHZQXqUtmWLXUcenV2U= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KabEa092365 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:37 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE109.ent.ti.com (10.64.6.30) 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:37 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE104.ent.ti.com (10.64.6.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:37 -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 433KaYFn080324; Wed, 3 Apr 2024 15:36:37 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 08/31] hwmon: (ds1621) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:10 -0500 Message-ID: <20240403203633.914389-9-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/ds1621.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index bffbc80401718..42ec34cb8a5f8 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c @@ -342,8 +342,6 @@ static const struct attribute_group ds1621_group = { }; __ATTRIBUTE_GROUPS(ds1621); -static const struct i2c_device_id ds1621_id[]; - static int ds1621_probe(struct i2c_client *client) { struct ds1621_data *data; @@ -356,7 +354,7 @@ static int ds1621_probe(struct i2c_client *client) mutex_init(&data->update_lock); - data->kind = i2c_match_id(ds1621_id, client)->driver_data; + data->kind = (uintptr_t)i2c_get_match_data(client); data->client = client; /* Initialize the DS1621 chip */ From patchwork Wed Apr 3 20:36:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616679 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 D815B156F32; Wed, 3 Apr 2024 20:37:02 +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=MrazafK7KYd9N/JVmzbtbvD6PBkK8jvInqWpKvRkRfcsCMbIglV1fmsrRdEH7xmS1QTMjRpaHl25hRvjtJeFeA3pLMvVlS/uHol1lkVVuahp4IQ+9lKjboIXWA8GdxqCipsvUmgv9QRKdgcb/6MBb4HIWfw9a1Coi3A2MrnTk9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176625; c=relaxed/simple; bh=vsxZuXPnc9LZp7BCFMmM+QmqhXEf9M6BtZ3xaM8AQYU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eEhDExGvpQj2Y+09Lu115UuzVWVVLrYiMHL70RdvN3Tr1hlVK3g14BMIunWtZiN8L5TypVe+J0SaG5+RMVPFox272avZ5zeoVt247FPgHBbbxnRq6Fm2M8xRYkwXhmiEEhi93XyDLw8c3CNpIkKSOLzS7xNCfr+Z71KvPImTLgs= 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=PhKum9/H; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="PhKum9/H" Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kacoo076306; Wed, 3 Apr 2024 15:36:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176598; bh=kfaADE72p/7wiRjfacJ24ecKgyHpfOb03uEZTqrrEyI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=PhKum9/HaX/Q+ZnVbMhWvJ50nDthzlGe8BHfu2nfrTZWke0xUIMAyTAZ+arUckQZU JZ0Bc7ykPDgTBHSjFj5sU0MnG68UNwwFr46/4QerZ4/KoSUCnBnw1yW3qFxzgeYf29 hBmHJNWRyQy3bAc8yGSpAN3af2ucU2/aFKf3FNtU= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433Kackn115245 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:38 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE111.ent.ti.com (10.64.6.32) 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:37 -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:37 -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 433KaYFo080324; Wed, 3 Apr 2024 15:36:37 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 09/31] hwmon: (f75375s) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:11 -0500 Message-ID: <20240403203633.914389-10-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/f75375s.c | 46 ++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index 8c572bb64f5dc..7e867f1324201 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c @@ -111,31 +111,6 @@ struct f75375_data { s8 temp_max_hyst[2]; }; -static int f75375_detect(struct i2c_client *client, - struct i2c_board_info *info); -static int f75375_probe(struct i2c_client *client); -static void f75375_remove(struct i2c_client *client); - -static const struct i2c_device_id f75375_id[] = { - { "f75373", f75373 }, - { "f75375", f75375 }, - { "f75387", f75387 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, f75375_id); - -static struct i2c_driver f75375_driver = { - .class = I2C_CLASS_HWMON, - .driver = { - .name = "f75375", - }, - .probe = f75375_probe, - .remove = f75375_remove, - .id_table = f75375_id, - .detect = f75375_detect, - .address_list = normal_i2c, -}; - static inline int f75375_read8(struct i2c_client *client, u8 reg) { return i2c_smbus_read_byte_data(client, reg); @@ -830,7 +805,7 @@ static int f75375_probe(struct i2c_client *client) i2c_set_clientdata(client, data); mutex_init(&data->update_lock); - data->kind = i2c_match_id(f75375_id, client)->driver_data; + data->kind = (uintptr_t)i2c_get_match_data(client); err = sysfs_create_group(&client->dev.kobj, &f75375_group); if (err) @@ -901,6 +876,25 @@ static int f75375_detect(struct i2c_client *client, return 0; } +static const struct i2c_device_id f75375_id[] = { + { "f75373", f75373 }, + { "f75375", f75375 }, + { "f75387", f75387 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, f75375_id); + +static struct i2c_driver f75375_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "f75375", + }, + .probe = f75375_probe, + .remove = f75375_remove, + .id_table = f75375_id, + .detect = f75375_detect, + .address_list = normal_i2c, +}; module_i2c_driver(f75375_driver); MODULE_AUTHOR("Riku Voipio"); From patchwork Wed Apr 3 20:36:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616689 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 CF003157E82; Wed, 3 Apr 2024 20:37:08 +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=1712176630; cv=none; b=C8fuIVLU6fDWFxKyXakmycYZZT7bgpgtsYgf+pYpGq0v7MyJGeayQwcq1ZQGJkk/hSfuPmMKp4D+Ts72s8K5hRCEKIDiRou00Y/yxNyjN+N7EvdbJHH0KQ58QilEx7JlIMNbbU9KFEkH1RpDp5c5PcP3eX77sj9LAXOt3ahujSA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176630; c=relaxed/simple; bh=fXNWup7IqUtwG+h2QdV+4YHz275hWWLttyi3VSXmXvQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PcZT3YRosEPLSc7HVugvmPBrxfNDZK98oLnkU/+6VXqY7CxgE3niMW0cpY9tdDP++Fn7AR2Zsu1ul8XrMwM1KWDnTZyGKi5/J9aQrYMYeINkjjsNFld2LPO+E8VYy7gTogh4MKwkujq5ngAggjgI4sQtIvaqm4YX1RD1sanGfT8= 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=J66E1eHM; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="J66E1eHM" Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kac01038536; Wed, 3 Apr 2024 15:36:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176598; bh=GhjMPqWjizYvmOhLZfcTimybIrBQOrbz030kml+/JwI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=J66E1eHMaZweZm6W4HiKoIP6GODnXoJLAqoKyG3Hr5LF2OoAZuMZzeYr5SgoiJHGp 0ph4+aHM7I9vyZgVRT5KwFGQ6Kn2vWKcPv0E9+YQyBRJ3vXqSK6bLeo4XsIcRot0jv OcqbAjMWU345NRgC1s8Le3A3h/BCgTJVTQLGk6+g= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KacQR115258 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:38 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE115.ent.ti.com (157.170.170.26) 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:38 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE106.ent.ti.com (157.170.170.36) 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:38 -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 433KaYFp080324; Wed, 3 Apr 2024 15:36:37 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 10/31] hwmon: (fschmd) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:12 -0500 Message-ID: <20240403203633.914389-11-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/fschmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c index b30512a705a79..1811f84d835ef 100644 --- a/drivers/hwmon/fschmd.c +++ b/drivers/hwmon/fschmd.c @@ -1087,7 +1087,7 @@ static int fschmd_probe(struct i2c_client *client) "Heracles", "Heimdall", "Hades", "Syleus" }; static const int watchdog_minors[] = { WATCHDOG_MINOR, 212, 213, 214, 215 }; int i, err; - enum chips kind = i2c_match_id(fschmd_id, client)->driver_data; + enum chips kind = (uintptr_t)i2c_get_match_data(client); data = kzalloc(sizeof(struct fschmd_data), GFP_KERNEL); if (!data) From patchwork Wed Apr 3 20:36:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616701 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 957C2158A19; Wed, 3 Apr 2024 20:37:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176635; cv=none; b=pjOWws+0Puu0tHdur866d0IsXiOEnziMnGndxw5Xq6vYjtSJFWqryJPyX68ooTducnY1QxxkmPufXEcVHjeOecFWof4QK1r/eRtG7r7DNUrCKyt5KIE/OC9p0L82Pv9VGZUFUuYoutg7F6fFyREoCFI7F3qHWgJgVJjBP2okX38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176635; c=relaxed/simple; bh=3bF9HZhd95rHubrpI/LggbrJmVwuY2ntRRPOdv3C19Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gsVohDrv2HY/a4ezRRoKGE7cYN+Ja8U4sRRqnODq9+xud1En6xyP0DTMaTILGa1BvyqlQ4zkrAy8FxrcFL+lvmIilKygkohTA2Bm1CMxoOftFZ6TO0yUrrfNxH7R2xCr/qjKKPPi42YfxhpTtKDTWzj+zkW7+ma3kzSS/aaTvFA= 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=s/5jvsvx; arc=none smtp.client-ip=198.47.19.141 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="s/5jvsvx" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KacJ9076395; Wed, 3 Apr 2024 15:36:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176598; bh=7RBoNzKSLhZWWy2KX9GDB0M7SGBppLwxbn39LKIlPqE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=s/5jvsvxVX4M/NH3nLsZzbx5WTCTZifDT4mwNdgC1Ee63jZ2ZqtfSKTEipErGU3io Q9NiKN0zjDWXdHqQPTPqYFRK+5Hg/h5w69JPWwRStgnON6F3a+OidDqxQQ7evin2jk F6wSReUBq7oEtCK+LjMsISNSOLZDF+ePsjnggclc= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KacIK052090 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:38 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE115.ent.ti.com (157.170.170.26) 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:38 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE115.ent.ti.com (157.170.170.26) 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:38 -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 433KaYFq080324; Wed, 3 Apr 2024 15:36:38 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 11/31] hwmon: (ina2xx) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:13 -0500 Message-ID: <20240403203633.914389-12-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/ina2xx.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index d8415d1f21fc5..f8b5d972191ee 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -612,8 +612,6 @@ static const struct attribute_group ina226_group = { .attrs = ina226_attrs, }; -static const struct i2c_device_id ina2xx_id[]; - static int ina2xx_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -623,10 +621,7 @@ static int ina2xx_probe(struct i2c_client *client) int ret, group = 0; enum ina2xx_ids chip; - if (client->dev.of_node) - chip = (uintptr_t)of_device_get_match_data(&client->dev); - else - chip = i2c_match_id(ina2xx_id, client)->driver_data; + chip = (uintptr_t)i2c_get_match_data(client); data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) From patchwork Wed Apr 3 20:36:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616688 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 930CE15667F; Wed, 3 Apr 2024 20:37:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176630; cv=none; b=G70pC2ax7IBcRnx4q8MxY+f9B9fKPjUZLFzGE02McT212oxE+vTwaXnJ8FEY4RulEt0ls0hZ8ltuxDtlMPyFcQ/8MsQ/lbukL46JqwR4qJw8tji4HYyUBY+o1Agw/g8HWPcVJLIa26Ad3LYfl5SqFuIuHzDh6n7qlRn/3wbozoU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176630; c=relaxed/simple; bh=EE3a8uO56b5AjvgZkW4+i7o39kuxOHrCqwj/XV5bbCA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y9OzM9jXj49T6T50yP0vtUxm5/7DvHxhzbzWFCuM9Ca+ktwGTkLgqwWRXSdrVVnbYEDKhAe0bbVbANFlQIrawndiPIhrj49N/SrxpTD1C3MjjOfuGkYs150nm9PzyzOLs95MGbp6HGseAiOwgwIoyb85mqvAqZ2lxbOBTVxstk4= 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=CJEheemc; arc=none smtp.client-ip=198.47.23.248 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="CJEheemc" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kadpf079578; Wed, 3 Apr 2024 15:36:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176599; bh=dVdAD6dEacyKbRyPVKVduhBCWH1pxa9uMiYmpMWe6uo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=CJEheemcRjPis+CZMhVuwBBAQmV4QPkV9z+tRv7vg2a8DwmrEwa3EqsHuFAQF4/2Q ZgaPoJSRdYnLhEMQjzyp0P73sXAQPy0EAGusC5YO01Rrok51SMUgc0XTYRGL9WBnap 8RR63+2lyN4Ly8eCwj+SSGM8RW71YZgiQvKvQHKI= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433Kad2R052095 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:39 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE113.ent.ti.com (10.64.6.34) 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:38 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE115.ent.ti.com (10.64.6.36) 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:38 -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 433KaYFr080324; Wed, 3 Apr 2024 15:36:38 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 12/31] hwmon: (lm63) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:14 -0500 Message-ID: <20240403203633.914389-13-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/lm63.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 0878a044dd8ef..035176a98ce9c 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c @@ -1104,10 +1104,7 @@ static int lm63_probe(struct i2c_client *client) mutex_init(&data->update_lock); /* Set the device type */ - if (client->dev.of_node) - data->kind = (uintptr_t)of_device_get_match_data(&client->dev); - else - data->kind = i2c_match_id(lm63_id, client)->driver_data; + data->kind = (uintptr_t)i2c_get_match_data(client); if (data->kind == lm64) data->temp2_offset = 16000; From patchwork Wed Apr 3 20:36:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616681 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 81367156F44; 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=Mz9ei86zOX0TENHOlfQWSH9+H4rqbft2hPjLpDU2PtZGQWoyEE4rbll0ci0xB2URPR8aafQMqfziFPQHvz4N8shrJOCGZ9Hw3jkIUtjJYfhMOAuzIPJEHTy21Rj6i1OfPd88y9gu1+Tz8qgbIfMVKRUPFePQRmr8PFwHUh54BpY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176625; c=relaxed/simple; bh=WSy/QAN56kZaPJrNA7x6y0ofRhffl7fQnuQXjIwtAtM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V1VX9FxnynvoekDFQheWyf8sn6C4O6T6WrqAFQBUiZQstOgXW8vaTbL/3FrIeJPmpJwmEohH1vRbRmhhRhX25Q1ecegKDIthFvg88XAotPL+LYOR+sS8m4RglxtFbqT1Ib3uhhD1YPqLpc8ZsIY9KxPI13ie3Npad0+e6YkhwpI= 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=Yp33osTQ; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="Yp33osTQ" Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kadbe076311; Wed, 3 Apr 2024 15:36:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176599; bh=cvPlm4tRXW8MQW2aRf7DyIM/MCsuKw+h98ilYvZNBns=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Yp33osTQF0WIxh15wN/PO+3u8eYBRtK5i5BcE6XA8DQeopSHLmtyRqy8kZyVA1j1K tYTin7r32xI3xKPiXd4JKQ2dNYXPD730ruPThglCuJYAP7vtol+sS7YEspcNr411v8 WaVsH2dmNiWCaxbuvWEka/yau0G02Uv62ryZR1BA= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KaduW092380 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:39 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE113.ent.ti.com (157.170.170.24) 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:39 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) 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 via Frontend Transport; Wed, 3 Apr 2024 15:36:39 -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 433KaYFs080324; Wed, 3 Apr 2024 15:36:38 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 13/31] hwmon: (lm75) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:15 -0500 Message-ID: <20240403203633.914389-14-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/lm75.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index e007507185360..2c2205aec7d40 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -625,20 +625,12 @@ static void lm75_remove(void *data) i2c_smbus_write_byte_data(client, LM75_REG_CONF, lm75->orig_conf); } -static const struct i2c_device_id lm75_ids[]; - static int lm75_probe(struct i2c_client *client) { struct device *dev = &client->dev; struct device *hwmon_dev; struct lm75_data *data; int status, err; - enum lm75_type kind; - - if (client->dev.of_node) - kind = (uintptr_t)of_device_get_match_data(&client->dev); - else - kind = i2c_match_id(lm75_ids, client)->driver_data; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) @@ -649,7 +641,7 @@ static int lm75_probe(struct i2c_client *client) return -ENOMEM; data->client = client; - data->kind = kind; + data->kind = (uintptr_t)i2c_get_match_data(client); data->vs = devm_regulator_get(dev, "vs"); if (IS_ERR(data->vs)) From patchwork Wed Apr 3 20:36:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616694 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 F1B14158217; Wed, 3 Apr 2024 20:37:10 +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=1712176632; cv=none; b=SvqLjT/9fK7fbctaO6nUTqyayegdMMqdSNXGVQ1i131+FYaEUDsQhCnQ9z0smLVs+D+hE/nzdLf+ttCIHhOSaGiR9NyDSjJ3mPc4+HYq9Tqp7Xt35SBlGn6tob6mxjvqZeNr46dNZEbEQ9k3XMzYl2/HrRPpUkHqrobepSEot/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176632; c=relaxed/simple; bh=E9bFIR5SpjVV84IZy6kaVztu+KCin9Ht/6XEc9VQ12c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iurTk5tXNNtY9VJUgZfh/RR63UXGHNGDqgsVTDqG5mNljCuIccGOAiQwNt4eaDF2nnAuLEcw/D9Xh1CC2p8FFQmcCK5j27rjeUArNYjlcpGr4br9KH+oYnCt7ZiF9nl7yGlQ5FO/L2WYjeA5WTCl10av+VBbWMGvkhj9otlq6ZE= 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=cIe/bl2b; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="cIe/bl2b" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KadHv038541; Wed, 3 Apr 2024 15:36:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176599; bh=XVj71wD/7PWW0dpzaejTO7zWBmJkCbE64MGWBAT9sQc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=cIe/bl2bZn7L2B2prAKiHdUXe4vP5h8Tw4ZtZBF7QtwkBUPtBiP78gB2E5DJFsl+Q x6jvGmfTWU+TfUmZRF76rGcsAaozVXu+RW6On9jwNrojCj4HlcL2QT61aGPuRX7y8Y x4xBA/f/+Ux93gaqpRfC/Bx8TlWfXlKv4Qn0VOFw= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KadKk052101 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:39 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE108.ent.ti.com (10.64.6.29) 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:39 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE102.ent.ti.com (10.64.6.23) 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:39 -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 433KaYFt080324; Wed, 3 Apr 2024 15:36:39 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 14/31] hwmon: (lm78) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:16 -0500 Message-ID: <20240403203633.914389-15-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/lm78.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index b739c354311b0..8b53bb3120693 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c @@ -627,8 +627,6 @@ static int lm78_i2c_detect(struct i2c_client *client, return -ENODEV; } -static const struct i2c_device_id lm78_i2c_id[]; - static int lm78_i2c_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -640,7 +638,7 @@ static int lm78_i2c_probe(struct i2c_client *client) return -ENOMEM; data->client = client; - data->type = i2c_match_id(lm78_i2c_id, client)->driver_data; + data->type = (uintptr_t)i2c_get_match_data(client); /* Initialize the LM78 chip */ lm78_init_device(data); From patchwork Wed Apr 3 20:36:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616704 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 AB715158D87; Wed, 3 Apr 2024 20:37:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176637; cv=none; b=U2HBZd5yJzI6fGQ82o0RVEZKz1WybijiH0x1/y5Tkh4I03OZy4NXTe9+8yysj6z5tLdx169FXaT1AnsIhOnh4ujzqRc3Bf5UzLy4+i+eEMoveE2P1oda5cSARLjjlQH4sdt7boiIfvUa86pEiu4dntF7h4WJlPphRcWu6tYA1BY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176637; c=relaxed/simple; bh=8ZbiHkNtTREjZIS3zJVAZlTb0yye+Fpji6a3bLedtUg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pTs5rAZt07zLedorNfFqq3WBuj+dzd7qWidtxD8qS5wMjdsqhU9MiGwEcPT/wg7MurwjrpvgRsZqyKSSDRS3Sls2ro/ofY03Py8qaQHs6yH8yFSEK3SSPN2AQheQtuqq21Xxbul6PuHLud+qtE5gYc4pDRMNrzpdhx+JCejqz3A= 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=ldVQRhsg; arc=none smtp.client-ip=198.47.19.141 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="ldVQRhsg" Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kad78076399; Wed, 3 Apr 2024 15:36:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176599; bh=FCV/jbQpi7sXWXYhHaR5JdV7Yoe0VOV9bhmOLCeXpUA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ldVQRhsgzIMgyomFMRaxK5n3+OxhPuTbY55tSmwnSSMf/oUDqLNVBgsOGZI+4u8vc kBGIt5oDjrwsxH/Dt1LPsq0eQJSt9ndo3sFB9tdkjQflBNa/OmXkk1FI//IP4VWCsH ilq5DmjqWxRd2zjFZ43LOZFVU2vIxQQvBiBZYq4g= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KadVo115271 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:39 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) 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; Wed, 3 Apr 2024 15:36:39 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE100.ent.ti.com (157.170.170.30) 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:39 -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 433KaYFu080324; Wed, 3 Apr 2024 15:36:39 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 15/31] hwmon: (lm83) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:17 -0500 Message-ID: <20240403203633.914389-16-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/lm83.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c index b333c9bde4e64..f800fe2ef18b8 100644 --- a/drivers/hwmon/lm83.c +++ b/drivers/hwmon/lm83.c @@ -417,13 +417,6 @@ static int lm83_detect(struct i2c_client *client, return 0; } -static const struct i2c_device_id lm83_id[] = { - { "lm83", lm83 }, - { "lm82", lm82 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, lm83_id); - static int lm83_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -438,7 +431,7 @@ static int lm83_probe(struct i2c_client *client) if (IS_ERR(data->regmap)) return PTR_ERR(data->regmap); - data->type = i2c_match_id(lm83_id, client)->driver_data; + data->type = (uintptr_t)i2c_get_match_data(client); hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, data, &lm83_chip_info, NULL); @@ -449,6 +442,13 @@ static int lm83_probe(struct i2c_client *client) * Driver data (common to all clients) */ +static const struct i2c_device_id lm83_id[] = { + { "lm83", lm83 }, + { "lm82", lm82 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, lm83_id); + static struct i2c_driver lm83_driver = { .class = I2C_CLASS_HWMON, .driver = { From patchwork Wed Apr 3 20:36:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616676 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 44F44156C42; Wed, 3 Apr 2024 20:36:59 +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=1712176621; cv=none; b=n5rJ8IibWY1dd23khyrMGsyOJPjoAHCAXI+Nv0MirSytx76x8iXVvfJGtbhJ4tokIxgC6WEhQmRUKKtq52S/TaAqZs9KqtwkvWN5kxWjK6h799gQy5d6SsulQ6MoP1VWKUYHT3RKhO1mMo5Sej9MPKyEJ8lAbZJ6zEVABIdDGrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176621; c=relaxed/simple; bh=PccP3Xxp2cI2yyXU9MSff16ZCkCqQEI8PV99Plgf9RE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cf+lvUbq3XvQWhxWt2v9MrwNFkNmMEpe8QlgoPB/3EG1BB91IWaqYIikN4CJAw3xaroBe9expZXC/mHMHTwGavbHos4AidzjCzSzuP4uZBkzG4qe+JMKQjGfvhgou38wFtZUPIu9/Si0YDAEU87tzyO8AZcjcwZiBJ5yigXSUw0= 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=wOD5JrTX; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="wOD5JrTX" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KaeZd076315; 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=ff7Uw6i1RTzEx7wJ63U5eJ76bOzpYeZfMFBZuFhotN4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=wOD5JrTXnvD+Bu0ADZYREdz4XzD+mZYLYVGFpvtng6ZRTIwc0ZudmDclyEjdO6sZb 3nbwC/1ZM10FtoQHx3M6qa+B6gJDRkTaAoGnhS2d5e50uySXXFZVC80odQywUCk7wZ yb9tBWFkmKk9HmNm7gBdGQBlOHtQY7Jo1tJ0G4eY= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KaeBJ000535 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:40 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE113.ent.ti.com (157.170.170.24) 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 DLEE111.ent.ti.com (157.170.170.22) 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:39 -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 433KaYFv080324; Wed, 3 Apr 2024 15:36:39 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 16/31] hwmon: (lm85) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:18 -0500 Message-ID: <20240403203633.914389-17-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/lm85.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 68c2100023575..1c244ed75122e 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -1544,8 +1544,6 @@ static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info) return 0; } -static const struct i2c_device_id lm85_id[]; - static int lm85_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -1558,10 +1556,7 @@ static int lm85_probe(struct i2c_client *client) return -ENOMEM; data->client = client; - if (client->dev.of_node) - data->type = (uintptr_t)of_device_get_match_data(&client->dev); - else - data->type = i2c_match_id(lm85_id, client)->driver_data; + data->type = (uintptr_t)i2c_get_match_data(client); mutex_init(&data->update_lock); /* Fill in the chip specific driver values */ From patchwork Wed Apr 3 20:36:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616683 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 794AB157466; Wed, 3 Apr 2024 20:37:05 +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=1712176627; cv=none; b=fH1MDipsEI1CQCmUvA8KxHy5123y70CKAZKj95O4qHTrGSoSsHq5DcMxYbwSYm6Sbt533FwojDE4i/RVD//bKnluqsde+JOCGLtNSEr0iHeA3lUhKfEo90XssNUOiNG4ivwl60+3MgQpUJL1FpDGgtvvLS+xsBbUmVg2jyeBdvo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176627; c=relaxed/simple; bh=WaUcX9H4oocLmKmO4/fOKQ9tuQ+e/1+hxKKt4oh+R5U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cZ9JB6NGPDbF0Cl07KU1e8rxDMEcajAtdLTL6iVr/7OYxKnyEHgsGb8FlC9VPhWgSbE4bqjDeZ9/OeyNBLXrZHcC3FuW6ALaW/vWQiJYF4Bod9m8ZEbS0znKJuwVi4hdZgMA/TfjBV7Za1Vy69hzYDqoWQqYojQzbabZxHL8Wdw= 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=BqgMOgs6; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="BqgMOgs6" Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KaeSI076320; 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=6FQQgLYLXxXsNReUZRpeaeGAylN2NabWPX8H64kVuOM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=BqgMOgs6sEeVgEB8A6j1k8HkZ6SE3F38KRh2O0rtkH4F6uG8bQ2/leC0dzBX3MPRb 6kC+55v/hQ8txGq+tanmhIeDvgs9Bge9K95g+JasB8S0MpVhNB4EJ3o6BThEhRdi9j X9FvAKthBTJFQ/VQ5WIM35ZbSOVZpAX22/xxB2DU= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KaekH115277 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:40 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE113.ent.ti.com (157.170.170.24) 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 DLEE111.ent.ti.com (157.170.170.22) 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 433KaYFw080324; Wed, 3 Apr 2024 15:36:39 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 17/31] hwmon: (lm90) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:19 -0500 Message-ID: <20240403203633.914389-18-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/lm90.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index e0d7454a301cf..a5c65fc21163e 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -2764,10 +2764,7 @@ static int lm90_probe(struct i2c_client *client) INIT_WORK(&data->report_work, lm90_report_alarms); /* Set the device type */ - if (client->dev.of_node) - data->kind = (uintptr_t)of_device_get_match_data(&client->dev); - else - data->kind = i2c_match_id(lm90_id, client)->driver_data; + data->kind = (uintptr_t)i2c_get_match_data(client); /* * Different devices have different alarm bits triggering the From patchwork Wed Apr 3 20:36:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616680 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="tL8k3L59" 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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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, From patchwork Wed Apr 3 20:36:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616693 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 E66B1158212; Wed, 3 Apr 2024 20:37:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176632; cv=none; b=lJO7UBdBcFnvFCg7RhgKTG4ULBWozrAquq/543+h84WjNbsnj1Fxav3SzWHxMK6zfyOT15lGGkHa2iLLYwBbAJ9V5C1Eqeuq2z5/zyk42c1tjFXgrLAiPJA9Xel8bdqE++uG+pElSa+GnifNdpNTyv2n9SfSSQ31yvJ4A1jmODA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176632; c=relaxed/simple; bh=lRlSuZReFFYVxxcnzf1INLWR5vW9Gm8ZTWO31b/9wyU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WyvdAaL88nzwjdkNf8gMzB/Xfe8yfGHWzeMcAjJXncnbFaFz2v/gyx2zQu2B5rUXOM/4tiAsPtk+ujgKMJyhkotgHTcdNJvC4HdOp2LTvdnyVAUUo4Jn8eYK44FyE3eF4kFq5odpyIWAVxB4kCVYbIMD/9bs3T7xRG4CihWz1Ac= 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=agd5KmpW; arc=none smtp.client-ip=198.47.23.248 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="agd5KmpW" Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KafSc079584; Wed, 3 Apr 2024 15:36:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176601; bh=SyCQPDSspXo8h4RgWzpUdDe7FPw7TNTA1OEjLEMm17s=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=agd5KmpWS0dAEYS6PTL/HhKax+p6+vUnLq0EfTynA0w8nyfN1m7co6BJSOv3Fv4sv gd4Z/pvvaOdXyGnT+rUYkrzHX64oNOyuOvNH6clNxDbwHZuR9hUSnTthDgZ2L3CbpO 1+EpPy3eAFgcwSTs5CGHxHLxMuzaR9JcrqAHBvuw= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KafBb092406 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:41 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) 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:40 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE113.ent.ti.com (157.170.170.24) 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:41 -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 433KaYG0080324; 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 19/31] hwmon: (max16065) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:21 -0500 Message-ID: <20240403203633.914389-20-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/max16065.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/hwmon/max16065.c b/drivers/hwmon/max16065.c index aa38c45adc09e..7ce9a89f93a0d 100644 --- a/drivers/hwmon/max16065.c +++ b/drivers/hwmon/max16065.c @@ -493,8 +493,6 @@ static const struct attribute_group max16065_max_group = { .is_visible = max16065_secondary_is_visible, }; -static const struct i2c_device_id max16065_id[]; - static int max16065_probe(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; @@ -505,7 +503,7 @@ static int max16065_probe(struct i2c_client *client) bool have_secondary; /* true if chip has secondary limits */ bool secondary_is_max = false; /* secondary limits reflect max */ int groups = 0; - const struct i2c_device_id *id = i2c_match_id(max16065_id, client); + enum chips chip = (uintptr_t)i2c_get_match_data(client); if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_READ_WORD_DATA)) @@ -518,9 +516,9 @@ static int max16065_probe(struct i2c_client *client) data->client = client; mutex_init(&data->update_lock); - data->num_adc = max16065_num_adc[id->driver_data]; - data->have_current = max16065_have_current[id->driver_data]; - have_secondary = max16065_have_secondary[id->driver_data]; + data->num_adc = max16065_num_adc[chip]; + data->have_current = max16065_have_current[chip]; + have_secondary = max16065_have_secondary[chip]; if (have_secondary) { val = i2c_smbus_read_byte_data(client, MAX16065_SW_ENABLE); From patchwork Wed Apr 3 20:36:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616697 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 B8FC31586E9; Wed, 3 Apr 2024 20:37:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176633; cv=none; b=lDShFenHiNGASvxrmmMhHYCuRJba97XmSQg+XQR98mns8citUzt92Qo6tGfvvwDRUAKX2wcoqn33whG6fwQoXWqiT5CkqZjPOOuaA9N0E9qJ56un40pQI0DSah5ksCU2XzNtQZCn0RCmpizme7HnA8BbPR8EF34aCcBGwanVOjA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176633; c=relaxed/simple; bh=w9TFgxLi7zLn3rPSLvhL5jw9hZ8VztBwInomK0mRBJ8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iL/TEcu0tCXYo70KBDKpTaLbwnKh4EV4vQhos5slKgC2q4bd70okGTgLX/rUsxxoFQ7iyhqPcMjbY6fqz+kPEtf0PuyfAvl6mH6oDT87o63lzTP3ZP3M5Y8FQTfnrXL52JOS/S64WNQgqkFeiva5J8rSocUz+APmOM9ZiPngGIg= 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=uILrI3wk; arc=none smtp.client-ip=198.47.23.248 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="uILrI3wk" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KafWu079588; Wed, 3 Apr 2024 15:36:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176601; bh=E0hN0MX5Ii7hAmQKTJ2BBa6fwbeVM0SaWF5WY/zarg8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=uILrI3wkni0eEFpGhCph4qDpuGor5S4zGipfRgrWIh8z9uQF6w5kq2EPBtYQJC0GA pZIDnr/xQv4ZshBFyM0KtXE8YiCza90XIJfn4qhM6cei2ZhMlGH8GoyLpwKbcDP3hY cyURWOo0aytSgIkp/OTlrGRT2cUmc/ISSAazNn1c= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KafTn000542 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:41 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) 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:41 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE110.ent.ti.com (157.170.170.21) 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:41 -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 433KaYG1080324; 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 20/31] hwmon: (max1668) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:22 -0500 Message-ID: <20240403203633.914389-21-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/max1668.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c index c4a02edefbee7..9fc583ebb11b2 100644 --- a/drivers/hwmon/max1668.c +++ b/drivers/hwmon/max1668.c @@ -391,8 +391,6 @@ static int max1668_detect(struct i2c_client *client, return 0; } -static const struct i2c_device_id max1668_id[]; - static int max1668_probe(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; @@ -408,7 +406,7 @@ static int max1668_probe(struct i2c_client *client) return -ENOMEM; data->client = client; - data->type = i2c_match_id(max1668_id, client)->driver_data; + data->type = (uintptr_t)i2c_get_match_data(client); mutex_init(&data->update_lock); /* sysfs hooks */ From patchwork Wed Apr 3 20:36:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616691 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 ACC05156865; Wed, 3 Apr 2024 20:37:09 +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=1712176631; cv=none; b=N7ffWFaqb+NsCsb6vuMePHInkcIhAQWU4GCnMP/iE3pb9xP8ZYjX7dNKbOUodnG/lapZu44pJ17EGcZbdqKxd3YxUVOiDwbtIBouKPXscwgkNz7KLbPWod0KGaGMiyJ6bGJJLtlw2awzTtWWT+uR9+VKR+GyWuBV1l2f049JWIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176631; c=relaxed/simple; bh=T5VHLU8nK9r6A/JuEnGEjUCRTxS3+8zFFSmaZ24gujA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sSUj4ScQoExjg9GApQxocqC2HlXHnO9YrlQYMQZYh0FyTfa30tyX2fiGCDYyRnlpKYKJiLeJ9mtjN0hwJoZ10YgAZSfCKpZ+OwCkHmGeJ4smwbb6/UzgSd1aO5FwTU/9EcnTo2RSvForjPzpdqEsiqcEVA89saTlN77Yu8XWnLA= 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=MoywmNPV; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="MoywmNPV" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KafqJ038551; Wed, 3 Apr 2024 15:36:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176601; bh=A2RfmZvQ1FLR4C2d/yQzvUnFTxN7KDFEuQ6F/bLKly8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=MoywmNPVvnOxGNTO2Bd9wbiMW0enQw5fckesEWUcpdIK3hbvJcp1+4XMW0MFriyao X5RY/AofwNrTJtkD5evy2Ra0URhwJN1Y6WiEdvu6GTZyQ4Gx3mTU3wrMKvEHqv/5zW Zk9qPgxebzA4z3dUZJEJdY6WFeITB9MkVoSVURY0= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433Kaf84000546 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:41 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) 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; Wed, 3 Apr 2024 15:36:41 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE100.ent.ti.com (157.170.170.30) 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:41 -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 433KaYG2080324; Wed, 3 Apr 2024 15:36:41 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 21/31] hwmon: (max6697) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:23 -0500 Message-ID: <20240403203633.914389-22-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/max6697.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c index d161ba0e7813c..b28b7b9448aa8 100644 --- a/drivers/hwmon/max6697.c +++ b/drivers/hwmon/max6697.c @@ -684,8 +684,6 @@ static int max6697_init_chip(struct max6697_data *data, return 0; } -static const struct i2c_device_id max6697_id[]; - static int max6697_probe(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; @@ -701,10 +699,7 @@ static int max6697_probe(struct i2c_client *client) if (!data) return -ENOMEM; - if (client->dev.of_node) - data->type = (uintptr_t)of_device_get_match_data(&client->dev); - else - data->type = i2c_match_id(max6697_id, client)->driver_data; + data->type = (uintptr_t)i2c_get_match_data(client); data->chip = &max6697_chip_data[data->type]; data->client = client; mutex_init(&data->update_lock); From patchwork Wed Apr 3 20:36:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616684 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 38661156678; Wed, 3 Apr 2024 20:37:06 +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=1712176629; cv=none; b=OYnqorN0P7nCzg1n7BvBeP4eEsr1Tb5fZJZozju2xTA33LMmJ5yywJe6OlFu6gkpm94GMjrI5gLvsn0YZUQE4YrgkAeJycEINGJEdgD6pLwj1rBzkHPBTDgRa8Lx0agf7OPKUq9bBIv113JiQ933WPD7OuLKiw5m8haZ9aAzxz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176629; c=relaxed/simple; bh=JaZ5ykun3EZOuoA4qITrLpwumorz8LR/tXPrX9mErfA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aV+0HGMuOpJ0Z9VDlp1vBMY/UMYfcLP6+ZjNgMc/qKyssYKAQDaXBpvAijEZzs7Mm1SxuPfOBquriP6GQGHBrYfln6rDwPjcpqPZGMCfhd9df4Gya/QTG0Ptuk5PkMWEW2bqWFUy8eRw8LdIWQApSxy/bdgq8DEPt57au24ekvg= 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=lsnaymbx; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="lsnaymbx" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kag3x076337; Wed, 3 Apr 2024 15:36:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176602; bh=o1hHdo4s+DsFSQQBlovU/5ntoW97q5VnZpY0t16RvRE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=lsnaymbxCs3/ymMiHRccMeZEmIPLHjrEYfsk2ZP6luZ6M6QZIGc/UjGlLggDvskF7 sybFCZAgPloRsyINLy7L4raDdxuZ/HzX+Sh9yVajMGHdKGFqUjJsp2cigy5R3aXPxZ JoG1nKuNk+XD76sao/DmA5aEprGEhU+UMWw2/d+I= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433Kag7c000559 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:42 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE109.ent.ti.com (10.64.6.30) 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:41 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE114.ent.ti.com (10.64.6.35) 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:41 -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 433KaYG3080324; Wed, 3 Apr 2024 15:36:41 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 22/31] hwmon: (mcp3021) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:24 -0500 Message-ID: <20240403203633.914389-23-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/mcp3021.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/mcp3021.c b/drivers/hwmon/mcp3021.c index 9814eaf245644..bcddf6804d3ab 100644 --- a/drivers/hwmon/mcp3021.c +++ b/drivers/hwmon/mcp3021.c @@ -116,13 +116,12 @@ static const struct hwmon_chip_info mcp3021_chip_info = { .info = mcp3021_info, }; -static const struct i2c_device_id mcp3021_id[]; - static int mcp3021_probe(struct i2c_client *client) { struct mcp3021_data *data = NULL; struct device_node *np = client->dev.of_node; struct device *hwmon_dev; + enum chips type; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENODEV; @@ -149,7 +148,8 @@ static int mcp3021_probe(struct i2c_client *client) data->vdd = MCP3021_VDD_REF_DEFAULT; } - switch (i2c_match_id(mcp3021_id, client)->driver_data) { + type = (uintptr_t)i2c_get_match_data(client); + switch (type) { case mcp3021: data->sar_shift = MCP3021_SAR_SHIFT; data->sar_mask = MCP3021_SAR_MASK; From patchwork Wed Apr 3 20:36:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616677 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 C3BDC156C68; Wed, 3 Apr 2024 20:37:00 +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=1712176622; cv=none; b=MGHrWX5C2JMXLkZIYSm7ivhZySIfBlnnjG5JkTwcl0LshEWXlCOXSNGf2ImIKTTQ4qBoMxSfNGi6ivx2I65IASiAI/9yMF49P+B0J+sNlGMZzp7n1ppJ1YiVfc4LlrJU+nNwUZxGFZLiaUqp6YDDheuxhDr7um5apkG9fxoKD4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176622; c=relaxed/simple; bh=TouGBAizAGe45Q6pQL2kVk1VX1tzRnXOe6tVx7bkE6c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=G3cighSTgcavde5GCuwKon8v1hr/fN/zs0q+8o5aPP47OzY+sTn69zHyvITVFeY7KnlWbxET7iHRVgZ7MVYTkUnE8lzLJU2mkSegIRj/49tBeI38F9aBBz+x5yH6N6JHufKC08dpMgG8TySmEandMdP1GITuawX5qaEQ8/AV028= 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=iN+2zFaw; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="iN+2zFaw" Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kag1s076341; Wed, 3 Apr 2024 15:36:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176602; bh=+/2jo2sLpOlbbd+R85BE/NyEBAiwUG3DL8bouFKnMQY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=iN+2zFawzHwHsSe1TAu4SY7r1YuWhLiRAiV6ISNm1YdDuEDoJKqHCvmTR41tOuKPg D3BuW0ddzNFzuCDcnjQDH2qvTxNlavJj6l7rWQC9kGRyoW0ZUAsabRha9ZIaMBLPcG tnR9Diihu/5rs41cDp5qGmwnu5M5ocQ5xh/aL0zI= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KagAt115301 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:42 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE115.ent.ti.com (157.170.170.26) 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:42 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE115.ent.ti.com (157.170.170.26) 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:42 -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 433KaYG4080324; Wed, 3 Apr 2024 15:36:41 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 23/31] hwmon: (powr1220) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:25 -0500 Message-ID: <20240403203633.914389-24-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/powr1220.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/powr1220.c b/drivers/hwmon/powr1220.c index 2388d0565e7ec..5f9ca6543530d 100644 --- a/drivers/hwmon/powr1220.c +++ b/drivers/hwmon/powr1220.c @@ -279,12 +279,11 @@ static const struct hwmon_chip_info powr1220_chip_info = { .info = powr1220_info, }; -static const struct i2c_device_id powr1220_ids[]; - static int powr1220_probe(struct i2c_client *client) { struct powr1220_data *data; struct device *hwmon_dev; + enum powr1xxx_chips chip; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; @@ -293,7 +292,8 @@ static int powr1220_probe(struct i2c_client *client) if (!data) return -ENOMEM; - switch (i2c_match_id(powr1220_ids, client)->driver_data) { + chip = (uintptr_t)i2c_get_match_data(client); + switch (chip) { case powr1014: data->max_channels = 10; break; From patchwork Wed Apr 3 20:36:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616696 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 BE6311586EA; Wed, 3 Apr 2024 20:37:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176633; cv=none; b=KTy8pu6KdX4UmjSYeeXORX8mr+1vBS7IEoQ52i/RUuyz3zRRNMsl/CgRS1VD+2cfzdTsiG9xmXi4MZpprumZDo0zRtn2L5Uud92IlRYrIq7r677irEjVuo/gxOI2ERM3SU1z4jCcoBPpvHT0+CY7TNNJvTBsLsDMCs+yIG7FAX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176633; c=relaxed/simple; bh=nkd6dRREHPwcpDGGNrov5m7ucRaMD8SFstXdDMojjxg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jR7XwRfNZPYuHrEkJ1YZNbYJ9yCas6whaHOOHIJranRsxSiK0Eb4nEYMncQeye3byM0ZjZZsVTMYMLx/moDxg5Bvt+e6X9Wo/Xznqg2Nlbh2jts/mX5YoyU62nfQkR3PGRF0MH+s6Iv9S5OhTXeCEEQs8Rx6sHHc1xkPwdao+xE= 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=rJUoIIt0; arc=none smtp.client-ip=198.47.19.141 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="rJUoIIt0" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kagp7076410; Wed, 3 Apr 2024 15:36:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176602; bh=x+NGttmZsmEmqDB8uQHkqDv87pFr7T95SquiSR8LsvI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=rJUoIIt0C0VnAbG5Fw9y+lgMo7htXwZ3UZrfrn+KyJoLI2qLEIyR57TqS+uxd9n86 FIKE6xGzukiYcJKly7VmQA2cSRIgc1F21rO+KekrGobrwu2NzLBTwXfT7GV0Lqk5VV N/jaWyILCfg1SuvPHl+BUNZUPyPmGQOdO9mrIvWk= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433Kags8052137 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:42 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE108.ent.ti.com (10.64.6.29) 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:42 -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:42 -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 433KaYG5080324; 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 24/31] hwmon: (sht3x) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:26 -0500 Message-ID: <20240403203633.914389-25-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/sht3x.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c index c0d02fbcdb76c..650b0bcc2359e 100644 --- a/drivers/hwmon/sht3x.c +++ b/drivers/hwmon/sht3x.c @@ -882,15 +882,6 @@ static const struct hwmon_chip_info sht3x_chip_info = { .info = sht3x_channel_info, }; -/* device ID table */ -static const struct i2c_device_id sht3x_ids[] = { - {"sht3x", sht3x}, - {"sts3x", sts3x}, - {} -}; - -MODULE_DEVICE_TABLE(i2c, sht3x_ids); - static int sht3x_probe(struct i2c_client *client) { int ret; @@ -920,7 +911,7 @@ static int sht3x_probe(struct i2c_client *client) data->mode = 0; data->last_update = jiffies - msecs_to_jiffies(3000); data->client = client; - data->chip_id = i2c_match_id(sht3x_ids, client)->driver_data; + data->chip_id = (uintptr_t)i2c_get_match_data(client); crc8_populate_msb(sht3x_crc8_table, SHT3X_CRC8_POLYNOMIAL); sht3x_select_command(data); @@ -963,6 +954,15 @@ static int sht3x_probe(struct i2c_client *client) return PTR_ERR_OR_ZERO(hwmon_dev); } +/* device ID table */ +static const struct i2c_device_id sht3x_ids[] = { + {"sht3x", sht3x}, + {"sts3x", sts3x}, + {} +}; + +MODULE_DEVICE_TABLE(i2c, sht3x_ids); + static struct i2c_driver sht3x_i2c_driver = { .driver.name = "sht3x", .probe = sht3x_probe, From patchwork Wed Apr 3 20:36:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616685 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 BAEA1157A77; Wed, 3 Apr 2024 20:37:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176629; cv=none; b=VP6bScUXqiGnWD5+LqVe+uTjMTvov0gxjvuKE1UmtFqXmpLRSCqLDDv2CpEYOys2Vt/YJriSH+WOQesDUHmYtvs6nkLVIKM5T4rbxEFiMJoV9MZibXpNP55j4Msun9TuN6byXNmWk4vVCTm7qZhl4/3j5OsTbtx8ORiS0MkAlbA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176629; c=relaxed/simple; bh=l2ILJrvm523Pdh6/q7kf63sgiFrMwHIDd2MGZ/ZaeCQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wh60E/M1LIRrCfg9Q0DEKK1l3wwK9w+4spdff6vm86JuAeIz7Oz+ysc0HwUOWzAYWjuv32IJszT9+1NHRZdpsCUrKs4dTtyFZq7VrTJcDj2Z1n5q1NMhJLrm3DVqAkD9xluoeD0MFHICcCECG3L1Ea0SfwvyDy4ih/gluvav5TI= 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=MkRKtG0w; arc=none smtp.client-ip=198.47.23.248 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="MkRKtG0w" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KagYm079593; Wed, 3 Apr 2024 15:36:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176602; bh=JxK8cs7QSwJFELf2r5HBFoU70Gmh8OmgX3Wa2YPIZ6Y=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=MkRKtG0wQ2NErgOqXeyDeH0RRQTGHHztvlOcNynnf1OlAwyIRmZuPYww3EpmFdaxU aH26BcdKzK1F6pNPwkPJIENvTttuH/eCu0iXqPxtmjvRei86Vitea1tMjdv3i0RUW4 jh6qub4a2iKjP2avavzjD85ZMrK5KKSQoPi0Ht9g= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KagmQ052140 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:42 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE108.ent.ti.com (10.64.6.29) 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:42 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE114.ent.ti.com (10.64.6.35) 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:42 -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 433KaYG6080324; 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 25/31] hwmon: (shtc1) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:27 -0500 Message-ID: <20240403203633.914389-26-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/shtc1.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwmon/shtc1.c b/drivers/hwmon/shtc1.c index 1f96e94967ee8..24a8ae092d00e 100644 --- a/drivers/hwmon/shtc1.c +++ b/drivers/hwmon/shtc1.c @@ -186,8 +186,6 @@ static void shtc1_select_command(struct shtc1_data *data) } } -static const struct i2c_device_id shtc1_id[]; - static int shtc1_probe(struct i2c_client *client) { int ret; @@ -195,7 +193,7 @@ static int shtc1_probe(struct i2c_client *client) char id_reg_buf[2]; struct shtc1_data *data; struct device *hwmon_dev; - enum shtcx_chips chip = i2c_match_id(shtc1_id, client)->driver_data; + enum shtcx_chips chip = (uintptr_t)i2c_get_match_data(client); struct i2c_adapter *adap = client->adapter; struct device *dev = &client->dev; struct device_node *np = dev->of_node; From patchwork Wed Apr 3 20:36:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616695 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="dAfrhcC8" 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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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); From patchwork Wed Apr 3 20:36:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616698 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 8CD59158851; Wed, 3 Apr 2024 20:37:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176634; cv=none; b=AmiCOOAnr4p6Ie36qv3HbV1HwcEt9316dwjYMZAv0PsQoo3mRk8DC6PYZa8y3stRQJVmZqZ4I3WTs3R+Du4F2m+/DxMAd/4/N1yAzhDGOIodGoZyw8QZ/9N5MCXEZpSxWdD2XFvmMfkg6LO8OGdwm2KArmSri7fAZH+fa1+GWaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176634; c=relaxed/simple; bh=+j2zDD05erOYmUDf5cAUGonJ26jb9YMO8vUCwuJEirA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gHH34XEBR/NZc8fS23rDhm0qlZZ1EZ3UfrpK3Jq6f4iduldHzeB9G+3jDWl4oEo5O7t59K87NPVEg+YO6ODKlunkJqtb2I7B23qPrIkjn3gzxaEheLZWVEPl8VnDuqEiqTeHsoO4OYrNc2a4w22bLO/mPLHZdXQwu89ZoE7STtk= 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=O4/Y9Lnt; arc=none smtp.client-ip=198.47.19.141 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="O4/Y9Lnt" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KahbW076415; 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=oeRxtViThx6D2NDyoozxbhE8Wue1F9JnFhBNbwoja0I=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=O4/Y9LntmUsM+sFyIZ+Iowl5/DmGoIMkGuQuUZf7638vHwEEVPmjMroPFNm7hX0tO NrfE6+GYp2O2oW4eNiKFmCkWFDGNxin3ghmjwpTX8D5c224i2FjtEze9t/toQ1Vnnz OGe2IQMoMlQTbpgGM+a6YXrsmh9kLoNpxWDmSlg0= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433Kaht9052147 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:43 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE114.ent.ti.com (10.64.6.35) 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 DFLE111.ent.ti.com (10.64.6.32) 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 433KaYG8080324; Wed, 3 Apr 2024 15:36:43 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 27/31] hwmon: (tmp401) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:29 -0500 Message-ID: <20240403203633.914389-28-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/tmp401.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c index df1b45a62e804..853dbe708ff5d 100644 --- a/drivers/hwmon/tmp401.c +++ b/drivers/hwmon/tmp401.c @@ -693,7 +693,7 @@ static int tmp401_probe(struct i2c_client *client) data->client = client; mutex_init(&data->update_lock); - data->kind = i2c_match_id(tmp401_id, client)->driver_data; + data->kind = (uintptr_t)i2c_get_match_data(client); data->regmap = devm_regmap_init(dev, NULL, data, &tmp401_regmap_config); if (IS_ERR(data->regmap)) From patchwork Wed Apr 3 20:36:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616687 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 93183157A47; Wed, 3 Apr 2024 20:37:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176630; cv=none; b=eVbr5Vv+9vkFlatEdfbcxYEiScLEzpkUE9NAjYz8XwqJ1A2zAYThVFdZ0nRrtu3I5HGMsRN4C4CwG6fZSrIuy4eLLSI9bOGRLfRoGiHMylMJWn5MaHm7vJs6ysObYQSTJkuAg7Hbtg7P9AO6XeM5rvYNQV9PSZfd0PQEGhttsk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176630; c=relaxed/simple; bh=0Fw2Z4VTG6YoXV3yLNJmhQau21aV6l17WNfYSo2iQZc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XcQYxra0SpC/g2jphzgJjZfOUPJCgH8efYq3T6VXeB8TuA0T67WgLdl2ngC5Ziqxl1aKGkaRXiDgwuRO6Uy6WK+mtGnwV3LW7FGmPbcE+nbN45ykRQWfotR45XVEjFYw2vKLuq9x4a8rGq1/2zpLykEwxg1Q5Mb/f3MtC66wKpM= 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=SFg30oPx; arc=none smtp.client-ip=198.47.23.248 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="SFg30oPx" Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433KahKq079598; 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=qMfLozI0DMqanEMgIpvkrkvdZu7i1fxTHIM60wcusac=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=SFg30oPx6PkiI3zCy5JbFh6HPIR0pdkBnkaBUeYff2BcHNnSj+EzHVRYjLfJ1LBuE hvki4Ngd08yh/11I2HJf38WBZHM0EoRH0K1DKEj78uIFrM90gOt8dJeJQImtlszFTV 2M7ABj7eUfhGcKFHRXsvF4G8AvO2UEIFNCp/Vc7U= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KahNm115317 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:43 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE108.ent.ti.com (10.64.6.29) 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 DFLE106.ent.ti.com (10.64.6.27) 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 433KaYG9080324; Wed, 3 Apr 2024 15:36:43 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 28/31] hwmon: (tmp421) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:30 -0500 Message-ID: <20240403203633.914389-29-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/tmp421.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 10b66c9ce0452..7a6f9532e5942 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -446,11 +446,7 @@ static int tmp421_probe(struct i2c_client *client) return -ENOMEM; mutex_init(&data->update_lock); - if (client->dev.of_node) - data->channels = (unsigned long) - of_device_get_match_data(&client->dev); - else - data->channels = i2c_match_id(tmp421_id, client)->driver_data; + data->channels = (unsigned long)i2c_get_match_data(client); data->client = client; for (i = 0; i < data->channels; i++) { From patchwork Wed Apr 3 20:36:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616702 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 3E283158A1E; Wed, 3 Apr 2024 20:37:13 +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=1712176636; cv=none; b=cpFfgpQDKmxtltPECW/vBxxn3FBY0MsHDyZGrfup5L33Wuf2/mfkIIG4kzI18ujMQXKUz/CRHEdhXvqLqNdIVdmsmyZblzYorWbBKlC6nkM/dWP/cdrGmr+g2ItoN96PosEE0uf3CKL7/zIAnf0HLWMZFWlcIbgT4ogy1CsStSo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176636; c=relaxed/simple; bh=fzyLAkMdkIrE2Q23ti0Q/YYONcNNwXtFsQNshTq6LZk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Es3GiZ58x5N26/a1aiU5zJHC9XsOOmqfMNTcJiP0T8ru2/5b2lD+nNzdeWZifMZoCApeQx5uwZDl3CczdUrW1CKyn+XDwtulfFSk+g8SfQem3vFkaOeHwapyPDv93Z/oxEZUEkVyHc7o0V/r7D0atq8fEDuykbYbisikQz+vvdI= 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=MXQFFmnY; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="MXQFFmnY" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kai2g038561; Wed, 3 Apr 2024 15:36:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176604; bh=jE+XpwhEwJZiBSyUsuAdan5u7cm38Ho/3/4bJnKGkAc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=MXQFFmnY+6FLfB+5fzw+jt1gKUjpj5NXrRlq3AIb+gc36CbadS1UD+6uSUBIr6fGH ++DGdbblczRFeqRz0lHgbHb0x/y9yTwJrW3OHEy4q0HRcyQb9wLJsKzTG7loLfOg44 nLIP3oknAbYq1P38PaXHhCg5GTMgMIIl/vvwH8fk= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KaiFo052164 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:44 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) 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; Wed, 3 Apr 2024 15:36:43 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE107.ent.ti.com (157.170.170.37) 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 433KaYGA080324; Wed, 3 Apr 2024 15:36:43 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 29/31] hwmon: (tmp464) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:31 -0500 Message-ID: <20240403203633.914389-30-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/tmp464.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/hwmon/tmp464.c b/drivers/hwmon/tmp464.c index f58ca4c6acb6e..3ee1137533d63 100644 --- a/drivers/hwmon/tmp464.c +++ b/drivers/hwmon/tmp464.c @@ -666,10 +666,7 @@ static int tmp464_probe(struct i2c_client *client) mutex_init(&data->update_lock); - if (dev->of_node) - data->channels = (int)(unsigned long)of_device_get_match_data(&client->dev); - else - data->channels = i2c_match_id(tmp464_id, client)->driver_data; + data->channels = (int)(unsigned long)i2c_get_match_data(client); data->regmap = devm_regmap_init_i2c(client, &tmp464_regmap_config); if (IS_ERR(data->regmap)) From patchwork Wed Apr 3 20:36:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616678 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 D81C3156F34; Wed, 3 Apr 2024 20:37:02 +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=1712176624; cv=none; b=GpY1tSgHA5mo4q2Js90ES54cJHITyB00RV/0XA6RgbNjKTDrqu8CP0xF6+yFTObTpUnlP/WrVC0Y2ICnS7plxg/h9/vaAG0/RQFkuFn4A7/nqAtczeD+VLLwU/otx4clIyO0PxCZ6HesRDb2xM5MYiCLuwnEDmsKXc1ngwAVKWM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176624; c=relaxed/simple; bh=dP5nBeZ4OmeLq2nUhtY0MOmQkKqwR5I3iMT/iFabJJA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lCM9eCAntf2/CdMfdulSYMJX/oTRFOPjHyGnWZJ/4Z1c78dkPghuRMcYeAGhhjm90eVTDR9zjXrI+GOMdWTrX6sl9oBoUmhw+NyC2EY0IUSWIM4in+oCxWxAUuBmCIj6XmkefU/WmIgEGP6ox+1avLyrYX9pUxRti6ri4KGjlZE= 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=DdVml6XR; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="DdVml6XR" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kaijm076347; Wed, 3 Apr 2024 15:36:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176604; bh=3f+fWpc6UrtJFAy9Ej0B4JEpcUnkcygsQ6t500zmMgk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=DdVml6XRQKSNjlXOZVHM0N3KI6Phiu2dhxAWkBk5kSePYr1afAcfmUBOtYT54m+0y TCoG63d+FS+ZTWlvyAz/cBvyrYhwGhQef9TzPqoYE3cIE16PvzCLjEKkoCMXDFLx41 l80TgkRshWW4PleI/ihp6oa4x/M+tesuvv/xlGtA= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433KaiQV000578 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:44 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) 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; Wed, 3 Apr 2024 15:36:44 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE101.ent.ti.com (10.64.6.22) 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:44 -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 433KaYGB080324; Wed, 3 Apr 2024 15:36:43 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 30/31] hwmon: (w83781d) Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:32 -0500 Message-ID: <20240403203633.914389-31-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/w83781d.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index cba5ec432e6d1..b7957c84d2352 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c @@ -1192,8 +1192,6 @@ static void w83781d_remove_files(struct device *dev) sysfs_remove_group(&dev->kobj, &w83781d_group_other); } -static const struct i2c_device_id w83781d_ids[]; - static int w83781d_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -1208,7 +1206,7 @@ static int w83781d_probe(struct i2c_client *client) mutex_init(&data->lock); mutex_init(&data->update_lock); - data->type = i2c_match_id(w83781d_ids, client)->driver_data; + data->type = (uintptr_t)i2c_get_match_data(client); data->client = client; /* attach secondary i2c lm75-like clients */ From patchwork Wed Apr 3 20:36:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13616690 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 190F6157E94; Wed, 3 Apr 2024 20:37:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176631; cv=none; b=Gte++P23FYfW+7+wR/jBM9NhNwSw8WFHzxhyJjETp2obS4k46iLl77PslYmEt0nc5vILL2dvMNp8BJVEb3fuXeCk5rP0seS1I9IIQw+xW0IzdWapvX08Iah/6PG1z8V806eyuUl4jVqKHcGZO8fSvnPPe+wOGeQGT7TJVs7yqEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712176631; c=relaxed/simple; bh=mmTedkf3Yxggn4Mjpl92QBl602HEnBhNNX9xKAhwius=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WfI5y2I76Y9pst5XPgPr6uip0Nw+HTmNSDgEw5wODFLekSBB9Mv2RICfSbUl61KUOS4L4D+kEaClJp1frP/JNTa6AZo6MWitncYS0mqT04KUOPtQPLdNsqqeIj/wECMVCD67FD3wCUIkgztmJuuOohWFJ763Lov13CzzTlgwr0A= 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=V+1ThZhV; arc=none smtp.client-ip=198.47.23.248 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="V+1ThZhV" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 433Kai7o079603; Wed, 3 Apr 2024 15:36:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712176604; bh=OXUYHMCPCR+ILoa5f5nPvFCmbq17Wv2VgNu98FPrtQQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=V+1ThZhV5XQwfj3vUaJQ2fSpYazdPXUZQt288WxrMHmefVrxlOuJGH0LPFqVANNuC T9QliqvCgjVhRLxzpIG1eSlxkQz/oAIKMxBeySCzREjOOVjKq/mbS7TZVSc4V3N0/C RlzzQ0qMWW+ms1n+O5p3HxNqVXi3GiNjmbO5g7gM= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 433Kais5000584 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2024 15:36:44 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE109.ent.ti.com (157.170.170.41) 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:44 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE109.ent.ti.com (157.170.170.41) 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:44 -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 433KaYGC080324; Wed, 3 Apr 2024 15:36:44 -0500 From: Andrew Davis To: Jean Delvare , Guenter Roeck , Juerg Haefliger , Riku Voipio CC: , , Andrew Davis Subject: [PATCH 31/31] hwmon: (w83795): Remove use of i2c_match_id() Date: Wed, 3 Apr 2024 15:36:33 -0500 Message-ID: <20240403203633.914389-32-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-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/w83795.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c index c446e00db6586..5174db69db5e1 100644 --- a/drivers/hwmon/w83795.c +++ b/drivers/hwmon/w83795.c @@ -2134,8 +2134,6 @@ static void w83795_apply_temp_config(struct w83795_data *data, u8 config, } } -static const struct i2c_device_id w83795_id[]; - static int w83795_probe(struct i2c_client *client) { int i; @@ -2149,7 +2147,7 @@ static int w83795_probe(struct i2c_client *client) return -ENOMEM; i2c_set_clientdata(client, data); - data->chip_type = i2c_match_id(w83795_id, client)->driver_data; + data->chip_type = (uintptr_t)i2c_get_match_data(client); data->bank = i2c_smbus_read_byte_data(client, W83795_REG_BANKSEL); mutex_init(&data->update_lock);