Thread (1 message) 1 message, 1 author, 2011-09-02
DORMANTno replies

[RFC PATCH 1/3] OMAP: omap_device: Add omap_device_[alloc|delete] for DT integration

From: Kevin Hilman <hidden>
Date: 2011-09-02 16:20:05
Also in: linux-omap

"Cousson, Benoit" [off-list ref] writes:

[...]
quoted
quoted
@@ -471,72 +572,31 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
  		goto odbs_exit;
  	}

-	pr_debug("omap_device: %s: building with %d hwmods\n", pdev_name,
-		 oh_cnt);
+	/* Set the dev_name early to allow dev_xxx in omap_device_alloc */
+	if (pdev->id != -1)
+		dev_set_name(&pdev->dev, "%s.%d", pdev->name,  pdev->id);
+	else
+		dev_set_name(&pdev->dev, "%s", pdev->name);
Minor: I think setting dev->init_name is more appropriate here, and
should have the same effect.
The slight difference is that if I do that:
pdev->dev.init_name = kasprintf(GFP_KERNEL, "%s.%d", pdev->name, pdev->id);

I will have to free it myself, because device_add is doing only that:

        if (dev->init_name) {
                dev_set_name(dev, "%s", dev->init_name);
                dev->init_name = NULL;
        }

Whereas dev_set_name is doing it for me.

So it will add one more line later. Does it worth it?
OK, keeping dev_set_name() is fine with me then.

Kevin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help