Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp482267rdb; Thu, 31 Aug 2023 15:38:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEPPOTq0y1KUlTSDYvEe5V0CHU+ArjHwd6dGOZ/lJXhvtv/lj0c+Yk/bdlxIAx/zYUCkbZk X-Received: by 2002:ac2:5e2f:0:b0:500:7696:200 with SMTP id o15-20020ac25e2f000000b0050076960200mr324554lfg.59.1693521533966; Thu, 31 Aug 2023 15:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693521533; cv=none; d=google.com; s=arc-20160816; b=RKqhDm2S6TuzMZm6EGg+46AArdZp9KB4qyijdKDVh71wiBHElRs+MuLW5LWzZ4bIaA WstBlvtnXer+mwsUQ6pcVrzDz/fzJOPvcLKMuIGUPeQBUwNKNVnTkIdy3GT56IKNsiXj qO5vT46PaSu6KaCDhqsZ6MHxFsHAEEg3xXnnGwXIxAMKWnzdydAT/kF+2x3lLdIYuk/T HuQKwUIqHg6qXkgaBUn3iaQOTV0S+f+cQORrdjF4DAzFibXsMokuOwJ6Fmm2Ho7KlYLC m3nbTzytt7YWK/zeSd3r0q/Gq9G5gPHzN0PE7ngmd8pbUkRZtlQhJ6js+aTVwMUf3QTu dHig== 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=CUrSQqSMwAdmMO9j7oHCx504HDiiMTi5W3Cv61AqwIg=; fh=isro4ohP5UEoi6J58tTnBJC846N0ifuc0XKNYyi01B4=; b=PrelKXKRHjzvHfpjlhoHvd87QGRlcVZ6yPnRvUqym810saWz7RDlmyxff47gMIvDQd YTpxkGzzjnpEfNi83boJiw4/IcuJpUqVw2WAJF6mQ9/Cod5Mr48TWXtIY7mtHCORCyBD LaJMPuhlTqHlxPd5BmmPiI6dkn2jm8NpIcYY78WTUKEuYxs7Gb/yJnkjgY6HQuo0Nu4W y7Cq69dSeTh70AkBwoAdz2BREnTHMG1kxrSNNLCe4ugcrmQAit0KjZiFDwSgtuZTf47m GV879OFlkYWrsKI9yM4MeU5h53t/l2lLbb4Sz2HAmKIMViL6X6MD6hW0D8BD/gHJPuqE i+3w== 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 r9-20020aa7da09000000b0052c0eaa233asi1776388eds.597.2023.08.31.15.38.03; Thu, 31 Aug 2023 15:38:53 -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 S1347234AbjHaTqg (ORCPT + 99 others); Thu, 31 Aug 2023 15:46:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235244AbjHaTqg (ORCPT ); Thu, 31 Aug 2023 15:46:36 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CCF6CE67 for ; Thu, 31 Aug 2023 12:46:32 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,217,1688396400"; d="scan'208";a="174632394" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 01 Sep 2023 04:46:32 +0900 Received: from localhost.localdomain (unknown [10.226.92.179]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id B800A40062C9; Fri, 1 Sep 2023 04:46:28 +0900 (JST) From: Biju Das To: Shenghao Ding , Kevin Lu , Baojun Xu , Jaroslav Kysela , Takashi Iwai Cc: Biju Das , Liam Girdwood , Mark Brown , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v3 1/3] ASoC: codec: tlv320aic32x4: Add enum aic32x4_type to aic32x4_probe() Date: Thu, 31 Aug 2023 20:46:20 +0100 Message-Id: <20230831194622.87653-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230831194622.87653-1-biju.das.jz@bp.renesas.com> References: <20230831194622.87653-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 Add enum aic32x4_type to aic32x4_probe() and drop using dev_set_drvdata() from tlv320aic32x4_{i2c,spi} drivers. Suggested-by: Andy Shevchenko Signed-off-by: Biju Das Reviewed-by: Andy Shevchenko --- v2->v3: * Added Rb tag from Andy. v2: * New patch. --- sound/soc/codecs/tlv320aic32x4-i2c.c | 7 ++++--- sound/soc/codecs/tlv320aic32x4-spi.c | 7 ++++--- sound/soc/codecs/tlv320aic32x4.c | 5 +++-- sound/soc/codecs/tlv320aic32x4.h | 3 ++- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/tlv320aic32x4-i2c.c b/sound/soc/codecs/tlv320aic32x4-i2c.c index 49b33a256cd7..713f3f63b5e3 100644 --- a/sound/soc/codecs/tlv320aic32x4-i2c.c +++ b/sound/soc/codecs/tlv320aic32x4-i2c.c @@ -23,6 +23,7 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c) { struct regmap *regmap; struct regmap_config config; + enum aic32x4_type type; config = aic32x4_regmap_config; config.reg_bits = 8; @@ -34,15 +35,15 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c) const struct of_device_id *oid; oid = of_match_node(aic32x4_of_id, i2c->dev.of_node); - dev_set_drvdata(&i2c->dev, (void *)oid->data); + type = (uintptr_t)oid->data; } else { const struct i2c_device_id *id; id = i2c_match_id(aic32x4_i2c_id, i2c); - dev_set_drvdata(&i2c->dev, (void *)id->driver_data); + type = id->driver_data; } - return aic32x4_probe(&i2c->dev, regmap); + return aic32x4_probe(&i2c->dev, regmap, type); } static void aic32x4_i2c_remove(struct i2c_client *i2c) diff --git a/sound/soc/codecs/tlv320aic32x4-spi.c b/sound/soc/codecs/tlv320aic32x4-spi.c index 03cce8d6404f..81c05030dd3b 100644 --- a/sound/soc/codecs/tlv320aic32x4-spi.c +++ b/sound/soc/codecs/tlv320aic32x4-spi.c @@ -22,6 +22,7 @@ static int aic32x4_spi_probe(struct spi_device *spi) { struct regmap *regmap; struct regmap_config config; + enum aic32x4_type type; config = aic32x4_regmap_config; config.reg_bits = 7; @@ -35,15 +36,15 @@ static int aic32x4_spi_probe(struct spi_device *spi) const struct of_device_id *oid; oid = of_match_node(aic32x4_of_id, spi->dev.of_node); - dev_set_drvdata(&spi->dev, (void *)oid->data); + type = (uintptr_t)oid->data; } else { const struct spi_device_id *id_entry; id_entry = spi_get_device_id(spi); - dev_set_drvdata(&spi->dev, (void *)id_entry->driver_data); + type = id_entry->driver_data; } - return aic32x4_probe(&spi->dev, regmap); + return aic32x4_probe(&spi->dev, regmap, type); } static void aic32x4_spi_remove(struct spi_device *spi) diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index 6829834a412f..5c0c81da06db 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c @@ -1333,7 +1333,8 @@ static int aic32x4_setup_regulators(struct device *dev, return ret; } -int aic32x4_probe(struct device *dev, struct regmap *regmap) +int aic32x4_probe(struct device *dev, struct regmap *regmap, + enum aic32x4_type type) { struct aic32x4_priv *aic32x4; struct aic32x4_pdata *pdata = dev->platform_data; @@ -1349,7 +1350,7 @@ int aic32x4_probe(struct device *dev, struct regmap *regmap) return -ENOMEM; aic32x4->dev = dev; - aic32x4->type = (uintptr_t)dev_get_drvdata(dev); + aic32x4->type = type; dev_set_drvdata(dev, aic32x4); diff --git a/sound/soc/codecs/tlv320aic32x4.h b/sound/soc/codecs/tlv320aic32x4.h index d6101ce73f80..f68a846ef61d 100644 --- a/sound/soc/codecs/tlv320aic32x4.h +++ b/sound/soc/codecs/tlv320aic32x4.h @@ -17,7 +17,8 @@ enum aic32x4_type { }; extern const struct regmap_config aic32x4_regmap_config; -int aic32x4_probe(struct device *dev, struct regmap *regmap); +int aic32x4_probe(struct device *dev, struct regmap *regmap, + enum aic32x4_type type); void aic32x4_remove(struct device *dev); int aic32x4_register_clocks(struct device *dev, const char *mclk_name); -- 2.25.1