return; /* here to prevent compiler warning... */
}
-static int exec_callout(struct config_device *dev, char *value, int len)
+static int do_ignore(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device)
+{
+ struct config_device *dev;
+ struct list_head *tmp;
+
+ list_for_each(tmp, &config_device_list) {
+ dev = list_entry(tmp, struct config_device, node);
+ if (dev->type != IGNORE)
+ continue;
+
+ dbg("compare name '%s' with '%s'", dev->kernel_name, class_dev->name);
+ if (strcmp_pattern(dev->kernel_name, class_dev->name) != 0)
+ continue;
+
+ dbg("found name, '%s' will be ignored", dev->kernel_name);
+
+ return 0;
+ }
+ return -ENODEV;
+}
+
+static int exec_program(char *path, char *value, int len)
{
int retval;
int res;
char *args[CALLOUT_MAXARG];
int i;
- dbg("callout to '%s'", dev->exec_program);
+ dbg("callout to '%s'", path);
retval = pipe(fds);
if (retval != 0) {
dbg("pipe failed");
/* child */
close(STDOUT_FILENO);
dup(fds[1]); /* dup write side of pipe to STDOUT */
- if (strchr(dev->exec_program, ' ')) {
+ if (strchr(path, ' ')) {
/* callout with arguments */
- pos = dev->exec_program;
+ pos = path;
for (i=0; i < CALLOUT_MAXARG-1; i++) {
args[i] = strsep(&pos, " ");
if (args[i] == NULL)
}
retval = execve(args[0], args, main_envp);
} else {
- retval = execve(dev->exec_program, main_argv, main_envp);
+ retval = execve(path, main_argv, main_envp);
}
if (retval != 0) {
dbg("child execve failed");
retval = -1;
}
-#ifndef __KLIBC__
if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) {
dbg("callout program status 0x%x", status);
retval = -1;
}
-#endif
}
return retval;
}
/* substitute anything that needs to be in the program name */
apply_format(udev, dev->exec_program);
- if (exec_callout(dev, udev->callout_value, NAME_SIZE))
+ if (exec_program(dev->exec_program, udev->callout_value, NAME_SIZE))
continue;
if (strcmp_pattern(dev->id, udev->callout_value) != 0)
continue;
dbg("kernel_number='%s'", udev->kernel_number);
/* rules are looked at in priority order */
+ retval = do_ignore(class_dev, udev, sysfs_device);
+ if (retval == 0) {
+ dbg("name, '%s' is being ignored", class_dev->name);
+ return 1;
+ }
+
retval = do_callout(class_dev, udev, sysfs_device);
if (retval == 0)
goto found;