Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp1174683rdb; Sat, 9 Sep 2023 12:11:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEsvrTeETeMpBv9xrQ2zzQVV9AHx805V4mc1Uji3Mw+uCwHuygZtJ8HkJuci41jtXwTLZDU X-Received: by 2002:a05:6a00:248d:b0:68a:4261:ab6d with SMTP id c13-20020a056a00248d00b0068a4261ab6dmr6100360pfv.26.1694286681083; Sat, 09 Sep 2023 12:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694286681; cv=none; d=google.com; s=arc-20160816; b=YulZlOnNoDi84a3AF22fSKdhlp83mtStMnZP65GLqME7dyb2MjXzPxsM6Oa5Jb5pG7 ZYoGoQSWL/QZvGoDF2jID3T5OPQHWhT3w1uXTHROqUfXz7gZxFom20gjzz+x9OBpX+Oa km4+tX4FIpsxLziLOTCdt5XiYW7zTCz6fj0KyGs311Ed3PQhNuyfFmMpdo9R9nrtrMXB jV6wZWUZlYMGo/CoNCik0kwpRCaL1ezHmXD1L96mY7U59+KR/PKhwoloa+WTeEtUWviE rQPYy4gnCPe6RhUCpGfAM708VQIoJvUU7BbF1Z9NS6QM4zpkjeoEKAdEVDTUNjb3OAWG kpig== 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=aOt+2gnom/X+eCuTqvCRN/jgd6DcII+uJWdfElY7Xv0=; fh=xeSrQ7kCdgcCVb2zAn5rBkDAdtmCo24cOODwKpU9NDo=; b=t7onmFxyt1vo8hskKi9K4k9SUsvS3C6rxQgVKg7Xd7xokDYQo/s0OLNwb0E7URePqS JgU0synVUooj6frFVSZ9RMuRNrnhV+3MXINAv0EjgcjJayYfBdUV3pRMto//cHHo+3u0 fafL9ASwfVW8ObfkAN+myEXgmwC4LYCXwM9qrxTFYcKrjnElmufWNwm9oj8f88FG6VgI iBvFpIx9A8d0WRDxISJT7Dm2a6yv0OzjeXuLiNjZpTwZtQgO57srdHOSsu0ra3XBsWsr KT70hWRS0vRsRemLLahibj+0UkI+y8pRX4ic2cFGeCWy/aTzJm1NMgCOjSm4V+5VcN6o PPEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a056a00249400b006875398611csi3568916pfv.80.2023.09.09.12.11.07; Sat, 09 Sep 2023 12:11:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345641AbjIIMTU (ORCPT + 99 others); Sat, 9 Sep 2023 08:19:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345594AbjIIMTR (ORCPT ); Sat, 9 Sep 2023 08:19:17 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ADAE3CCA; Sat, 9 Sep 2023 05:19:13 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,239,1688396400"; d="scan'208";a="175527304" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 09 Sep 2023 21:19:12 +0900 Received: from localhost.localdomain (unknown [10.226.92.15]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 7E27041EBFFC; Sat, 9 Sep 2023 21:19:10 +0900 (JST) From: Biju Das To: Linus Walleij Cc: Biju Das , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Biju Das , Andy Shevchenko Subject: [PATCH v2 1/4] pinctrl: mcp23s08_i2c: Extend match support for OF tables Date: Sat, 9 Sep 2023 13:19:00 +0100 Message-Id: <20230909121903.34062-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230909121903.34062-1-biju.das.jz@bp.renesas.com> References: <20230909121903.34062-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver has OF match table, still it uses ID lookup table for retrieving match data. Currently the driver is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID. The correct approach is to have an OF device ID table using of_device_match_data() if the devices are registered via OF. Signed-off-by: Biju Das --- v1->v2: * Arranged variable declaration in reverse xmas tree. --- drivers/pinctrl/pinctrl-mcp23s08_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinctrl-mcp23s08_i2c.c b/drivers/pinctrl/pinctrl-mcp23s08_i2c.c index 3dd1bd8e73eb..41ea2650a7e4 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08_i2c.c +++ b/drivers/pinctrl/pinctrl-mcp23s08_i2c.c @@ -10,16 +10,16 @@ static int mcp230xx_probe(struct i2c_client *client) { - const struct i2c_device_id *id = i2c_client_get_device_id(client); struct device *dev = &client->dev; - unsigned int type = id->driver_data; struct mcp23s08 *mcp; + unsigned int type; int ret; mcp = devm_kzalloc(dev, sizeof(*mcp), GFP_KERNEL); if (!mcp) return -ENOMEM; + type = (uintptr_t)i2c_get_match_data(client); switch (type) { case MCP_TYPE_008: mcp->regmap = devm_regmap_init_i2c(client, &mcp23x08_regmap); -- 2.25.1