All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Cezary Rojewski <cezary.rojewski@intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
	Mark Brown <broonie@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Oder Chiou <oder_chiou@realtek.com>,
	alsa-devel@alsa-project.org
Subject: [PATCH 3/7] ASoC: rt5645: Refactor rt5645_parse_dt()
Date: Sun, 26 Nov 2023 22:40:20 +0100	[thread overview]
Message-ID: <20231126214024.300505-4-hdegoede@redhat.com> (raw)
In-Reply-To: <20231126214024.300505-1-hdegoede@redhat.com>

Refactor rt5645_parse_dt(), make it take a pointer to
struct rt5645_platform_data as argument instead of passing in
the complete rt5645_priv struct.

While at it also make it void since it always succeeds.

This is a preparation patch for factoring the code to get
the platform-data out into a separate helper function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/codecs/rt5645.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 20bbdf76ffd7..7d0ad5650b44 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3869,18 +3869,12 @@ static bool rt5645_check_dp(struct device *dev)
 	return false;
 }
 
-static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev)
+static void rt5645_parse_dt(struct device *dev, struct rt5645_platform_data *pdata)
 {
-	rt5645->pdata.in2_diff = device_property_read_bool(dev,
-		"realtek,in2-differential");
-	device_property_read_u32(dev,
-		"realtek,dmic1-data-pin", &rt5645->pdata.dmic1_data_pin);
-	device_property_read_u32(dev,
-		"realtek,dmic2-data-pin", &rt5645->pdata.dmic2_data_pin);
-	device_property_read_u32(dev,
-		"realtek,jd-mode", &rt5645->pdata.jd_mode);
-
-	return 0;
+	pdata->in2_diff = device_property_read_bool(dev, "realtek,in2-differential");
+	device_property_read_u32(dev, "realtek,dmic1-data-pin", &pdata->dmic1_data_pin);
+	device_property_read_u32(dev, "realtek,dmic2-data-pin", &pdata->dmic2_data_pin);
+	device_property_read_u32(dev, "realtek,jd-mode", &pdata->jd_mode);
 }
 
 static int rt5645_i2c_probe(struct i2c_client *i2c)
@@ -3909,7 +3903,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c)
 	if (pdata)
 		rt5645->pdata = *pdata;
 	else if (rt5645_check_dp(&i2c->dev))
-		rt5645_parse_dt(rt5645, &i2c->dev);
+		rt5645_parse_dt(&i2c->dev, &rt5645->pdata);
 	else
 		rt5645->pdata = jd_mode3_platform_data;
 
-- 
2.41.0


  parent reply	other threads:[~2023-11-26 21:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-26 21:40 [PATCH 0/7] ASoC: rt5645: Add Acer Switch V 10 quirk + report quirks in components string Hans de Goede
2023-11-26 21:40 ` [PATCH 1/7] ASoC: rt5645: Drop double EF20 entry from dmi_platform_data[] Hans de Goede
2023-11-26 21:40 ` [PATCH 2/7] ASoC: rt5645: Add platform-data for Acer Switch V 10 Hans de Goede
2023-11-26 21:40 ` Hans de Goede [this message]
2023-11-26 21:40 ` [PATCH 4/7] ASoC: rt5645: Add rt5645_get_pdata() helper Hans de Goede
2023-11-26 21:40 ` [PATCH 5/7] ASoC: rt5645: Add a rt5645_components() helper Hans de Goede
2023-11-26 21:40 ` [PATCH 6/7] ASoC: rt5645: Add mono speaker information to the components string Hans de Goede
2023-11-26 21:40 ` [PATCH 7/7] ASoC: Intel: cht_bsw_rt5645: Set card.components string Hans de Goede
2023-12-22 13:29 ` [PATCH 0/7] ASoC: rt5645: Add Acer Switch V 10 quirk + report quirks in components string Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231126214024.300505-4-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=oder_chiou@realtek.com \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.