Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp45266lfe; Fri, 15 Apr 2022 18:40:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxizlP8+/BxXB6mxigp2GX4lVlbO24C4IVzmEDk3T/+5o67VAQmg0Da4Pqb6DFNeSCN+Rnb X-Received: by 2002:a17:90b:1e01:b0:1cf:573c:5625 with SMTP id pg1-20020a17090b1e0100b001cf573c5625mr7084340pjb.75.1650073217238; Fri, 15 Apr 2022 18:40:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650073217; cv=none; d=google.com; s=arc-20160816; b=ks19kaMoGb1fSNF30kepsHNRvslWGoDXXst7PKpY+j4PB0mJfaeCfVO63dyN/DtiRr Jtjm43yIoByr6j36SPjwcruOh5bR9LoIagNVBhC1hEWKa5pj/2QFo6waW9y7BhJrPeGa tYO0y1Sd9glFHN1b4ZGSerLlfOxg2QdDLV5V5iPhTuZXBfoXc6u7h6GaRCkFTUkxu1F2 M3npugXoDWhVB/2d+DNl2QwuBwl9rn1Xt67+kkhpUGBfUYRxzw77Gn5agqrtoT5zntqR HOgvBbsgd0/moo1Be57BWO0rL+da4oelOtl4YSNNydAKLAcgCRzGEGILu8qQK3KtaSSc clOQ== 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=D1LqqDwfMZ6ha9RReWjuslz4nXQChBNnYnV9a7QrN/4=; b=o9D1MF9G/h8pAqDcE+BADRVkfZkn9CfAV2wzRCRFWDifoyLih5AhuksF0ZKZjFr53U E3e+v2FnvZB8LEn2Qw/8fPiHVjgx+8PWcu4n/G2K6lBH78pXY5md0ey4rhwSe/mzVnbq Dy0JYiSI71mm0NdopmQxXxbQAUTp2NDu2N8SljHcLBy9V2U/4KDmt3xRn1JGQ+whaoKl /l4Wk7YkqzRX2hbuEh/YWlkD0/VLO8mlMAmhyPY/v8dpQf/1piXuL0g2vQQ6zJfdI/b4 wY6iXWwqaB7R0xkndCOxsdlTDMWzqw6E1lEzQ0iKrylpDRwqhzLdEzX4xKs/OMoC8KH1 8Mow== 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 x3-20020a170902fe8300b0015605e9e571si2467542plm.494.2022.04.15.18.40.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 18:40:17 -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 068B3F94E2; Fri, 15 Apr 2022 18:05:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355510AbiDOQPl (ORCPT + 99 others); Fri, 15 Apr 2022 12:15:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235513AbiDOQPi (ORCPT ); Fri, 15 Apr 2022 12:15:38 -0400 Received: from 4.mo576.mail-out.ovh.net (4.mo576.mail-out.ovh.net [46.105.42.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFCC18B6FE for ; Fri, 15 Apr 2022 09:13:09 -0700 (PDT) Received: from player760.ha.ovh.net (unknown [10.111.208.246]) by mo576.mail-out.ovh.net (Postfix) with ESMTP id 595F82463A for ; Fri, 15 Apr 2022 16:06:50 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player760.ha.ovh.net (Postfix) with ESMTPSA id BEDC92986A90E; Fri, 15 Apr 2022 16:06:44 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-101G0044d467020-e7dc-4167-a667-403648bacf92, 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 v2 2/7] ASoC: alc56*: use i2c_match_id and simple i2c probe Date: Fri, 15 Apr 2022 18:06:08 +0200 Message-Id: <20220415160613.148882-3-steve@sk2.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220415160613.148882-1-steve@sk2.org> References: <20220415160613.148882-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 10960072647168853638 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudelhedgleekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeejleelvdefieeiuddtfeevkeegueehkeekvdffgedvhedugeekgfejjeekgfeugeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejiedtrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh 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. The i2c id tables are moved up before the probe function, as suggested by Wolfram Sang. Signed-off-by: Stephen Kitt --- sound/soc/codecs/alc5623.c | 24 +++++++++++++----------- sound/soc/codecs/alc5632.c | 20 +++++++++++--------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index b10357a6d655..8e6235d2c544 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c @@ -968,14 +968,21 @@ static const struct regmap_config alc5623_regmap = { .cache_type = REGCACHE_RBTREE, }; +static const struct i2c_device_id alc5623_i2c_table[] = { + {"alc5621", 0x21}, + {"alc5622", 0x22}, + {"alc5623", 0x23}, + {} +}; +MODULE_DEVICE_TABLE(i2c, alc5623_i2c_table); + /* * ALC5623 2 wire address is determined by A1 pin * state during powerup. * low = 0x1a * high = 0x1b */ -static int alc5623_i2c_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int alc5623_i2c_probe(struct i2c_client *client) { struct alc5623_platform_data *pdata; struct alc5623_priv *alc5623; @@ -983,6 +990,7 @@ static int alc5623_i2c_probe(struct i2c_client *client, unsigned int vid1, vid2; int ret; u32 val32; + const struct i2c_device_id *id; alc5623 = devm_kzalloc(&client->dev, sizeof(struct alc5623_priv), GFP_KERNEL); @@ -1009,6 +1017,8 @@ static int alc5623_i2c_probe(struct i2c_client *client, } vid2 >>= 8; + id = i2c_match_id(alc5623_i2c_table, client); + if ((vid1 != 0x10ec) || (vid2 != id->driver_data)) { dev_err(&client->dev, "unknown or wrong codec\n"); dev_err(&client->dev, "Expected %x:%lx, got %x:%x\n", @@ -1060,14 +1070,6 @@ static int alc5623_i2c_probe(struct i2c_client *client, return ret; } -static const struct i2c_device_id alc5623_i2c_table[] = { - {"alc5621", 0x21}, - {"alc5622", 0x22}, - {"alc5623", 0x23}, - {} -}; -MODULE_DEVICE_TABLE(i2c, alc5623_i2c_table); - #ifdef CONFIG_OF static const struct of_device_id alc5623_of_match[] = { { .compatible = "realtek,alc5623", }, @@ -1082,7 +1084,7 @@ static struct i2c_driver alc5623_i2c_driver = { .name = "alc562x-codec", .of_match_table = of_match_ptr(alc5623_of_match), }, - .probe = alc5623_i2c_probe, + .probe_new = alc5623_i2c_probe, .id_table = alc5623_i2c_table, }; diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index 6d7af3736a91..641bdfddae16 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -1092,18 +1092,24 @@ static const struct regmap_config alc5632_regmap = { .cache_type = REGCACHE_RBTREE, }; +static const struct i2c_device_id alc5632_i2c_table[] = { + {"alc5632", 0x5c}, + {} +}; +MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table); + /* * alc5632 2 wire address is determined by A1 pin * state during powerup. * low = 0x1a * high = 0x1b */ -static int alc5632_i2c_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int alc5632_i2c_probe(struct i2c_client *client) { struct alc5632_priv *alc5632; int ret, ret1, ret2; unsigned int vid1, vid2; + const struct i2c_device_id *id; alc5632 = devm_kzalloc(&client->dev, sizeof(struct alc5632_priv), GFP_KERNEL); @@ -1129,6 +1135,8 @@ static int alc5632_i2c_probe(struct i2c_client *client, vid2 >>= 8; + id = i2c_match_id(alc5632_i2c_table, client); + if ((vid1 != 0x10EC) || (vid2 != id->driver_data)) { dev_err(&client->dev, "Device is not a ALC5632: VID1=0x%x, VID2=0x%x\n", vid1, vid2); @@ -1161,12 +1169,6 @@ static int alc5632_i2c_probe(struct i2c_client *client, return ret; } -static const struct i2c_device_id alc5632_i2c_table[] = { - {"alc5632", 0x5c}, - {} -}; -MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table); - #ifdef CONFIG_OF static const struct of_device_id alc5632_of_match[] = { { .compatible = "realtek,alc5632", }, @@ -1181,7 +1183,7 @@ static struct i2c_driver alc5632_i2c_driver = { .name = "alc5632", .of_match_table = of_match_ptr(alc5632_of_match), }, - .probe = alc5632_i2c_probe, + .probe_new = alc5632_i2c_probe, .id_table = alc5632_i2c_table, }; -- 2.27.0