Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp696608rdb; Fri, 1 Sep 2023 01:11:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBPCBXmomM/+VmY/Vy/OpulNxgG/x/wS+yNUbApw1T4HanZevJ5uehRKyJN3KjgvhFXA+W X-Received: by 2002:a05:6870:e6c1:b0:1b7:4655:2ac3 with SMTP id s1-20020a056870e6c100b001b746552ac3mr2158270oak.13.1693555869416; Fri, 01 Sep 2023 01:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693555869; cv=none; d=google.com; s=arc-20160816; b=oH2KH2AT4C83ckOm374F5I8pOXVVSZZjBh7qzy2B6jnPXCIxyHPiVksd+hyCwEFrYk 0oZcOtJOgLYns+tnt13CGu6VGxSqetMIHjGB7kP+FjxOCmUP1cug1d7CRIcwBIAOvRXQ LxxcIYorsKr/oTAjPObPwG8aBueIwzzf4oxubFalzzha5YP4qG/cXU44yV0N9Rnyc05O XxkG/9nWjw1IbH9aNDcAG4rh93jWv0/RFFi0pn+ogq1PkMYnEXbhU/BGqpfmT4ZQ28+c djxF4b+YWRRkpy4UROydPk0cetI0QB8TvapSPQ+GT37rXVL36q5IkcQTYiY0Y0Mep3F7 /t3g== 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=K0drmCE6uf+WWSKlruvy4ERgedPjEryZ7tDx5PWALHo=; fh=rSzuQORPqttdkP0RDj2xost2m6lvywyAHa5V74ER7cY=; b=S9VryLcSAolKUqjynHyNt7iKXlUGr77Yl9hyB7Fm81df3rsifdLTKVvZlFK/W2qCb8 3kin0JLjyYHKJ118Ddl7G4JKn0QGwWPpJw2K805cTv3IdJ1Y6zNj+tq6xH2Exl73FEpA OvHgk5ltmmAlwoVgW8quHGW578Y2SXkeIoCwVHQgOcxu6psPhi3KFUF2BDOCQM1z1Fae 2qhxNTTEOf+7iHrxoTlgh0PhPjstwUahBW4V7bpbo7OxkJA7IgqGrdWGMU4l96CkUC6w z5Y/35m99tnaYEWjaQtYVUPqvUKFyYgSrnv+0dlmLiBOzrqjdJpc4auAcaDS5jWDDM/+ ivgw== 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 gc13-20020a17090b310d00b00267ba1c43adsi2602898pjb.101.2023.09.01.01.10.55; Fri, 01 Sep 2023 01:11: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 S244599AbjHaUOo (ORCPT + 99 others); Thu, 31 Aug 2023 16:14:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbjHaUOn (ORCPT ); Thu, 31 Aug 2023 16:14:43 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2D70E5B for ; Thu, 31 Aug 2023 13:14:39 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,217,1688396400"; d="scan'208";a="174633935" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 01 Sep 2023 05:14:39 +0900 Received: from localhost.localdomain (unknown [10.226.92.179]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 577D34005B44; Fri, 1 Sep 2023 05:14:36 +0900 (JST) From: Biju Das To: Jaroslav Kysela , Takashi Iwai Cc: Biju Das , Liam Girdwood , Mark Brown , Charles Keepax , Andy Shevchenko , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] ASoC: wm8580: Simplify probe() Date: Thu, 31 Aug 2023 21:14:28 +0100 Message-Id: <20230831201429.94554-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230831201429.94554-1-biju.das.jz@bp.renesas.com> References: <20230831201429.94554-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 --- 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