All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] of/device: Don't register disabled devices
@ 2011-01-03 23:01 ` Grant Likely
  0 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2011-01-03 23:01 UTC (permalink / raw)
  To: devicetree-discuss, linuxppc-dev, linux-kernel
  Cc: Scott Wood, Benjamin Herrenschmidt, David Gibson,
	Hollis Blanchard, Deepak Saxena

Device nodes with the property status="disabled" are not usable and so
don't register them when parsing the device tree for devices.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Hollis Blanchard <hollis_blanchard@mentor.com>
Cc: Deepak Saxena <deepak_saxena@mentor.com>
Cc: Scott Wood <scottwood@freescale.com>,
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 drivers/of/platform.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 5b4a07f..c01cd1a 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -633,6 +633,9 @@ EXPORT_SYMBOL(of_device_alloc);
  * @np: pointer to node to create device for
  * @bus_id: name to assign device
  * @parent: Linux device model parent device.
+ *
+ * Returns pointer to created platform device, or NULL if a device was not
+ * registered.  Unavailable devices will not get registered.
  */
 struct platform_device *of_platform_device_create(struct device_node *np,
 					    const char *bus_id,
@@ -640,6 +643,9 @@ struct platform_device *of_platform_device_create(struct device_node *np,
 {
 	struct platform_device *dev;
 
+	if (!of_device_is_available(np))
+		return NULL;
+
 	dev = of_device_alloc(np, bus_id, parent);
 	if (!dev)
 		return NULL;
@@ -683,8 +689,9 @@ static int of_platform_bus_create(const struct device_node *bus,
 		pr_debug("   create child: %s\n", child->full_name);
 		dev = of_platform_device_create(child, NULL, parent);
 		if (dev == NULL)
-			rc = -ENOMEM;
-		else if (!of_match_node(matches, child))
+			continue;
+
+		if (!of_match_node(matches, child))
 			continue;
 		if (rc == 0) {
 			pr_debug("   and sub busses\n");
@@ -733,10 +740,9 @@ int of_platform_bus_probe(struct device_node *root,
 	if (of_match_node(matches, root)) {
 		pr_debug(" root match, create all sub devices\n");
 		dev = of_platform_device_create(root, NULL, parent);
-		if (dev == NULL) {
-			rc = -ENOMEM;
+		if (dev == NULL)
 			goto bail;
-		}
+
 		pr_debug(" create all sub busses\n");
 		rc = of_platform_bus_create(root, matches, &dev->dev);
 		goto bail;
@@ -748,9 +754,9 @@ int of_platform_bus_probe(struct device_node *root,
 		pr_debug("  match: %s\n", child->full_name);
 		dev = of_platform_device_create(child, NULL, parent);
 		if (dev == NULL)
-			rc = -ENOMEM;
-		else
-			rc = of_platform_bus_create(child, matches, &dev->dev);
+			continue;
+
+		rc = of_platform_bus_create(child, matches, &dev->dev);
 		if (rc) {
 			of_node_put(child);
 			break;


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] of/device: Don't register disabled devices
@ 2011-01-03 23:01 ` Grant Likely
  0 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2011-01-03 23:01 UTC (permalink / raw)
  To: devicetree-discuss, linuxppc-dev, linux-kernel
  Cc: Scott Wood, Deepak Saxena, Hollis Blanchard, David Gibson

Device nodes with the property status="disabled" are not usable and so
don't register them when parsing the device tree for devices.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Hollis Blanchard <hollis_blanchard@mentor.com>
Cc: Deepak Saxena <deepak_saxena@mentor.com>
Cc: Scott Wood <scottwood@freescale.com>,
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 drivers/of/platform.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 5b4a07f..c01cd1a 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -633,6 +633,9 @@ EXPORT_SYMBOL(of_device_alloc);
  * @np: pointer to node to create device for
  * @bus_id: name to assign device
  * @parent: Linux device model parent device.
+ *
+ * Returns pointer to created platform device, or NULL if a device was not
+ * registered.  Unavailable devices will not get registered.
  */
 struct platform_device *of_platform_device_create(struct device_node *np,
 					    const char *bus_id,
@@ -640,6 +643,9 @@ struct platform_device *of_platform_device_create(struct device_node *np,
 {
 	struct platform_device *dev;
 
+	if (!of_device_is_available(np))
+		return NULL;
+
 	dev = of_device_alloc(np, bus_id, parent);
 	if (!dev)
 		return NULL;
@@ -683,8 +689,9 @@ static int of_platform_bus_create(const struct device_node *bus,
 		pr_debug("   create child: %s\n", child->full_name);
 		dev = of_platform_device_create(child, NULL, parent);
 		if (dev == NULL)
-			rc = -ENOMEM;
-		else if (!of_match_node(matches, child))
+			continue;
+
+		if (!of_match_node(matches, child))
 			continue;
 		if (rc == 0) {
 			pr_debug("   and sub busses\n");
@@ -733,10 +740,9 @@ int of_platform_bus_probe(struct device_node *root,
 	if (of_match_node(matches, root)) {
 		pr_debug(" root match, create all sub devices\n");
 		dev = of_platform_device_create(root, NULL, parent);
-		if (dev == NULL) {
-			rc = -ENOMEM;
+		if (dev == NULL)
 			goto bail;
-		}
+
 		pr_debug(" create all sub busses\n");
 		rc = of_platform_bus_create(root, matches, &dev->dev);
 		goto bail;
@@ -748,9 +754,9 @@ int of_platform_bus_probe(struct device_node *root,
 		pr_debug("  match: %s\n", child->full_name);
 		dev = of_platform_device_create(child, NULL, parent);
 		if (dev == NULL)
-			rc = -ENOMEM;
-		else
-			rc = of_platform_bus_create(child, matches, &dev->dev);
+			continue;
+
+		rc = of_platform_bus_create(child, matches, &dev->dev);
 		if (rc) {
 			of_node_put(child);
 			break;

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] of/device: Don't register disabled devices
  2011-01-03 23:01 ` Grant Likely
  (?)
@ 2011-01-05 22:53   ` Blanchard, Hollis
  -1 siblings, 0 replies; 10+ messages in thread
From: Blanchard, Hollis @ 2011-01-05 22:53 UTC (permalink / raw)
  To: Grant Likely
  Cc: devicetree-discuss, linuxppc-dev, linux-kernel, Scott Wood,
	Benjamin Herrenschmidt, David Gibson, Saxena, Deepak

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2981 bytes --]

On 01/03/2011 03:01 PM, Grant Likely wrote:
> Device nodes with the property status="disabled" are not usable and so
> don't register them when parsing the device tree for devices.
>
This is great and all, but a fair amount of driver code explicitly 
searches the tree, rather than registering a probe function. That's why 
our earlier patches in this area were more comprehensive.

What are your thoughts on handling those cases?

Hollis Blanchard
Mentor Graphics, Embedded Systems Division

> ---
>   drivers/of/platform.c |   22 ++++++++++++++--------
>   1 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 5b4a07f..c01cd1a 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -633,6 +633,9 @@ EXPORT_SYMBOL(of_device_alloc);
>    * @np: pointer to node to create device for
>    * @bus_id: name to assign device
>    * @parent: Linux device model parent device.
> + *
> + * Returns pointer to created platform device, or NULL if a device was not
> + * registered.  Unavailable devices will not get registered.
>    */
>   struct platform_device *of_platform_device_create(struct device_node *np,
>   					    const char *bus_id,
> @@ -640,6 +643,9 @@ struct platform_device *of_platform_device_create(struct device_node *np,
>   {
>   	struct platform_device *dev;
>
> +	if (!of_device_is_available(np))
> +		return NULL;
> +
>   	dev = of_device_alloc(np, bus_id, parent);
>   	if (!dev)
>   		return NULL;
> @@ -683,8 +689,9 @@ static int of_platform_bus_create(const struct device_node *bus,
>   		pr_debug("   create child: %s\n", child->full_name);
>   		dev = of_platform_device_create(child, NULL, parent);
>   		if (dev == NULL)
> -			rc = -ENOMEM;
> -		else if (!of_match_node(matches, child))
> +			continue;
> +
> +		if (!of_match_node(matches, child))
>   			continue;
>   		if (rc == 0) {
>   			pr_debug("   and sub busses\n");
> @@ -733,10 +740,9 @@ int of_platform_bus_probe(struct device_node *root,
>   	if (of_match_node(matches, root)) {
>   		pr_debug(" root match, create all sub devices\n");
>   		dev = of_platform_device_create(root, NULL, parent);
> -		if (dev == NULL) {
> -			rc = -ENOMEM;
> +		if (dev == NULL)
>   			goto bail;
> -		}
> +
>   		pr_debug(" create all sub busses\n");
>   		rc = of_platform_bus_create(root, matches,&dev->dev);
>   		goto bail;
> @@ -748,9 +754,9 @@ int of_platform_bus_probe(struct device_node *root,
>   		pr_debug("  match: %s\n", child->full_name);
>   		dev = of_platform_device_create(child, NULL, parent);
>   		if (dev == NULL)
> -			rc = -ENOMEM;
> -		else
> -			rc = of_platform_bus_create(child, matches,&dev->dev);
> +			continue;
> +
> +		rc = of_platform_bus_create(child, matches,&dev->dev);
>   		if (rc) {
>   			of_node_put(child);
>   			break;
>
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] of/device: Don't register disabled devices
@ 2011-01-05 22:53   ` Blanchard, Hollis
  0 siblings, 0 replies; 10+ messages in thread
From: Blanchard, Hollis @ 2011-01-05 22:53 UTC (permalink / raw)
  To: Grant Likely
  Cc: devicetree-discuss, linuxppc-dev, linux-kernel, Scott Wood,
	Benjamin Herrenschmidt, David Gibson, Saxena, Deepak

On 01/03/2011 03:01 PM, Grant Likely wrote:
> Device nodes with the property status="disabled" are not usable and so
> don't register them when parsing the device tree for devices.
>
This is great and all, but a fair amount of driver code explicitly 
searches the tree, rather than registering a probe function. That's why 
our earlier patches in this area were more comprehensive.

What are your thoughts on handling those cases?

Hollis Blanchard
Mentor Graphics, Embedded Systems Division

> ---
>   drivers/of/platform.c |   22 ++++++++++++++--------
>   1 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 5b4a07f..c01cd1a 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -633,6 +633,9 @@ EXPORT_SYMBOL(of_device_alloc);
>    * @np: pointer to node to create device for
>    * @bus_id: name to assign device
>    * @parent: Linux device model parent device.
> + *
> + * Returns pointer to created platform device, or NULL if a device was not
> + * registered.  Unavailable devices will not get registered.
>    */
>   struct platform_device *of_platform_device_create(struct device_node *np,
>   					    const char *bus_id,
> @@ -640,6 +643,9 @@ struct platform_device *of_platform_device_create(struct device_node *np,
>   {
>   	struct platform_device *dev;
>
> +	if (!of_device_is_available(np))
> +		return NULL;
> +
>   	dev = of_device_alloc(np, bus_id, parent);
>   	if (!dev)
>   		return NULL;
> @@ -683,8 +689,9 @@ static int of_platform_bus_create(const struct device_node *bus,
>   		pr_debug("   create child: %s\n", child->full_name);
>   		dev = of_platform_device_create(child, NULL, parent);
>   		if (dev == NULL)
> -			rc = -ENOMEM;
> -		else if (!of_match_node(matches, child))
> +			continue;
> +
> +		if (!of_match_node(matches, child))
>   			continue;
>   		if (rc == 0) {
>   			pr_debug("   and sub busses\n");
> @@ -733,10 +740,9 @@ int of_platform_bus_probe(struct device_node *root,
>   	if (of_match_node(matches, root)) {
>   		pr_debug(" root match, create all sub devices\n");
>   		dev = of_platform_device_create(root, NULL, parent);
> -		if (dev == NULL) {
> -			rc = -ENOMEM;
> +		if (dev == NULL)
>   			goto bail;
> -		}
> +
>   		pr_debug(" create all sub busses\n");
>   		rc = of_platform_bus_create(root, matches,&dev->dev);
>   		goto bail;
> @@ -748,9 +754,9 @@ int of_platform_bus_probe(struct device_node *root,
>   		pr_debug("  match: %s\n", child->full_name);
>   		dev = of_platform_device_create(child, NULL, parent);
>   		if (dev == NULL)
> -			rc = -ENOMEM;
> -		else
> -			rc = of_platform_bus_create(child, matches,&dev->dev);
> +			continue;
> +
> +		rc = of_platform_bus_create(child, matches,&dev->dev);
>   		if (rc) {
>   			of_node_put(child);
>   			break;
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] of/device: Don't register disabled devices
@ 2011-01-05 22:53   ` Blanchard, Hollis
  0 siblings, 0 replies; 10+ messages in thread
From: Blanchard, Hollis @ 2011-01-05 22:53 UTC (permalink / raw)
  To: Grant Likely
  Cc: devicetree-discuss, linux-kernel, Saxena, Deepak, Scott Wood,
	linuxppc-dev, David Gibson

T24gMDEvMDMvMjAxMSAwMzowMSBQTSwgR3JhbnQgTGlrZWx5IHdyb3RlOg0KPiBEZXZpY2Ugbm9k
ZXMgd2l0aCB0aGUgcHJvcGVydHkgc3RhdHVzPSJkaXNhYmxlZCIgYXJlIG5vdCB1c2FibGUgYW5k
IHNvDQo+IGRvbid0IHJlZ2lzdGVyIHRoZW0gd2hlbiBwYXJzaW5nIHRoZSBkZXZpY2UgdHJlZSBm
b3IgZGV2aWNlcy4NCj4NClRoaXMgaXMgZ3JlYXQgYW5kIGFsbCwgYnV0IGEgZmFpciBhbW91bnQg
b2YgZHJpdmVyIGNvZGUgZXhwbGljaXRseSANCnNlYXJjaGVzIHRoZSB0cmVlLCByYXRoZXIgdGhh
biByZWdpc3RlcmluZyBhIHByb2JlIGZ1bmN0aW9uLiBUaGF0J3Mgd2h5IA0Kb3VyIGVhcmxpZXIg
cGF0Y2hlcyBpbiB0aGlzIGFyZWEgd2VyZSBtb3JlIGNvbXByZWhlbnNpdmUuDQoNCldoYXQgYXJl
IHlvdXIgdGhvdWdodHMgb24gaGFuZGxpbmcgdGhvc2UgY2FzZXM/DQoNCkhvbGxpcyBCbGFuY2hh
cmQNCk1lbnRvciBHcmFwaGljcywgRW1iZWRkZWQgU3lzdGVtcyBEaXZpc2lvbg0KDQo+IC0tLQ0K
PiAgIGRyaXZlcnMvb2YvcGxhdGZvcm0uYyB8ICAgMjIgKysrKysrKysrKysrKystLS0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	[flat|nested] 10+ messages in thread

* Re: [PATCH] of/device: Don't register disabled devices
@ 2011-01-05 23:35     ` David Gibson
  0 siblings, 0 replies; 10+ messages in thread
From: David Gibson @ 2011-01-05 23:35 UTC (permalink / raw)
  To: Blanchard, Hollis
  Cc: Grant Likely, devicetree-discuss, linuxppc-dev, linux-kernel,
	Scott Wood, Benjamin Herrenschmidt, Saxena, Deepak

On Wed, Jan 05, 2011 at 02:53:27PM -0800, Blanchard, Hollis wrote:
> On 01/03/2011 03:01 PM, Grant Likely wrote:
> > Device nodes with the property status="disabled" are not usable and so
> > don't register them when parsing the device tree for devices.
> >
> This is great and all, but a fair amount of driver code explicitly 
> searches the tree, rather than registering a probe function. That's why 
> our earlier patches in this area were more comprehensive.
> 
> What are your thoughts on handling those cases?

One by one.  Trying to handle the explicit searches automagically is
just asking for trouble.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] of/device: Don't register disabled devices
@ 2011-01-05 23:35     ` David Gibson
  0 siblings, 0 replies; 10+ messages in thread
From: David Gibson @ 2011-01-05 23:35 UTC (permalink / raw)
  To: Blanchard, Hollis
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Scott Wood,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ

On Wed, Jan 05, 2011 at 02:53:27PM -0800, Blanchard, Hollis wrote:
> On 01/03/2011 03:01 PM, Grant Likely wrote:
> > Device nodes with the property status="disabled" are not usable and so
> > don't register them when parsing the device tree for devices.
> >
> This is great and all, but a fair amount of driver code explicitly 
> searches the tree, rather than registering a probe function. That's why 
> our earlier patches in this area were more comprehensive.
> 
> What are your thoughts on handling those cases?

One by one.  Trying to handle the explicit searches automagically is
just asking for trouble.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] of/device: Don't register disabled devices
@ 2011-01-05 23:35     ` David Gibson
  0 siblings, 0 replies; 10+ messages in thread
From: David Gibson @ 2011-01-05 23:35 UTC (permalink / raw)
  To: Blanchard, Hollis
  Cc: devicetree-discuss, linux-kernel, Saxena, Deepak, Scott Wood,
	linuxppc-dev

On Wed, Jan 05, 2011 at 02:53:27PM -0800, Blanchard, Hollis wrote:
> On 01/03/2011 03:01 PM, Grant Likely wrote:
> > Device nodes with the property status="disabled" are not usable and so
> > don't register them when parsing the device tree for devices.
> >
> This is great and all, but a fair amount of driver code explicitly 
> searches the tree, rather than registering a probe function. That's why 
> our earlier patches in this area were more comprehensive.
> 
> What are your thoughts on handling those cases?

One by one.  Trying to handle the explicit searches automagically is
just asking for trouble.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] of/device: Don't register disabled devices
  2011-01-05 23:35     ` David Gibson
@ 2011-01-07 17:23       ` Grant Likely
  -1 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2011-01-07 17:23 UTC (permalink / raw)
  To: David Gibson, Blanchard, Hollis, devicetree-discuss,
	linuxppc-dev, linux-kernel, Scott Wood, Benjamin Herrenschmidt,
	Saxena, Deepak

On Thu, Jan 06, 2011 at 10:35:35AM +1100, David Gibson wrote:
> On Wed, Jan 05, 2011 at 02:53:27PM -0800, Blanchard, Hollis wrote:
> > On 01/03/2011 03:01 PM, Grant Likely wrote:
> > > Device nodes with the property status="disabled" are not usable and so
> > > don't register them when parsing the device tree for devices.
> > >
> > This is great and all, but a fair amount of driver code explicitly 
> > searches the tree, rather than registering a probe function. That's why 
> > our earlier patches in this area were more comprehensive.

As your patch set shows, the total set isn't unmanageable, and the
preference for new code is to use the device model infrastructure if
at all possible.

> > 
> > What are your thoughts on handling those cases?
> 
> One by one.  Trying to handle the explicit searches automagically is
> just asking for trouble.

Just as David says, the special cases are... well... special.
Anything making decisions about registering devices needs to follow
the status!="okay" rules.

g.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] of/device: Don't register disabled devices
@ 2011-01-07 17:23       ` Grant Likely
  0 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2011-01-07 17:23 UTC (permalink / raw)
  To: David Gibson, Blanchard, Hollis, devicetree-discuss,
	linuxppc-dev, linux-kernel

On Thu, Jan 06, 2011 at 10:35:35AM +1100, David Gibson wrote:
> On Wed, Jan 05, 2011 at 02:53:27PM -0800, Blanchard, Hollis wrote:
> > On 01/03/2011 03:01 PM, Grant Likely wrote:
> > > Device nodes with the property status="disabled" are not usable and so
> > > don't register them when parsing the device tree for devices.
> > >
> > This is great and all, but a fair amount of driver code explicitly 
> > searches the tree, rather than registering a probe function. That's why 
> > our earlier patches in this area were more comprehensive.

As your patch set shows, the total set isn't unmanageable, and the
preference for new code is to use the device model infrastructure if
at all possible.

> > 
> > What are your thoughts on handling those cases?
> 
> One by one.  Trying to handle the explicit searches automagically is
> just asking for trouble.

Just as David says, the special cases are... well... special.
Anything making decisions about registering devices needs to follow
the status!="okay" rules.

g.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-01-07 17:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-03 23:01 [PATCH] of/device: Don't register disabled devices Grant Likely
2011-01-03 23:01 ` Grant Likely
2011-01-05 22:53 ` Blanchard, Hollis
2011-01-05 22:53   ` Blanchard, Hollis
2011-01-05 22:53   ` Blanchard, Hollis
2011-01-05 23:35   ` David Gibson
2011-01-05 23:35     ` David Gibson
2011-01-05 23:35     ` David Gibson
2011-01-07 17:23     ` Grant Likely
2011-01-07 17:23       ` Grant Likely

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.