All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Fontenot <nfont@austin.ibm.com>
To: devicetree-discuss@lists.ozlabs.org, linuxppc-dev@ozlabs.org,
	microblaze-uclinux@itee.uq.edu.au
Subject: [RFC PATCH 5/5] powerpc/iseries updates for new OF dynamic code
Date: Wed, 04 Nov 2009 16:20:45 -0600	[thread overview]
Message-ID: <4AF1FE3D.3080601@austin.ibm.com> (raw)
In-Reply-To: <4AF1FB29.50905@austin.ibm.com>

Update the powerpc/iseries vio code to use the new generic OF dynamic code.

NOTE: I have no means of testing iseries kernels, this does at least pass the
compile test for me.

Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---

Index: linux-next/arch/powerpc/platforms/iseries/vio.c
===================================================================
--- linux-next.orig/arch/powerpc/platforms/iseries/vio.c	2009-11-02 13:39:40.000000000 -0600
+++ linux-next/arch/powerpc/platforms/iseries/vio.c	2009-11-03 12:34:19.000000000 -0600
@@ -80,8 +80,7 @@
 	kfree(np);
 }
 
-static struct device_node *new_node(const char *path,
-		struct device_node *parent)
+static struct device_node *new_node(const char *path)
 {
 	struct device_node *np = kzalloc(sizeof(*np), GFP_KERNEL);
 
@@ -93,9 +92,6 @@
 		return NULL;
 	}
 	strcpy(np->full_name, path);
-	of_node_set_flag(np, OF_DYNAMIC);
-	kref_init(&np->kref);
-	np->parent = of_node_get(parent);
 	return np;
 }
 
@@ -122,7 +118,7 @@
 
 	if (!nprop)
 		return 0;
-	prom_add_property(np, nprop);
+	of_property_attach(np, nprop);
 	return 1;
 }
 
@@ -133,19 +129,19 @@
 
 	if (!nprop)
 		return 0;
-	prom_add_property(np, nprop);
+	of_property_attach(np, nprop);
 	return 1;
 }
 
-static struct device_node *do_device_node(struct device_node *parent,
-		const char *name, u32 reg, u32 unit, const char *type,
-		const char *compat, struct vio_resource *res)
+static struct device_node *do_device_node(const char *name, u32 reg,
+		u32 unit, const char *type, const char *compat,
+		struct vio_resource *res)
 {
 	struct device_node *np;
 	char path[32];
 
 	snprintf(path, sizeof(path), "/vdevice/%s@%08x", name, reg);
-	np = new_node(path, parent);
+	np = new_node(path);
 	if (!np)
 		return NULL;
 	if (!add_string_property(np, "name", name) ||
@@ -168,15 +164,6 @@
 	np->name = of_get_property(np, "name", NULL);
 	np->type = of_get_property(np, "device_type", NULL);
 	of_attach_node(np);
-#ifdef CONFIG_PROC_DEVICETREE
-	if (parent->pde) {
-		struct proc_dir_entry *ent;
-
-		ent = proc_mkdir(strrchr(np->full_name, '/') + 1, parent->pde);
-		if (ent)
-			proc_device_tree_add_node(np, ent);
-	}
-#endif
 	return np;
 
  node_free:
@@ -190,16 +177,11 @@
  */
 struct vio_dev *vio_create_viodasd(u32 unit)
 {
-	struct device_node *vio_root;
 	struct device_node *np;
 	struct vio_dev *vdev = NULL;
 
-	vio_root = of_find_node_by_path("/vdevice");
-	if (!vio_root)
-		return NULL;
-	np = do_device_node(vio_root, "viodasd", FIRST_VIODASD + unit, unit,
+	np = do_device_node("viodasd", FIRST_VIODASD + unit, unit,
 			"block", "IBM,iSeries-viodasd", NULL);
-	of_node_put(vio_root);
 	if (np) {
 		vdev = vio_register_device_node(np);
 		if (!vdev)
@@ -254,7 +236,7 @@
 	}
 }
 
-static void __init probe_disk(struct device_node *vio_root, u32 unit)
+static void __init probe_disk(u32 unit)
 {
 	HvLpEvent_Rc hvrc;
 	struct vio_waitevent we;
@@ -305,11 +287,11 @@
 		return;
 	}
 
-	do_device_node(vio_root, "viodasd", FIRST_VIODASD + unit, unit,
+	do_device_node("viodasd", FIRST_VIODASD + unit, unit,
 			"block", "IBM,iSeries-viodasd", NULL);
 }
 
-static void __init get_viodasd_info(struct device_node *vio_root)
+static void __init get_viodasd_info(void)
 {
 	int rc;
 	u32 unit;
@@ -326,7 +308,7 @@
 	vio_setHandler(viomajorsubtype_blockio, handle_block_event);
 
 	for (unit = 0; unit < HVMAXARCHITECTEDVIRTUALDISKS; unit++)
-		probe_disk(vio_root, unit);
+		probe_disk(unit);
 
 	vio_clearHandler(viomajorsubtype_blockio);
 	viopath_close(viopath_hostLp, viomajorsubtype_blockio, 2);
@@ -372,7 +354,7 @@
 	}
 }
 
-static void __init get_viocd_info(struct device_node *vio_root)
+static void __init get_viocd_info(void)
 {
 	HvLpEvent_Rc hvrc;
 	u32 unit;
@@ -430,7 +412,7 @@
 
 	for (unit = 0; (unit < HVMAXARCHITECTEDVIRTUALCDROMS) &&
 			unitinfo[unit].rsrcname[0]; unit++) {
-		if (!do_device_node(vio_root, "viocd", FIRST_VIOCD + unit, unit,
+		if (!do_device_node("viocd", FIRST_VIOCD + unit, unit,
 				"block", "IBM,iSeries-viocd", &unitinfo[unit]))
 			break;
 	}
@@ -464,7 +446,7 @@
 	}
 }
 
-static void __init get_viotape_info(struct device_node *vio_root)
+static void __init get_viotape_info(void)
 {
 	HvLpEvent_Rc hvrc;
 	u32 unit;
@@ -507,7 +489,7 @@
 
 	for (unit = 0; (unit < HVMAXARCHITECTEDVIRTUALTAPES) &&
 			unitinfo[unit].rsrcname[0]; unit++) {
-		if (!do_device_node(vio_root, "viotape", FIRST_VIOTAPE + unit,
+		if (!do_device_node("viotape", FIRST_VIOTAPE + unit,
 				unit, "byte", "IBM,iSeries-viotape",
 				&unitinfo[unit]))
 			break;
@@ -522,7 +504,6 @@
 
 static int __init iseries_vio_init(void)
 {
-	struct device_node *vio_root;
 	int ret = -ENODEV;
 
 	if (!firmware_has_feature(FW_FEATURE_ISERIES))
@@ -530,25 +511,19 @@
 
 	iommu_vio_init();
 
-	vio_root = of_find_node_by_path("/vdevice");
-	if (!vio_root)
-		goto out;
-
 	if (viopath_hostLp == HvLpIndexInvalid) {
 		vio_set_hostlp();
 		/* If we don't have a host, bail out */
 		if (viopath_hostLp == HvLpIndexInvalid)
-			goto put_node;
+			goto out;
 	}
 
-	get_viodasd_info(vio_root);
-	get_viocd_info(vio_root);
-	get_viotape_info(vio_root);
+	get_viodasd_info();
+	get_viocd_info();
+	get_viotape_info();
 
 	ret = 0;
 
- put_node:
-	of_node_put(vio_root);
  out:
 	return ret;
 }

      parent reply	other threads:[~2009-11-04 22:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-04 22:07 [RFC PATCH 0/5] Merge common dynamic OF device tree code Nathan Fontenot
2009-11-04 22:14 ` [RFC PATCH 1/5] Move devtree_lock and allnodes declaration to of.h Nathan Fontenot
2009-11-04 22:14   ` Nathan Fontenot
2009-11-04 22:16 ` [RFC PATCH 2/5] Merge dynamic OF code to of_dynamic.c Nathan Fontenot
2009-11-05  7:55   ` Grant Likely
2009-11-05  7:55     ` Grant Likely
2009-11-05 16:59     ` Nathan Fontenot
2009-11-04 22:18 ` [RFC PATCH 3/5] powerpc and pseries updates for new OF dynamic code Nathan Fontenot
2009-11-04 22:19 ` [RFC PATCH 4/5] Microblaze updates for " Nathan Fontenot
2009-11-04 22:19   ` Nathan Fontenot
2009-11-04 22:20 ` Nathan Fontenot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AF1FE3D.3080601@austin.ibm.com \
    --to=nfont@austin.ibm.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=microblaze-uclinux@itee.uq.edu.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.