From patchwork Fri Jun 30 17:21:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 697992 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 27075EB64DA for ; Fri, 30 Jun 2023 17:24:35 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 420E385D; Fri, 30 Jun 2023 19:23:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 420E385D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688145873; bh=Xfinsx2cbNjgygxyV5dAX8kY09FdNFlEzPlxBJeXw0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=trwwScq2ijHZo5CkszW9ogix7RESpGj0ROs+fme2De4/JvdeJSoEue099O+6j25ng igcVdK14ikB6SH+5KWMA4WPKN+May9BJA9ejfDrZtkYCtWxzxiOCfLiU9q5CEzu2x1 UUsxUo+fyd3kbv5noB1CooYhURBLMnK+BrTArhR8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A1DA3F805AC; Fri, 30 Jun 2023 19:22:21 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 17523F805A8; Fri, 30 Jun 2023 19:22:21 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9EBBFF800E3; Fri, 30 Jun 2023 19:22:11 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 287CDF800E3 for ; Fri, 30 Jun 2023 19:22:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 287CDF800E3 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=IUjoI/dz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688145726; x=1719681726; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Xfinsx2cbNjgygxyV5dAX8kY09FdNFlEzPlxBJeXw0c=; b=IUjoI/dzWUcfKPwjX0QrHFm+LGsgd/I8JXrZ4tn5sEGyHmxMTuPGx/1A ofrvUaCbgg0dCvNP3K3Pyn3iGWxoj6H/vXkVegNa06d3AtJjpe/56Pg43 I1eRBn28G5R26ffcjP3xJvc9iesoNNp+qa/E49RlfhHrLZ+RCJ10q8k4j toR26d1h6qvCX4nOZGSN8QQ0Gpr5tniNvVeh9FVe2mF6Ci3rzrtZejJIh RTTGACPYFvfCHwpbhySZ6pkxl2GGjhNC7YMXyU109EPgntQpIillz5902 GAEzQJljTYWCUa/RkCB9+WUdduObbN1myQIbv35Yu75GFAjHYf5kKaFc0 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10757"; a="361298316" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="361298316" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2023 10:21:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10757"; a="747486144" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="747486144" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 30 Jun 2023 10:21:55 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id E97F5516; Fri, 30 Jun 2023 20:21:57 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Oder Chiou , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Subject: [PATCH v2 3/4] ASoC: rt5677: Use device_get_match_data() Date: Fri, 30 Jun 2023 20:21:54 +0300 Message-Id: <20230630172155.83754-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230630172155.83754-1-andriy.shevchenko@linux.intel.com> References: <20230630172155.83754-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: 4H2ZNBMB6LTZLXJGNP6FMAYSGZDZHJSX X-Message-ID-Hash: 4H2ZNBMB6LTZLXJGNP6FMAYSGZDZHJSX X-MailFrom: andriy.shevchenko@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Use device_get_match_data() to simplify the code. Signed-off-by: Andy Shevchenko --- sound/soc/codecs/rt5677.c | 21 ++++----------------- sound/soc/codecs/rt5677.h | 4 ++-- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 17d5dd5d2974..b0c15e27c763 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -6,7 +6,6 @@ * Author: Oder Chiou */ -#include #include #include #include @@ -18,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -5531,6 +5529,7 @@ static int rt5677_init_irq(struct i2c_client *i2c) static int rt5677_i2c_probe(struct i2c_client *i2c) { + struct device *dev = &i2c->dev; struct rt5677_priv *rt5677; int ret; unsigned int val; @@ -5545,21 +5544,9 @@ static int rt5677_i2c_probe(struct i2c_client *i2c) INIT_DELAYED_WORK(&rt5677->dsp_work, rt5677_dsp_work); i2c_set_clientdata(i2c, rt5677); - if (i2c->dev.of_node) { - const struct of_device_id *match_id; - - match_id = of_match_device(rt5677_of_match, &i2c->dev); - if (match_id) - rt5677->type = (enum rt5677_type)match_id->data; - } else if (ACPI_HANDLE(&i2c->dev)) { - const struct acpi_device_id *acpi_id; - - acpi_id = acpi_match_device(rt5677_acpi_match, &i2c->dev); - if (acpi_id) - rt5677->type = (enum rt5677_type)acpi_id->driver_data; - } else { + rt5677->type = (enum rt5677_type)(uintptr_t)device_get_match_data(dev); + if (rt5677->type == 0) return -EINVAL; - } rt5677_read_device_properties(rt5677, &i2c->dev); @@ -5674,7 +5661,7 @@ static struct i2c_driver rt5677_i2c_driver = { .driver = { .name = RT5677_DRV_NAME, .of_match_table = rt5677_of_match, - .acpi_match_table = ACPI_PTR(rt5677_acpi_match), + .acpi_match_table = rt5677_acpi_match, }, .probe = rt5677_i2c_probe, .remove = rt5677_i2c_remove, diff --git a/sound/soc/codecs/rt5677.h b/sound/soc/codecs/rt5677.h index 5932b04cf85e..d67ebae067d9 100644 --- a/sound/soc/codecs/rt5677.h +++ b/sound/soc/codecs/rt5677.h @@ -1691,8 +1691,8 @@ enum { }; enum rt5677_type { - RT5677, - RT5676, + RT5677 = 1, + RT5676 = 2, }; /* ASRC clock source selection */