[2/3] ASoC: ts3a227e: use device property api
diff mbox

Message ID 1432684686-14460-2-git-send-email-yang.a.fang@intel.com
State New
Headers show

Commit Message

yang.a.fang@intel.com May 26, 2015, 11:58 p.m. UTC
From: "Fang, Yang A" <yang.a.fang@intel.com>

replace of_property_read_u32 with device_property_read_u32

Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
---
 sound/soc/codecs/ts3a227e.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

Comments

Mark Brown May 28, 2015, 9:29 a.m. UTC | #1
On Tue, May 26, 2015 at 04:58:05PM -0700, yang.a.fang@intel.com wrote:

> -static int ts3a227e_parse_dt(struct ts3a227e *ts3a227e, struct device_node *np)
> +static int ts3a227e_parse_dt(struct ts3a227e *ts3a227e, struct device *dev)

You should rename the function - it's not just parsing DT, it's also
parsing ACPI (and any other firmware interface that comes along) now.

Patch
diff mbox

diff --git a/sound/soc/codecs/ts3a227e.c b/sound/soc/codecs/ts3a227e.c
index 9fd80ac..dfb49b3 100644
--- a/sound/soc/codecs/ts3a227e.c
+++ b/sound/soc/codecs/ts3a227e.c
@@ -254,12 +254,12 @@  static const struct regmap_config ts3a227e_regmap_config = {
 	.num_reg_defaults = ARRAY_SIZE(ts3a227e_reg_defaults),
 };
 
-static int ts3a227e_parse_dt(struct ts3a227e *ts3a227e, struct device_node *np)
+static int ts3a227e_parse_dt(struct ts3a227e *ts3a227e, struct device *dev)
 {
 	u32 micbias;
 	int err;
 
-	err = of_property_read_u32(np, "ti,micbias", &micbias);
+	err = device_property_read_u32(dev, "ti,micbias", &micbias);
 	if (!err) {
 		regmap_update_bits(ts3a227e->regmap, TS3A227E_REG_SETTING_3,
 			MICBIAS_SETTING_MASK,
@@ -287,12 +287,10 @@  static int ts3a227e_i2c_probe(struct i2c_client *i2c,
 	if (IS_ERR(ts3a227e->regmap))
 		return PTR_ERR(ts3a227e->regmap);
 
-	if (dev->of_node) {
-		ret = ts3a227e_parse_dt(ts3a227e, dev->of_node);
-		if (ret) {
-			dev_err(dev, "Failed to parse device tree: %d\n", ret);
-			return ret;
-		}
+	ret = ts3a227e_parse_dt(ts3a227e, dev);
+	if (ret) {
+		dev_err(dev, "Failed to parse device tree: %d\n", ret);
+		return ret;
 	}
 
 	ret = devm_request_threaded_irq(dev, i2c->irq, NULL, ts3a227e_interrupt,