[PATCH 04/22] OF adapter probing

Greg KH greg at kroah.com
Sat Feb 18 12:54:13 EST 2006


On Fri, Feb 17, 2006 at 04:57:14PM -0800, Roland Dreier wrote:
> +int hipz_count_adapters(void)
> +{
> +	int num = 0;
> +	struct device_node *dn = NULL;
> +
> +	EDEB_EN(7, "");
> +
> +	while ((dn = of_find_node_by_name(dn, "lhca"))) {
> +		num++;
> +	}

The { } are not needed here.

> +
> +	of_node_put(dn);
> +
> +	if (num == 0) {
> +		EDEB_ERR(4, "No lhca node name was found in the"
> +			 " Open Firmware device tree.");
> +		return -ENODEV;
> +	}
> +
> +	EDEB(6, " ... found %x adapter(s)", num);
> +
> +	EDEB_EX(7, "num=%x", num);
> +
> +	return num;
> +}
> +
> +int hipz_probe_adapters(char **adapter_list)
> +{
> +	int ret = 0;
> +	int num = 0;
> +	struct device_node *dn = NULL;
> +	char *loc;
> +
> +	EDEB_EN(7, "adapter_list=%p", adapter_list);
> +
> +	while ((dn = of_find_node_by_name(dn, "lhca"))) {
> +		loc = get_property(dn, "ibm,loc-code", NULL);
> +		if (loc == NULL) {
> +			EDEB_ERR(4, "No ibm,loc-code property for"
> +				 " lhca Open Firmware device tree node.");
> +			ret = -ENODEV;
> +			goto probe_adapters0;
> +		}
> +
> +		adapter_list[num] = loc;
> +		EDEB(6, " ... found adapter[%x] with loc-code: %s", num, loc);
> +		num++;
> +	}
> +
> +      probe_adapters0:
> +	of_node_put(dn);

Please use tabs everywhere.

Hm, wait, that's a label.  Put it where it belongs, over on the left
please.

thanks,

greg k-h



More information about the Linuxppc64-dev mailing list