Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp1154598rdb; Sat, 9 Sep 2023 11:08:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF85LssaX39qW99gRXTMAnfZXnxu2zZX7I+sVFEQdp7amBUvaEdTDJm3jwuV1rS22PQtRZu X-Received: by 2002:a17:902:e88e:b0:1c0:e87e:52ba with SMTP id w14-20020a170902e88e00b001c0e87e52bamr8366137plg.2.1694282895609; Sat, 09 Sep 2023 11:08:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694282895; cv=none; d=google.com; s=arc-20160816; b=N3PLfSBdo9481Eyq0GSXW6bkb+nXrIcmx2RFiHRR52mS6vF207zXdyLi74VGQFl52z Uv+5zAqHIU0Z7mSlI4rRVp43M3GCqGURdhE37GS+YJC0EHxJ2a1IUhN3T3fM/mZ35Ryc 2T866HoKqB0fNgVz0RrjK5/85hk9xgl+RJM7dIwwgd2yFrErYKYqvbCr230X7M02xG7D MzfgPrhUDwYq0wJ2isaYqjjMP5xJIh+JDuZNex14//vo/O5So/Qz/JrLdhq4Et5n4ru6 eNGKwwYKIBAkWdyZalE2wVplDllQUWJJWTFcx+SWyLB4Nq/GcU+Ml3zAyhJbcbhXst68 ge8w== 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=+rTKlZpRaIOEAcdSXezg4Dpqy4ANSS9eHDSkWQrFT7k=; fh=+giPXaJpSKwK1gTm7/7/7I+kye+vTt2snpl3XuahTQ8=; b=PBLHAOtbrREyHAEjUI5EhgpebOoWRPIhak0YlsAbCrad97lHxkxDjJIIplzDHPR79G VnYXLCFL78eE/3xwwXI8bYY43FSKd7DEeNQqXxepd9Jr/9r6EMFzunPHGrXumCNDZghg faGuMmTzE8OP4YA30jpkbGWCdVp+tk/lF6jJg0OiDbozgjK4DPuYMLyFA6UlbzZTj7XZ bJRsKt+AyHIu3XlTMcmTxxGf+IqGKHu8D7UF/U5hgIlovn0v4b8TUQnGiFyghKS8FAY7 mM3if3XyyCT84VQvKYpLKO/GIWLWUGq4+si4+wy9Sjaw7qPbn0GsammHuzywRxMWNHeB Xeqg== 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 n2-20020a170902d2c200b001bb6d711625si144954plc.279.2023.09.09.11.07.56; Sat, 09 Sep 2023 11:08:15 -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 S235432AbjIIQ02 (ORCPT + 99 others); Sat, 9 Sep 2023 12:26:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229655AbjIIQU7 (ORCPT ); Sat, 9 Sep 2023 12:20:59 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BF502197; Sat, 9 Sep 2023 09:20:53 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,239,1688396400"; d="scan'208";a="179256689" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 10 Sep 2023 01:20:52 +0900 Received: from localhost.localdomain (unknown [10.226.92.15]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 795EB402468A; Sun, 10 Sep 2023 01:20:50 +0900 (JST) From: Biju Das To: Michael Turquette , Stephen Boyd Cc: Biju Das , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Biju Das , Andy Shevchenko Subject: [PATCH] clk: si5351: Simplify probe() Date: Sat, 9 Sep 2023 17:20:47 +0100 Message-Id: <20230909162047.41845-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, 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 an OF match table, still, it uses an ID lookup table for retrieving match data. Currently, the driver is working on the assumption that an 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 i2c_get_match_data() if the devices are registered via OF/ID. Simplify probe() by replacing ID lookup table for retrieving match data with i2c_get_match_data(). Signed-off-by: Biju Das --- drivers/clk/clk-si5351.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c index 00fb9b09e030..afe12d1a9ddc 100644 --- a/drivers/clk/clk-si5351.c +++ b/drivers/clk/clk-si5351.c @@ -1385,8 +1385,7 @@ MODULE_DEVICE_TABLE(i2c, si5351_i2c_ids); static int si5351_i2c_probe(struct i2c_client *client) { - const struct i2c_device_id *id = i2c_match_id(si5351_i2c_ids, client); - enum si5351_variant variant = (enum si5351_variant)id->driver_data; + enum si5351_variant variant; struct si5351_platform_data *pdata; struct si5351_driver_data *drvdata; struct clk_init_data init; @@ -1394,6 +1393,7 @@ static int si5351_i2c_probe(struct i2c_client *client) u8 num_parents, num_clocks; int ret, n; + variant = (enum si5351_variant)(uintptr_t)i2c_get_match_data(client); ret = si5351_dt_parse(client, variant); if (ret) return ret; -- 2.25.1