Message ID | CABYxbz6xEEVxL1BBM+Mb7net27d3zTD-6+uoS63LXXvifn_TNw@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 02/13/2013 05:40 PM, Anil Kumar wrote: > It looks issue is different here. > I have done some testing here with patch[1]. In this patch i tried to > get same "of_device" node pointer > again and found refcount for this dt node is 1 [Result]. > > As of_parse_phandle() says it "returns the device_node pointer with > refcount incremented". > But why refcount value is 1 [Result] again ? Documentation/kref.txt > > -----------------------------8--------------------- > Patch[1]:- > diff --git a/sound/soc/omap/omap-twl4030.c b/sound/soc/omap/omap-twl4030.c > index fd98509..0828a5c 100644 > --- a/sound/soc/omap/omap-twl4030.c > +++ b/sound/soc/omap/omap-twl4030.c > @@ -297,6 +297,16 @@ static int omap_twl4030_probe(struct platform_device *pdev) > dev_err(&pdev->dev, "McBSP node is not provided\n"); > return -EINVAL; > } > + printk(KERN_ERR"refcount 0x%x", > atomic_read(&dai_node->kref.refcount)); > + > + dai_node = of_parse_phandle(node, "ti,mcbsp", 0); > + if (!dai_node) { > + dev_err(&pdev->dev, "McBSP node is not provided\n"); > + return -EINVAL; > + } > + printk(KERN_ERR"refcount 0x%x", > atomic_read(&dai_node->kref.refcount)); > + > + > omap_twl4030_dai_links[0].cpu_dai_name = NULL; > omap_twl4030_dai_links[0].cpu_of_node = dai_node; > > [Result]:- > root@DevKit8000:/# insmod snd-soc-omap-twl4030.ko > [ 95.718109] refcount 0x1 > [ 95.720611] refcount 0x1 [ 95.818054] omap-twl4030 sound.20: > twl4030-hifi <-> 49022000.mcbsp mapping ok > > > Thanks, > Anil > [...] >
diff --git a/sound/soc/omap/omap-twl4030.c b/sound/soc/omap/omap-twl4030.c index fd98509..0828a5c 100644 --- a/sound/soc/omap/omap-twl4030.c +++ b/sound/soc/omap/omap-twl4030.c @@ -297,6 +297,16 @@ static int omap_twl4030_probe(struct platform_device *pdev) dev_err(&pdev->dev, "McBSP node is not provided\n"); return -EINVAL; } + printk(KERN_ERR"refcount 0x%x", atomic_read(&dai_node->kref.refcount)); + + dai_node = of_parse_phandle(node, "ti,mcbsp", 0); + if (!dai_node) { + dev_err(&pdev->dev, "McBSP node is not provided\n"); + return -EINVAL; + } + printk(KERN_ERR"refcount 0x%x", atomic_read(&dai_node->kref.refcount)); + + omap_twl4030_dai_links[0].cpu_dai_name = NULL;