From patchwork Wed Nov 15 20:57:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 165597 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2806166vqg; Wed, 15 Nov 2023 12:57:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IH79sadd5yuSIgozDeBRmFgzVXvBYNUbu2OQzwlB8LEZIIVpWb7IDkoH5GfMu9BzdQoKy6j X-Received: by 2002:a17:90b:1e04:b0:280:18ba:f016 with SMTP id pg4-20020a17090b1e0400b0028018baf016mr15819657pjb.47.1700081879209; Wed, 15 Nov 2023 12:57:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700081879; cv=none; d=google.com; s=arc-20160816; b=AhjGt+27Qi0AofY9nzG43sBxN2UxkLwYfWU6O57z42Uy0WXNz13ET1qASVvyAuSyvJ cXjxJXtjaGYU+VEDgRqEg+SeUepggnUj7cGnH4ofQxrki0SiZLKZvfJr5ajNEEHgn45T 2o+FliExSYvqjRGy7e9VhA3+FifcA2O1asmHDhVD+kgKjson2oxZ8NZOXdOIVth3LMZT i2dCWdfjOfRUzCV6/ZXGUqZoEE7lAZOOgATvrXkIwC+t8kh9UwYc+W0nicpiuJJ0kjG3 36/ZfwiCOE8UdSOvIU81xnbJBZ1T8QhBgF7j0Vdvt/tgSBC5/K+L5ieZ/vZuOsvhdpSz kYPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=kOK7JO5EOhsngaH3Qx/xmibO/SIbJATRMlHbrH/xpaY=; fh=lwMH+ktKKNns6HwdJFGr5ruQtEtRlhBLkIlm9b/lScU=; b=iEeik0pnQ3eQAha/OAmy6muwOf0CZAJZnMy20Y9+CYAunmEkC0RyiyFqbYlpiZGIJ9 xZ4vmLkJSf7lgDnL4MvSED2m3yPVVRPkfuJgQ8U+0ZPRml0IWHn+zL0o6e2+4I5MsPJ2 +qYi1QlJ4zi5ODwfp/jIw4pyUbfg76YQ6QLkN+OgsxI+H3wetRnza0/Tl76PwFgD90Fl HziTbP4t2Vl3SyDDwkvAjafE9wzUuu20R66VOdCeQ5hXqrlIOCDTtJSna73T1JmO7yCx n+xZcQ8Lvs0FInOHilkfjiOyGLUzL8exePlf5nThvpPhslGvkQw6zGgkLr5pHLVdsepH YNWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ot3-20020a17090b3b4300b002832041e149si454379pjb.167.2023.11.15.12.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 12:57:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C2EF080C47B2; Wed, 15 Nov 2023 12:57:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344569AbjKOU5S (ORCPT + 29 others); Wed, 15 Nov 2023 15:57:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235064AbjKOU5N (ORCPT ); Wed, 15 Nov 2023 15:57:13 -0500 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B56C195; Wed, 15 Nov 2023 12:57:08 -0800 (PST) Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-6ce2fc858feso42009a34.3; Wed, 15 Nov 2023 12:57:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700081827; x=1700686627; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kOK7JO5EOhsngaH3Qx/xmibO/SIbJATRMlHbrH/xpaY=; b=ltpx2begib1pfLOz28zgib2Zf/HdiXqnOmVfxkQ998WLeQ4GiCmcBsm2M7sd4ynkP2 W6QaHczY1ZZPRnZCJF6p8KPa3rAq+a4BB385yq1lvF+oMrjQnA7Ndb2KaFmIYTQ8DvET +yX5HjhPH0dWjfDl6Qcc8cT8cp53P65AGptRvhL9ErrH/qJ+rSWD3Y2FAJpMcwEVLOff V6KxUOxm2ZHz2PPjLTNSul65xGnSF1cgyHN8+1ZmdH9RmGwlpSXeq+N5qqAXi3InlrRd WYvbV3DvfDjKN8w66hqr5Vxc5eW6y+sJX/AcUXeZqSFGYZMfzFLuVYjLNLZmDg697qtC dAvg== X-Gm-Message-State: AOJu0Yzkc9NxDPqdQpn2dvUO44b4sBr9FkCGaM1/rR3E9Qaw4ZXj4Gwz 4A3WbbM3t77Dned17keEwwISFtV1Sw== X-Received: by 2002:a05:6870:f609:b0:1ef:9234:aa2a with SMTP id ek9-20020a056870f60900b001ef9234aa2amr15024607oab.37.1700081827470; Wed, 15 Nov 2023 12:57:07 -0800 (PST) Received: from herring.priv (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id c1-20020a056870a58100b001eb0e8b75cdsm1868316oam.10.2023.11.15.12.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 12:57:06 -0800 (PST) Received: (nullmailer pid 3730597 invoked by uid 1000); Wed, 15 Nov 2023 20:57:06 -0000 From: Rob Herring To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] hwmon: max6650: Use i2c_get_match_data() Date: Wed, 15 Nov 2023 14:57:00 -0600 Message-ID: <20231115205703.3730448-1-robh@kernel.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 15 Nov 2023 12:57:47 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782665056812977295 X-GMAIL-MSGID: 1782665056812977295 Use preferred i2c_get_match_data() instead of of_match_device() and i2c_match_id() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring --- v2: - Split up per driver --- drivers/hwmon/max6650.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c index cc8428a3045d..9649c6611d5f 100644 --- a/drivers/hwmon/max6650.c +++ b/drivers/hwmon/max6650.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include /* @@ -763,8 +763,6 @@ static int max6650_probe(struct i2c_client *client) { struct thermal_cooling_device *cooling_dev; struct device *dev = &client->dev; - const struct of_device_id *of_id = - of_match_device(of_match_ptr(max6650_dt_match), dev); struct max6650_data *data; struct device *hwmon_dev; int err; @@ -776,8 +774,8 @@ static int max6650_probe(struct i2c_client *client) data->client = client; i2c_set_clientdata(client, data); mutex_init(&data->update_lock); - data->nr_fans = of_id ? (int)(uintptr_t)of_id->data : - i2c_match_id(max6650_id, client)->driver_data; + + data->nr_fans = (uintptr_t)i2c_get_match_data(client); /* * Initialize the max6650 chip From patchwork Wed Nov 15 20:57:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 165598 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2806734vqg; Wed, 15 Nov 2023 12:59:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZVJtWF57EYnrB/KeHyDA9Nr7o27RNIvswgyz9Em2lKkz0+aEA01OQMGoN3iVoMCFNLP4k X-Received: by 2002:a05:620a:2793:b0:778:9888:ae6e with SMTP id g19-20020a05620a279300b007789888ae6emr7926166qkp.19.1700081961009; Wed, 15 Nov 2023 12:59:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700081960; cv=none; d=google.com; s=arc-20160816; b=FEmEOvuOoE3PaSLkOYOIv4frryyCFrkgbDNbWVec9Tll2VrF0ADs3qgtfiLc6T6TZu 6c75T/ipEz1mWXj82VzYnVmSJS/b0ImOZwKRuO2gHEGLFAQumWxEQYNXoOGT9q5+Jd5p dqxSqvb83RlBOn74D1BQdpU2lw4MDTN3Icyq33jVQNTSKiXvts+t2ZRM3PBB1mSqhyc1 cnKrKPhAJcDERKmc9lrJkVbI+ZSvQKQjSgroZ4qyi0ktskQowLWAS2ESjMoCpEejlw/j NpGqNd68Ofr5F7d2Rax+xkQt3Qsens1nYq63PNb5LeguHDRNhCrFIXi9+b2nezlOcGzm 3Uug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=CwRLiSsmTQrLmr9QhLtbXwPVmZP/s3+9L17ecEUsq1Y=; fh=f8vUioHdr3o7IdBC6ZP5IM03eke5tza0mYzDtxajssc=; b=WseraQe0P4K/s56HZeLnHA3RQBHcFv7M9E/fB1Fb4tc0L+fX3lUc2M/gniak7c9DqB ZSQdwXPhAQbn1oqZNuc0+1iOqJb2yAA8XMrlWRj18p9QOhUQuyHHZvdAfCSe/NWg8SOv PPCOB52a5ynXOWZOY4klp8+V8sMhxLzZATmnXTiohun1/MGjZ762/ZNguLNeEmnuZfvO c8TKgM6ModZKgsJ/UnUoQYvujSYT2100oQDGiXpP6Q7g8OhIxSQ+dWH353/Hz979oyfh t1AtpeU3jTkWKQmMU7iwHrWMo+xL4t/VHTvyfL1TEmtOSxXGEvkCXIvH29n6XduI50nR yt3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id f2-20020a05620a280200b007776479cb6bsi10269824qkp.31.2023.11.15.12.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 12:59:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 4E69780A9AA4; Wed, 15 Nov 2023 12:58:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344574AbjKOU51 (ORCPT + 29 others); Wed, 15 Nov 2023 15:57:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235082AbjKOU5Q (ORCPT ); Wed, 15 Nov 2023 15:57:16 -0500 Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9B09BC; Wed, 15 Nov 2023 12:57:13 -0800 (PST) Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3b2f28caab9so63468b6e.1; Wed, 15 Nov 2023 12:57:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700081832; x=1700686632; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CwRLiSsmTQrLmr9QhLtbXwPVmZP/s3+9L17ecEUsq1Y=; b=byBXX3u+f69taHF+HfeH8xG+fvcZnftl8MhDY4qbFrSwP74gqeqC6+aJ/qhTRXkjJi VVLrAinLelY9/y6RoHJFQz8ndeCKIBqPXecYQ9wRiS+zS3kMxIKaq+akH0jsVVn/IYi0 2rukSCt7rESTxqag3aQJMK63aJ9CxqBqhWp3uW58gO3h/pLXphiVoxztNztHvH6kyGk/ QuxVQ3eCWnSjNzzTKu983BehUzEKpAAj28F1USu06kq67Xp9n3uIWN6viikXoTfEUUXR 7WCNBUYOSOAesNWbzAnaQLP4bjs8y+jwEsx9I+yxz8KYrNcx6E/2qboGmHjmHArMNzzg N29w== X-Gm-Message-State: AOJu0YzX55rHjhP12IgumYCRcs6E8uu55FEU3TTzyncay8zcBsxz7jC8 qdiVVFm/5LkUro+b5fprJA== X-Received: by 2002:a05:6808:2191:b0:3ae:16b6:6338 with SMTP id be17-20020a056808219100b003ae16b66338mr19677598oib.3.1700081832166; Wed, 15 Nov 2023 12:57:12 -0800 (PST) Received: from herring.priv (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id k20-20020a544694000000b003af5d7d9f3bsm1607934oic.4.2023.11.15.12.57.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 12:57:10 -0800 (PST) Received: (nullmailer pid 3730620 invoked by uid 1000); Wed, 15 Nov 2023 20:57:06 -0000 From: Rob Herring To: Jean Delvare , Guenter Roeck , Zev Weiss Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] hwmon: nct6775-i2c: Use i2c_get_match_data() Date: Wed, 15 Nov 2023 14:57:01 -0600 Message-ID: <20231115205703.3730448-2-robh@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231115205703.3730448-1-robh@kernel.org> References: <20231115205703.3730448-1-robh@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 15 Nov 2023 12:58:44 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782665142403718539 X-GMAIL-MSGID: 1782665142403718539 Use preferred i2c_get_match_data() instead of of_match_device() and i2c_match_id() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Adjust the 'kinds' enum to not use 0, so that no match data can be distinguished from a valid enum value. Signed-off-by: Rob Herring --- v2: - Split up per driver --- drivers/hwmon/nct6775-i2c.c | 14 ++------------ drivers/hwmon/nct6775.h | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/hwmon/nct6775-i2c.c b/drivers/hwmon/nct6775-i2c.c index 87a4fc78c571..63b669d511f4 100644 --- a/drivers/hwmon/nct6775-i2c.c +++ b/drivers/hwmon/nct6775-i2c.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include "nct6775.h" @@ -155,23 +155,13 @@ static const struct regmap_config nct6775_i2c_regmap_config = { static int nct6775_i2c_probe(struct i2c_client *client) { struct nct6775_data *data; - const struct of_device_id *of_id; - const struct i2c_device_id *i2c_id; struct device *dev = &client->dev; - of_id = of_match_device(nct6775_i2c_of_match, dev); - i2c_id = i2c_match_id(nct6775_i2c_id, client); - - if (of_id && (unsigned long)of_id->data != i2c_id->driver_data) - dev_notice(dev, "Device mismatch: %s in device tree, %s detected\n", - of_id->name, i2c_id->name); - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; - data->kind = i2c_id->driver_data; - + data->kind = (enum kinds)i2c_get_match_data(client); data->read_only = true; data->driver_data = client; data->driver_init = nct6775_i2c_probe_init; diff --git a/drivers/hwmon/nct6775.h b/drivers/hwmon/nct6775.h index 296eff99d003..d31e7a030216 100644 --- a/drivers/hwmon/nct6775.h +++ b/drivers/hwmon/nct6775.h @@ -4,7 +4,7 @@ #include -enum kinds { nct6106, nct6116, nct6775, nct6776, nct6779, nct6791, nct6792, +enum kinds { nct6106 = 1, nct6116, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793, nct6795, nct6796, nct6797, nct6798, nct6799 }; enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 }; From patchwork Wed Nov 15 20:57:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 165596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2806170vqg; Wed, 15 Nov 2023 12:57:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDdsTgj5+5MU9qCiOHytGRsHAdqOctnYijQgaZ+qnSetcjbGWgchODHIpRr2mWTq3Szq4V X-Received: by 2002:a17:90b:1d8e:b0:27d:3be:8e13 with SMTP id pf14-20020a17090b1d8e00b0027d03be8e13mr12020493pjb.12.1700081879223; Wed, 15 Nov 2023 12:57:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700081879; cv=none; d=google.com; s=arc-20160816; b=yjMEPQsFJwQd8EoLwMlMoeML1VPUz3sK+PSEUaWTA7i7nkUWMe921tsR2zSvE5QPve gXVVK3VgURCLhqr7kP7GLXxaPjlRuINfJQXUqefZyDcwjPf51XxSLMLFJhNaGurXikTn JQwrPaKgzTkgdlBhA8jjGEUCijVSrV2wX4h6Sdn2FSXoRTjOLDK5hA7NodSnMNyBkx06 2rXld0mLKape/KsIIhb9EN04HFsICWCBnR8JScB+Szvu9yRFG/Dsz9AlZKVkL6thfzNF Hmze0IdUx596PFf+/1+ARIBOYpYQTT9iDZIOyKqdCz92wcAFMK5p13rdN6g7rCN7i2A9 mncw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=yn8cWgc0LR3eqt+tX9p4U9PZWhRMqUpEjC58C6kq9fE=; fh=lwMH+ktKKNns6HwdJFGr5ruQtEtRlhBLkIlm9b/lScU=; b=aLXLXe2LrLC2dfdnKPhbdaLlh5LtHm8lAahLeIxFMrJGgdMsg4+YAT3BOe/XcDlJ6H cPseBKqh/wltxxs2xYuZsA/93vxgaW+hdkTkE03UcB7+f57ynjo2c4Wd228EN9JMStyR Q64xeV03SsjDTySKq8SQqJgYihro3MXK9yZCQIEjUWcaMFsTb//XyDMrn+ynl7jiXPjp 7jtJPlnxhRfImRcfUgEsm9ma/4t+aiLWQEHGEtg5WybSJcvbOdCHcbEAYe4s1a4qrHVR 2G+3CkA8lesLwX1hIJ2WB7V8XB7HIXbewxOI7CuciO/wgLDnjLIEB+sWCpecauffodrc GoNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id e31-20020a17090a6fa200b002791d79bbf9si432432pjk.187.2023.11.15.12.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 12:57:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C053480C47B0; Wed, 15 Nov 2023 12:57:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344592AbjKOU5X (ORCPT + 29 others); Wed, 15 Nov 2023 15:57:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235071AbjKOU5P (ORCPT ); Wed, 15 Nov 2023 15:57:15 -0500 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B2C7198; Wed, 15 Nov 2023 12:57:10 -0800 (PST) Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-6cd09663b1cso42391a34.3; Wed, 15 Nov 2023 12:57:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700081830; x=1700686630; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yn8cWgc0LR3eqt+tX9p4U9PZWhRMqUpEjC58C6kq9fE=; b=B/g6bTNulvrF4D1C+on42Mpg0ksJJv4fQ7mMXVN8wFA+ixA2t6Pu6GlKQhgF+913zX qHkfBva41hfWQElalsz1zX2SaiSU89HA+Hh4vTb+c6rvxdQociP042n9JiKdg+VJsdCK q/rI4hY2FGK9vvo20LigbPLN40Em0CAP//J9xWUGufO4drep0BKrsKOcOXjHvCkZqOQV DtFsMhay0OEsNdcCVBGMTnDLTkZsAhoT99c93bF2HtxFbyAQjl3lvg/Zfqa7o+pAyI4S CP/wvbtwXGOMeBnfI9vLkNXn0iM8qQFcaq+dAivPzGRd/wxQRfMI3t4dG0ZpdjCKoNG4 uu0A== X-Gm-Message-State: AOJu0YxMSmjRJkEd5+Ep3j1WD0KODiEN1v1G8CxMKiWxhDXX2nCi9xZF 94herRwhxZP1u5o1/XZvnNayDYFpXQ== X-Received: by 2002:a9d:6553:0:b0:6d6:45f1:d7b4 with SMTP id q19-20020a9d6553000000b006d645f1d7b4mr6684680otl.35.1700081829927; Wed, 15 Nov 2023 12:57:09 -0800 (PST) Received: from herring.priv (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id t10-20020a05683014ca00b006ce46212341sm689671otq.54.2023.11.15.12.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 12:57:08 -0800 (PST) Received: (nullmailer pid 3730642 invoked by uid 1000); Wed, 15 Nov 2023 20:57:06 -0000 From: Rob Herring To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] hwmon: lm25066: Use i2c_get_match_data() Date: Wed, 15 Nov 2023 14:57:02 -0600 Message-ID: <20231115205703.3730448-3-robh@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231115205703.3730448-1-robh@kernel.org> References: <20231115205703.3730448-1-robh@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 15 Nov 2023 12:57:47 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782665056855572790 X-GMAIL-MSGID: 1782665056855572790 Use preferred i2c_get_match_data() instead of of_match_device() and i2c_match_id() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Adjust the 'chips' enum to not use 0, so that no match data can be distinguished from a valid enum value. Signed-off-by: Rob Herring --- v2: - Split up per driver --- drivers/hwmon/pmbus/lm25066.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c index 929fa6d34efd..bd43457094a6 100644 --- a/drivers/hwmon/pmbus/lm25066.c +++ b/drivers/hwmon/pmbus/lm25066.c @@ -14,10 +14,10 @@ #include #include #include -#include +#include #include "pmbus.h" -enum chips { lm25056, lm25066, lm5064, lm5066, lm5066i }; +enum chips { lm25056 = 1, lm25066, lm5064, lm5066, lm5066i }; #define LM25066_READ_VAUX 0xd0 #define LM25066_MFR_READ_IIN 0xd1 @@ -468,8 +468,6 @@ static int lm25066_probe(struct i2c_client *client) struct lm25066_data *data; struct pmbus_driver_info *info; const struct __coeff *coeff; - const struct of_device_id *of_id; - const struct i2c_device_id *i2c_id; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) @@ -484,14 +482,8 @@ static int lm25066_probe(struct i2c_client *client) if (config < 0) return config; - i2c_id = i2c_match_id(lm25066_id, client); + data->id = (enum chips)i2c_get_match_data(client); - of_id = of_match_device(lm25066_of_match, &client->dev); - if (of_id && (unsigned long)of_id->data != i2c_id->driver_data) - dev_notice(&client->dev, "Device mismatch: %s in device tree, %s detected\n", - of_id->name, i2c_id->name); - - data->id = i2c_id->driver_data; info = &data->info; info->pages = 1;