From patchwork Thu Aug 31 19:46:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 137358 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c792:0:b0:3f2:4152:657d with SMTP id b18csp542986vqu; Thu, 31 Aug 2023 15:44:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHurzg5jY+h2Wn5lNI/ztkg4ETVjM/mGdD7l3kceBwgNtSRnJUGwjIvDw9TcNXn11qdG0Zv X-Received: by 2002:a17:90b:1e0c:b0:26b:6df8:eb69 with SMTP id pg12-20020a17090b1e0c00b0026b6df8eb69mr700307pjb.1.1693521849567; Thu, 31 Aug 2023 15:44:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693521849; cv=none; d=google.com; s=arc-20160816; b=gru3XgRTpkZPS/Gxmxsf2u8LJ3LIakgsqK6kCVdgNLg+vjn5NkPq4uukz12o5QCTgg VWTtdhafI4c7999m0FDvSyp3nDZt0A1JHlvlv+2Ttcxsj0GQuG48dr4shoWVx2YZqBl5 IrVoa17jmmO7uTe2lQ4H+ht4kyilHM17Efqjpmj6JbXGPYw3//gtJoZhn0PurLKfcbnd 2SJ+ymHw+eMN1uVd17W6B5FY54m8wp9Ds2pnfZLRrJEeM8eiHyzw5mZUi0cEZ3acGXvI E9kdxucv1ZoZmjzVE78/67u+m1tlZJTHWYV56jqvtdWTQ54tlSinyE0dVZCZ8Fo8gN4y APjA== 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=S9BTePyvjNib0mSaPdFlTZZ2eGnqI7bRkPo+50lfxHI=; fh=isro4ohP5UEoi6J58tTnBJC846N0ifuc0XKNYyi01B4=; b=E5+3O9aVChupJLJUPe2bhc5BQkYZOBcH3UfOZ7GphHWdwUSIt8cmwGGJVTR2fySr6O t7IGibJxidQszp4NGx8hPmGSeYN+VMV0dmwSBoVDEUw9lnfZEQk5TwK8adQofzL5vqGA BuwD2U8WWycTQ992XCvSeyni2s9F3X7JpCiA22HWj757JCWcuY4ZKAjxlpgk5M/wl0KH YPIPq0ezckBoNmSQICdTLRdVPxEh/1zeaqdUDtFyKFvyCrk0JDWcSWU6m6783xv1KgMa 4BLy/fo/MfgjhcpKpVFg1BVHZmmsFXmcyfL6yqDntM+XAyVOo18g5+PDWL493VfZYP5L wg0g== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a17090a970a00b00262ee7c6cafsi1898244pjo.87.2023.08.31.15.43.52; Thu, 31 Aug 2023 15:44:09 -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 S1347240AbjHaTql (ORCPT + 99 others); Thu, 31 Aug 2023 15:46:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347244AbjHaTqj (ORCPT ); Thu, 31 Aug 2023 15:46:39 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 458FEE7B for ; Thu, 31 Aug 2023 12:46:36 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,217,1688396400"; d="scan'208";a="174632400" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 01 Sep 2023 04:46:36 +0900 Received: from localhost.localdomain (unknown [10.226.92.179]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id A3F7740078BB; Fri, 1 Sep 2023 04:46:32 +0900 (JST) From: Biju Das To: Shenghao Ding , Kevin Lu , Baojun Xu , Jaroslav Kysela , Takashi Iwai Cc: Biju Das , Liam Girdwood , Mark Brown , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v3 2/3] ASoC: tlv320aic32x4-i2c: Simplify probe() Date: Thu, 31 Aug 2023 20:46:21 +0100 Message-Id: <20230831194622.87653-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230831194622.87653-1-biju.das.jz@bp.renesas.com> References: <20230831194622.87653-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775786367163388389 X-GMAIL-MSGID: 1775786367163388389 Simplify probe() by replacing of_match_node() and i2c_match_id() with i2c_get_match_data(). Signed-off-by: Biju Das Reviewed-by: Andy Shevchenko --- v2->v3: * Added Rb tag from Andy. v1->v2: * Return value of i2c_get_match_data() passed to type paramemter in aic32x4_probe(). --- sound/soc/codecs/tlv320aic32x4-i2c.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/sound/soc/codecs/tlv320aic32x4-i2c.c b/sound/soc/codecs/tlv320aic32x4-i2c.c index 713f3f63b5e3..b27b5ae1e4b2 100644 --- a/sound/soc/codecs/tlv320aic32x4-i2c.c +++ b/sound/soc/codecs/tlv320aic32x4-i2c.c @@ -16,9 +16,6 @@ #include "tlv320aic32x4.h" -static const struct of_device_id aic32x4_of_id[]; -static const struct i2c_device_id aic32x4_i2c_id[]; - static int aic32x4_i2c_probe(struct i2c_client *i2c) { struct regmap *regmap; @@ -30,18 +27,7 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c) config.val_bits = 8; regmap = devm_regmap_init_i2c(i2c, &config); - - if (i2c->dev.of_node) { - const struct of_device_id *oid; - - oid = of_match_node(aic32x4_of_id, i2c->dev.of_node); - type = (uintptr_t)oid->data; - } else { - const struct i2c_device_id *id; - - id = i2c_match_id(aic32x4_i2c_id, i2c); - type = id->driver_data; - } + type = (uintptr_t)i2c_get_match_data(i2c); return aic32x4_probe(&i2c->dev, regmap, type); }