예제 #1
0
static struct hw *
split_fill_path (struct hw *current,
		 const char *device_specifier,
		 name_specifier *spec)
{
  /* break it up */
  if (!split_device_specifier (current, device_specifier, spec))
    hw_abort (current, "error parsing %s\n", device_specifier);

  /* fill our tree with its contents */
  current = split_find_device (current, spec);

  /* add any additional devices as needed */
  if (spec->name != NULL)
    {
      do
	{
	  if (current != NULL && !hw_finished_p (current))
	    hw_finish (current);
	  current = hw_create (NULL,
			       current,
			       spec->family,
			       spec->name,
			       spec->unit,
			       spec->args);
	}
      while (split_device_name (spec));
    }

  return current;
}
예제 #2
0
tree_find_string_property(device *root,
			  const char *path_to_property)
{
  name_specifier spec;
  if (!split_property_specifier(root, path_to_property, &spec))
    device_error(root, "Invalid property path %s", path_to_property);
  root = split_find_device(root, &spec);
  return device_find_string_property(root, spec.property);
}
예제 #3
0
const struct hw_property *
hw_tree_find_property (struct hw *root,
		       const char *path_to_property)
{
  name_specifier spec;
  if (!split_property_specifier (root, path_to_property, &spec))
    hw_abort (root, "Invalid property path %s", path_to_property);
  root = split_find_device (root, &spec);
  if (spec.name != NULL)
    return NULL; /* not a leaf */
  return hw_find_property (root, spec.property);
}
예제 #4
0
const char *
hw_tree_find_string_property (struct hw *root,
			      const char *path_to_property)
{
  name_specifier spec;
  if (!split_property_specifier (root, path_to_property, &spec))
    hw_abort (root, "Invalid property path %s", path_to_property);
  root = split_find_device (root, &spec);
  if (spec.name != NULL)
    hw_abort (root, "device \"%s\" not found (property \"%s\")",
	      spec.name, path_to_property);
  return hw_find_string_property (root, spec.property);
}
예제 #5
0
tree_instance(device *root,
	      const char *device_specifier)
{
  /* find the device node */
  device *me;
  name_specifier spec;
  if (!split_device_specifier(root, device_specifier, &spec))
    return NULL;
  me = split_find_device(root, &spec);
  if (spec.name != NULL)
    return NULL;
  /* create the instance */
  return device_create_instance(me, device_specifier, spec.last_args);
}
예제 #6
0
tree_find_device(device *root,
		 const char *path_to_device)
{
  device *node;
  name_specifier spec;

  /* parse the path */
  split_device_specifier(root, path_to_device, &spec);
  if (spec.value != NULL)
    return NULL; /* something wierd */

  /* now find it */
  node = split_find_device(root, &spec);
  if (spec.name != NULL)
    return NULL; /* not a leaf */

  return node;
}
예제 #7
0
split_fill_path(device *current,
		const char *device_specifier,
		name_specifier *spec)
{
  /* break it up */
  if (!split_device_specifier(current, device_specifier, spec))
    device_error(current, "error parsing %s\n", device_specifier);

  /* fill our tree with its contents */
  current = split_find_device(current, spec);

  /* add any additional devices as needed */
  if (spec->name != NULL) {
    do {
      current = device_create(current, spec->base, spec->name,
			      spec->unit, spec->args);
    } while (split_device_name(spec));
  }

  return current;
}