Merge remote-tracking branches 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc...
[deliverable/linux.git] / sound / soc / codecs / cs42xx8.c
index e1d46862e81f15c34f284a19240e01ee1a841549..d562e1b9a5d163bb22e990280b8f2e396e584846 100644 (file)
@@ -425,7 +425,7 @@ const struct cs42xx8_driver_data cs42888_data = {
 };
 EXPORT_SYMBOL_GPL(cs42888_data);
 
-static const struct of_device_id cs42xx8_of_match[] = {
+const struct of_device_id cs42xx8_of_match[] = {
        { .compatible = "cirrus,cs42448", .data = &cs42448_data, },
        { .compatible = "cirrus,cs42888", .data = &cs42888_data, },
        { /* sentinel */ }
@@ -435,16 +435,24 @@ EXPORT_SYMBOL_GPL(cs42xx8_of_match);
 
 int cs42xx8_probe(struct device *dev, struct regmap *regmap)
 {
-       const struct of_device_id *of_id = of_match_device(cs42xx8_of_match, dev);
+       const struct of_device_id *of_id;
        struct cs42xx8_priv *cs42xx8;
        int ret, val, i;
 
+       if (IS_ERR(regmap)) {
+               ret = PTR_ERR(regmap);
+               dev_err(dev, "failed to allocate regmap: %d\n", ret);
+               return ret;
+       }
+
        cs42xx8 = devm_kzalloc(dev, sizeof(*cs42xx8), GFP_KERNEL);
        if (cs42xx8 == NULL)
                return -ENOMEM;
 
+       cs42xx8->regmap = regmap;
        dev_set_drvdata(dev, cs42xx8);
 
+       of_id = of_match_device(cs42xx8_of_match, dev);
        if (of_id)
                cs42xx8->drvdata = of_id->data;
 
@@ -482,13 +490,6 @@ int cs42xx8_probe(struct device *dev, struct regmap *regmap)
        /* Make sure hardware reset done */
        msleep(5);
 
-       cs42xx8->regmap = regmap;
-       if (IS_ERR(cs42xx8->regmap)) {
-               ret = PTR_ERR(cs42xx8->regmap);
-               dev_err(dev, "failed to allocate regmap: %d\n", ret);
-               goto err_enable;
-       }
-
        /*
         * We haven't marked the chip revision as volatile due to
         * sharing a register with the right input volume; explicitly
This page took 0.041403 seconds and 5 git commands to generate.