Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp696327rdb; Fri, 1 Sep 2023 01:10:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyIjR6/AbzS5t7dqPWz0ng+IDjhqA0aNUJDpHW6s+1kRvsByLQaox5vMped6Z9m3s+Spwa X-Received: by 2002:a17:90a:5b15:b0:271:ae4f:dd15 with SMTP id o21-20020a17090a5b1500b00271ae4fdd15mr1660266pji.32.1693555839698; Fri, 01 Sep 2023 01:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693555839; cv=none; d=google.com; s=arc-20160816; b=OxTiTmkjvEv9+ZI5AgKl4cNHYS4p+7bMCNK8S7dmgaM0KkL8xq9s4RFw5G/JNmHu+j xoTZQAlfF24SrWrxGqwbAI8/ZFj0kvGKjbNVUEYSOYY1fmxUA61gnjfvjfiR4knNuked xjkHntbmL6X63MqpQLLbFF69Vc7UiHwcTPmt7aT+GIPpulKRtgivHYJja2CyhI8KIQIH 8VQbfB/b4pUvh5wzs5BnDwYkpNEVASCTGC1wRLUKW1FOr/NjNTP2PVZmn+z6x9xR/1fW zk4QJbVWMelmQ1LM0/wh5PMbPX4WqpH9iT+TnanQ2qrRNk+cNVJbQDxbPu85q45uNt4C 9P+A== 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=bp9DJO6yKq0Jg4KhZL4RNTHg9XIHvCWxZmnRRxEoco8=; fh=bnS55+PkCBQcjlLw9ish3xkr88PtZOja0af1JdvbBB8=; b=tYfpc+dGkq99HrOV+QCgzCgfdrl/Jsbbe/51YP0QT/veixBRWg/hUvzzzr+f/WFNKj W4K8JrlJWkhQ+tdnoTwex3pjRM8TgdFoOoh1j0duCqrYXObVapWQqnafNWLPcqqJdhn3 foJoKjzDDy68prxUI0UlU301DaxqxvorbNCFjFPHclHleNRi41fiD5AYWZ4+0nWbKrLI OBfp8lbPiSO7wkB8CRqpjsAXHpj2IKtz35lXvHX2Q1gMz7ZSuQoDRRoN3TkQQdseXt29 3Ku2gk5jLkjoj4H9BDoIK8Fmk/R/oN+MiFo6jFV9Xncg5ge3QFssN2gYxl+hMjP4hALa VQBw== 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 kt4-20020a170903088400b001bee750a8aasi2335466plb.580.2023.09.01.01.10.26; Fri, 01 Sep 2023 01:10:39 -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 S1348424AbjIAHAI (ORCPT + 99 others); Fri, 1 Sep 2023 03:00:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345362AbjIAHAG (ORCPT ); Fri, 1 Sep 2023 03:00:06 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 389DFC5 for ; Fri, 1 Sep 2023 00:00:04 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,218,1688396400"; d="scan'208";a="178409324" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 01 Sep 2023 16:00:03 +0900 Received: from localhost.localdomain (unknown [10.226.92.203]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id D1255400264E; Fri, 1 Sep 2023 15:59:59 +0900 (JST) From: Biju Das To: Jaroslav Kysela , Takashi Iwai Cc: Biju Das , Liam Girdwood , Mark Brown , Charles Keepax , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Andy Shevchenko , patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Biju Das Subject: [PATCH v4 1/3] ASoC: wm8580: Simplify probe() Date: Fri, 1 Sep 2023 07:59:50 +0100 Message-Id: <20230901065952.18760-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230901065952.18760-1-biju.das.jz@bp.renesas.com> References: <20230901065952.18760-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 Simplify probe() by replacing of_match_device->i2c_get_match_data() and extend matching support for ID table. While at it, remove comma in the terminator entry and simplify probe() by replacing dev_err()->dev_err_probe(). Signed-off-by: Biju Das Acked-by: Charles Keepax Reviewed-by: Andy Shevchenko --- v3->v4: * No change. v2->v3: * Added Rb tag from Andy. * Restored OF table postion and moved in patch#2 v1->v2: * Added Ack from Charles Keepax. * Removed comma in the terminator entry. * Restored original error code -EINVAL --- sound/soc/codecs/wm8580.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 6d22f7d40ec2..826c39ec4a1e 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c @@ -997,7 +997,6 @@ MODULE_DEVICE_TABLE(of, wm8580_of_match); static int wm8580_i2c_probe(struct i2c_client *i2c) { - const struct of_device_id *of_id; struct wm8580_priv *wm8580; int ret, i; @@ -1022,14 +1021,9 @@ static int wm8580_i2c_probe(struct i2c_client *i2c) i2c_set_clientdata(i2c, wm8580); - of_id = of_match_device(wm8580_of_match, &i2c->dev); - if (of_id) - wm8580->drvdata = of_id->data; - - if (!wm8580->drvdata) { - dev_err(&i2c->dev, "failed to find driver data\n"); - return -EINVAL; - } + wm8580->drvdata = i2c_get_match_data(i2c); + if (!wm8580->drvdata) + return dev_err_probe(&i2c->dev, -EINVAL, "failed to find driver data\n"); ret = devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_wm8580, wm8580_dai, ARRAY_SIZE(wm8580_dai)); -- 2.25.1