]> Pileus Git - ~andy/linux/commitdiff
ASoC: fsl: check property 'compatible' for the machine name
authorShawn Guo <shawn.guo@linaro.org>
Thu, 8 Mar 2012 16:59:46 +0000 (00:59 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 9 Mar 2012 11:38:12 +0000 (11:38 +0000)
Check /compatible rather than /model to determine the machine name.
The p1022ds older device trees get a different /model from the new
ones, while /compatible is consistent there, so checking /compatible
will save the bother of detecting older p1022ds device trees.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/fsl/fsl_ssi.c
sound/soc/fsl/mpc8610_hpcd.c
sound/soc/fsl/p1022_ds.c

index 3e066966d8783f8c7e558c9c8677b64406c6b17b..2eb407fa3b4893e2a43c5adbf7ba7f3bcc1762a7 100644 (file)
@@ -716,12 +716,12 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
        }
 
        /* Trigger the machine driver's probe function.  The platform driver
-        * name of the machine driver is taken from the /model property of the
+        * name of the machine driver is taken from /compatible property of the
         * device tree.  We also pass the address of the CPU DAI driver
         * structure.
         */
-       sprop = of_get_property(of_find_node_by_path("/"), "model", NULL);
-       /* Sometimes the model name has a "fsl," prefix, so we strip that. */
+       sprop = of_get_property(of_find_node_by_path("/"), "compatible", NULL);
+       /* Sometimes the compatible name has a "fsl," prefix, so we strip it. */
        p = strrchr(sprop, ',');
        if (p)
                sprop = p + 1;
index fcf9302f59b4517b64fa8ef4a47f758bff81a85c..afbabf427f27dcb72b01e9be5a96dc0c8540176e 100644 (file)
@@ -546,7 +546,7 @@ static struct platform_driver mpc8610_hpcd_driver = {
        .probe = mpc8610_hpcd_probe,
        .remove = __devexit_p(mpc8610_hpcd_remove),
        .driver = {
-               /* The name must match the 'model' property in the device tree,
+               /* The name must match 'compatible' property in the device tree,
                 * in lowercase letters.
                 */
                .name = "snd-soc-mpc8610hpcd",
index d32ec4646d25d93817d9887139e47261fb50a80d..b8898708347507e5d9052025922f935c26ac7a37 100644 (file)
@@ -543,6 +543,11 @@ static struct platform_driver p1022_ds_driver = {
        .probe = p1022_ds_probe,
        .remove = __devexit_p(p1022_ds_remove),
        .driver = {
+               /*
+                * The name must match 'compatible' property in the device tree,
+                * in lowercase letters.
+                */
+               .name = "snd-soc-p1022ds",
                .owner = THIS_MODULE,
        },
 };
@@ -556,33 +561,6 @@ static int __init p1022_ds_init(void)
 {
        struct device_node *guts_np;
        struct resource res;
-       const char *sprop;
-
-       /*
-        * Check if we're actually running on a P1022DS.  Older device trees
-        * have a model of "fsl,P1022" and newer ones use "fsl,P1022DS", so we
-        * need to support both.  The SSI driver uses that property to link to
-        * the machine driver, so have to match it.
-        */
-       sprop = of_get_property(of_find_node_by_path("/"), "model", NULL);
-       if (!sprop) {
-               pr_err("snd-soc-p1022ds: missing /model node");
-               return -ENODEV;
-       }
-
-       pr_debug("snd-soc-p1022ds: board model name is %s\n", sprop);
-
-       /*
-        * The name of this board, taken from the device tree.  Normally, this is a*
-        * fixed string, but some P1022DS device trees have a /model property of
-        * "fsl,P1022", and others have "fsl,P1022DS".
-        */
-       if (strcasecmp(sprop, "fsl,p1022ds") == 0)
-               p1022_ds_driver.driver.name = "snd-soc-p1022ds";
-       else if (strcasecmp(sprop, "fsl,p1022") == 0)
-               p1022_ds_driver.driver.name = "snd-soc-p1022";
-       else
-               return -ENODEV;
 
        /* Get the physical address of the global utilities registers */
        guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts");