Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp735971rdb; Fri, 1 Sep 2023 02:44:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHtvmXKRo8lGah63eqdl47W+Pm/Ol1cclXqSipOBkSzJH2X/OAfJSNhxalxoIUvBEbo8DY X-Received: by 2002:ac2:598d:0:b0:4f7:6453:f3f1 with SMTP id w13-20020ac2598d000000b004f76453f3f1mr1272854lfn.15.1693561452060; Fri, 01 Sep 2023 02:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693561452; cv=none; d=google.com; s=arc-20160816; b=KsvAU9EWRVeRV8dg5Wpuz1goNiWfuYpd1P6CsTPnatLvOBOXrYO8BM24DoInCtQbye a/7qmk3s62Oym/gBIQhTCP7dq4hyDxBpC8vJJMnH4+pohmYHVZwTh20ZcP/fyTpJCMQl hTCKKLVSqiyyt4vydsAd8HhHPkP/ux/RJD5dwb3mTzvAiUvNfgy07lHt0ndLihL25STQ 0Zvv0u1x9axPBU2h75YdZ6EguDu4+7PcyY082IVjIU/oSxdHgXwHQEaqFdRoZSpK1lfP m+4W394JBqiHm9i34d8V5IGMGD4QdHzgmjnAkhl4Vrs6U8R+SAt2YWQommj8IW4LFHcd C7Fw== 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=r9XKLv164UoKobQMCseTx9TA6ZvghucUkks8OVZm1Yg=; fh=TuYOsclT2+Y56rXH3knQ9yzreL+Q66+Rs2eHdbNC+ss=; b=V0/8r1oFJlQv6kcA73NAEk0kjo50SzgVqsicC5tsgr4bQF7bKV+kvcEyoWs7W/op2f i0kSoPoCtDOxhjg+3Nw1JSfVTrXlOz0PhvIyrSAAJnOvXiflK8AWYA+Hoqk3wO+//msf a70Tc77cowFMzd9wFqy/BCyjkQOJdmHdvjetZAvaB0+tv0SMD0nIOcjt6tGiXzYYTonO PbeUhLMA2oejlF7D78orFy2LgC3mcR8/vTUAjnOsNmA/AlZoFYsf7WdGfHpQO75iV4gP nCAiIL4rX8peQx030WVQ4gjaxiCn4YJr/upCUqvuRvk2M2u6t3HjaGudI1lfOg0avt/h mbMg== 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 q22-20020a1709060e5600b0099d6d4c11d4si2111542eji.782.2023.09.01.02.43.39; Fri, 01 Sep 2023 02:44:12 -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 S1347448AbjHaUrv (ORCPT + 99 others); Thu, 31 Aug 2023 16:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347445AbjHaUru (ORCPT ); Thu, 31 Aug 2023 16:47:50 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 477AE1B0 for ; Thu, 31 Aug 2023 13:47:47 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,217,1688396400"; d="scan'208";a="178342519" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Sep 2023 05:47:46 +0900 Received: from localhost.localdomain (unknown [10.226.92.179]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id A0C594029216; Fri, 1 Sep 2023 05:47:43 +0900 (JST) From: Biju Das To: Jaroslav Kysela , Takashi Iwai Cc: Biju Das , Liam Girdwood , Mark Brown , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v3 2/2] ASoC: ak4642: Simplify probe() Date: Thu, 31 Aug 2023 21:47:34 +0100 Message-Id: <20230831204734.104954-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230831204734.104954-1-biju.das.jz@bp.renesas.com> References: <20230831204734.104954-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,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 Simpilfy probe() by replacing of_device_get_match_data() and id lookup for retrieving match data by i2c_get_match_data(). Signed-off-by: Biju Das --- v2->v3: * Removing local variable np is handled in patch#1. v1->v2: * Removed forward declaration ak4642_of_match and ak4642_i2c_id. * Restored error EINVAL. * Used dev_fwnode() and replaced dev->of_node. * Removed comma in the terminator entry. --- sound/soc/codecs/ak4642.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 901014909c0f..8a40c6b3f4d8 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -628,32 +628,21 @@ static struct clk *ak4642_of_parse_mcko(struct device *dev) #define ak4642_of_parse_mcko(d) 0 #endif -static const struct of_device_id ak4642_of_match[]; -static const struct i2c_device_id ak4642_i2c_id[]; static int ak4642_i2c_probe(struct i2c_client *i2c) { struct device *dev = &i2c->dev; - const struct ak4642_drvdata *drvdata = NULL; + const struct ak4642_drvdata *drvdata; struct regmap *regmap; struct ak4642_priv *priv; struct clk *mcko = NULL; if (dev_fwnode(dev)) { - const struct of_device_id *of_id; - mcko = ak4642_of_parse_mcko(dev); if (IS_ERR(mcko)) mcko = NULL; - - of_id = of_match_device(ak4642_of_match, dev); - if (of_id) - drvdata = of_id->data; - } else { - const struct i2c_device_id *id = - i2c_match_id(ak4642_i2c_id, i2c); - drvdata = (const struct ak4642_drvdata *)id->driver_data; } + drvdata = i2c_get_match_data(i2c); if (!drvdata) return dev_err_probe(dev, -EINVAL, "Unknown device type\n"); -- 2.25.1