Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp980927pxb; Fri, 15 Apr 2022 17:18:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvTf7VZIWaRD5cuCmsY480rh5F42t2N9NSK0kWZnrRWD/ojEDRUkHQlb2TkSidgyRwRmzX X-Received: by 2002:a17:90a:d082:b0:1ca:be58:c692 with SMTP id k2-20020a17090ad08200b001cabe58c692mr6745589pju.238.1650068298834; Fri, 15 Apr 2022 17:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650068298; cv=none; d=google.com; s=arc-20160816; b=LkJEce0g4KKYKdmbQjX9d4Jn7af6kk7UHtGVqKooDSt0g3jsCH33Y4LwonsqBHFrIu DwEI1gKAAGN7YlJOYjNFWpeam0CtPXpctxH9Pp6cWcLjLlApBl27POCfNjcNfj7CtFPx 7XmjHXCriJKD0ulh+y5dVpsIJOZk84h8jihhUIhTnRSUHqYXM7HrFo4Y2/wilSSS4TbQ aI49CKTUxWD8ePQt2Q01O7e81ASwijMQVTNXtyDBF2hoq8d6kD9KdOov6bOM5RZChHio IbUZxFrWGkjKyE+xoK64fMzTJDF6TfNgcCM6yH8PYiQNS8rzZkMnLZfj1/SIASvRzhp9 Jkzw== 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=MP1tNq8rXhrtMRbD5Ces0Kwo/NX1o0fi2WafCsEMWVM=; b=JqJAjspOnBeXbbd90ijhMjBRaYQ03I6UWWRsS00tZ+Ou0a9w/tf6yKNGbfXd8mwQRo YoyTOwT7UoTxk+YGkxFaMK6SZT0rD+mchsFkCBZ2elJrEcuddX0yOZq3LHlltM9CuBgb yB0gmruuCI8YT7Ge8zhp6fnsQoIx2Bi4t+9KQgOUTK2OcqazEkvdsi5OE7VbF0TRC6vs jMqq43sq9ohFXQsnJbvyUdlOa4Dm64moWeGY0UKd1lhxct9ymry2QPSAGJvBFa/pjn2o ZY+faR7gjgH6tIpJ+lgr99XHWzyBmGd7GQqmcDULy+lxINW/F7i6aj/E3g3Don7JeA2C LN+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t2-20020a170902b20200b00158e46d79dfsi1250697plr.236.2022.04.15.17.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:18:18 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4A3B7D371B; Fri, 15 Apr 2022 17:17:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348649AbiDOPlb (ORCPT + 99 others); Fri, 15 Apr 2022 11:41:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355314AbiDOPlU (ORCPT ); Fri, 15 Apr 2022 11:41:20 -0400 Received: from 4.mo575.mail-out.ovh.net (4.mo575.mail-out.ovh.net [46.105.59.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BA3D50464 for ; Fri, 15 Apr 2022 08:38:50 -0700 (PDT) Received: from player788.ha.ovh.net (unknown [10.110.115.29]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id C888A2343A for ; Fri, 15 Apr 2022 15:38:48 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player788.ha.ovh.net (Postfix) with ESMTPSA id 3BDC829867006; Fri, 15 Apr 2022 15:38:43 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-100R003ae2f5d48-d3a3-4e50-baca-c251b8c8e9d3, 77125C2C2681624F8512B69FC7A1C9B53E6602B4) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Liam Girdwood , Mark Brown Cc: Wolfram Sang , linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH 3/6] ASoC: max980*: use i2c_match_id and simple i2c probe Date: Fri, 15 Apr 2022 17:38:14 +0200 Message-Id: <20220415153817.141364-4-steve@sk2.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220415153817.141364-1-steve@sk2.org> References: <20220415153817.141364-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 10486631734977201798 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudelhedgleefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeejleelvdefieeiuddtfeevkeegueehkeekvdffgedvhedugeekgfejjeekgfeugeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejkeekrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 As part of the ongoing i2c transition to the simple probe ("probe_new"), this patch uses i2c_match_id to retrieve the driver_data for the probed device. The id parameter is thus no longer necessary and the simple probe can be used instead. In the context of an i2c probe, i2c_match_id with the module id table and the probed client never returns null, so removing the null check on the i2c_device_id pointer is safe. The i2c id tables are moved up before the probe function, as suggested by Wolfram Sang. Signed-off-by: Stephen Kitt --- sound/soc/codecs/max98088.c | 21 +++++++++++---------- sound/soc/codecs/max98090.c | 23 ++++++++++++----------- sound/soc/codecs/max98095.c | 19 ++++++++++--------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 429717d4ac5a..5ef2e1279ee7 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -1737,11 +1737,18 @@ static const struct snd_soc_component_driver soc_component_dev_max98088 = { .non_legacy_dai_naming = 1, }; -static int max98088_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static const struct i2c_device_id max98088_i2c_id[] = { + { "max98088", MAX98088 }, + { "max98089", MAX98089 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, max98088_i2c_id); + +static int max98088_i2c_probe(struct i2c_client *i2c) { struct max98088_priv *max98088; int ret; + const struct i2c_device_id *id; max98088 = devm_kzalloc(&i2c->dev, sizeof(struct max98088_priv), GFP_KERNEL); @@ -1757,6 +1764,7 @@ static int max98088_i2c_probe(struct i2c_client *i2c, if (PTR_ERR(max98088->mclk) == -EPROBE_DEFER) return PTR_ERR(max98088->mclk); + id = i2c_match_id(max98088_i2c_id, i2c); max98088->devtype = id->driver_data; i2c_set_clientdata(i2c, max98088); @@ -1767,13 +1775,6 @@ static int max98088_i2c_probe(struct i2c_client *i2c, return ret; } -static const struct i2c_device_id max98088_i2c_id[] = { - { "max98088", MAX98088 }, - { "max98089", MAX98089 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, max98088_i2c_id); - #if defined(CONFIG_OF) static const struct of_device_id max98088_of_match[] = { { .compatible = "maxim,max98088" }, @@ -1788,7 +1789,7 @@ static struct i2c_driver max98088_i2c_driver = { .name = "max98088", .of_match_table = of_match_ptr(max98088_of_match), }, - .probe = max98088_i2c_probe, + .probe_new = max98088_i2c_probe, .id_table = max98088_i2c_id, }; diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index b45ec35cd63c..4058e147413c 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -2529,8 +2529,14 @@ static const struct regmap_config max98090_regmap = { .cache_type = REGCACHE_RBTREE, }; -static int max98090_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *i2c_id) +static const struct i2c_device_id max98090_i2c_id[] = { + { "max98090", MAX98090 }, + { "max98091", MAX98091 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, max98090_i2c_id); + +static int max98090_i2c_probe(struct i2c_client *i2c) { struct max98090_priv *max98090; const struct acpi_device_id *acpi_id; @@ -2552,7 +2558,9 @@ static int max98090_i2c_probe(struct i2c_client *i2c, return -EINVAL; } driver_data = acpi_id->driver_data; - } else if (i2c_id) { + } else { + const struct i2c_device_id *i2c_id = + i2c_match_id(max98090_i2c_id, i2c); driver_data = i2c_id->driver_data; } @@ -2659,13 +2667,6 @@ static const struct dev_pm_ops max98090_pm = { SET_SYSTEM_SLEEP_PM_OPS(NULL, max98090_resume) }; -static const struct i2c_device_id max98090_i2c_id[] = { - { "max98090", MAX98090 }, - { "max98091", MAX98091 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, max98090_i2c_id); - #ifdef CONFIG_OF static const struct of_device_id max98090_of_match[] = { { .compatible = "maxim,max98090", }, @@ -2690,7 +2691,7 @@ static struct i2c_driver max98090_i2c_driver = { .of_match_table = of_match_ptr(max98090_of_match), .acpi_match_table = ACPI_PTR(max98090_acpi_match), }, - .probe = max98090_i2c_probe, + .probe_new = max98090_i2c_probe, .shutdown = max98090_i2c_shutdown, .remove = max98090_i2c_remove, .id_table = max98090_i2c_id, diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c index 4977b00ddf5f..7bca99fa61b5 100644 --- a/sound/soc/codecs/max98095.c +++ b/sound/soc/codecs/max98095.c @@ -2106,11 +2106,17 @@ static const struct snd_soc_component_driver soc_component_dev_max98095 = { .non_legacy_dai_naming = 1, }; -static int max98095_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static const struct i2c_device_id max98095_i2c_id[] = { + { "max98095", MAX98095 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, max98095_i2c_id); + +static int max98095_i2c_probe(struct i2c_client *i2c) { struct max98095_priv *max98095; int ret; + const struct i2c_device_id *id; max98095 = devm_kzalloc(&i2c->dev, sizeof(struct max98095_priv), GFP_KERNEL); @@ -2126,6 +2132,7 @@ static int max98095_i2c_probe(struct i2c_client *i2c, return ret; } + id = i2c_match_id(max98095_i2c_id, i2c); max98095->devtype = id->driver_data; i2c_set_clientdata(i2c, max98095); max98095->pdata = i2c->dev.platform_data; @@ -2136,12 +2143,6 @@ static int max98095_i2c_probe(struct i2c_client *i2c, return ret; } -static const struct i2c_device_id max98095_i2c_id[] = { - { "max98095", MAX98095 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, max98095_i2c_id); - #ifdef CONFIG_OF static const struct of_device_id max98095_of_match[] = { { .compatible = "maxim,max98095", }, @@ -2155,7 +2156,7 @@ static struct i2c_driver max98095_i2c_driver = { .name = "max98095", .of_match_table = of_match_ptr(max98095_of_match), }, - .probe = max98095_i2c_probe, + .probe_new = max98095_i2c_probe, .id_table = max98095_i2c_id, }; -- 2.27.0