/* Initialize v4l2 variables and register v4l2 devices */ int ivtv_streams_setup(struct ivtv *itv) { int type; /* Setup V4L2 Devices */ for (type = 0; type < IVTV_MAX_STREAMS; type++) { /* Register Device */ if (ivtv_reg_dev(itv, type)) break; if (itv->streams[type].v4l2dev == NULL) continue; /* Allocate Stream */ if (ivtv_stream_alloc(&itv->streams[type])) break; } if (type == IVTV_MAX_STREAMS) { return 0; } /* One or more streams could not be initialized. Clean 'em all up. */ ivtv_streams_cleanup(itv); return -ENOMEM; }
/* Register v4l2 devices */ int ivtv_streams_register(struct ivtv *itv) { int type; int err = 0; /* Register V4L2 devices */ for (type = 0; type < IVTV_MAX_STREAMS; type++) err |= ivtv_reg_dev(itv, type); if (err == 0) return 0; /* One or more streams could not be initialized. Clean 'em all up. */ ivtv_streams_cleanup(itv, 1); return -ENOMEM; }
int ivtv_streams_register(struct ivtv *itv) { int type; int err = 0; /* */ for (type = 0; type < IVTV_MAX_STREAMS; type++) err |= ivtv_reg_dev(itv, type); if (err == 0) return 0; /* */ ivtv_streams_cleanup(itv, 1); return -ENOMEM; }