Changeset 13df13c8 in mainline for uspace/srv/audio/hound/hound.c
- Timestamp:
- 2012-07-13T19:48:19Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 43c40a3
- Parents:
- ab07cf0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/hound.c
rab07cf0 r13df13c8 75 75 FIND_BY_NAME(sink); 76 76 } 77 static int hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name); 77 78 78 79 int hound_init(hound_t *hound) … … 209 210 fibril_mutex_lock(&hound->list_guard); 210 211 if (!list_member(&source->link, &hound->sources)) { 211 fibril_mutex_unlock(&hound->list_guard); 212 return EBUSY; 212 assert(source->connected_sink); 213 hound_disconnect_internal(hound, source->name, 214 source->connected_sink->name); 213 215 } 214 216 list_remove(&source->link); … … 224 226 log_verbose("Removing sink '%s'.", sink->name); 225 227 fibril_mutex_lock(&hound->list_guard); 228 226 229 if (!list_empty(&sink->sources)) { 230 // TODO disconnect instead 227 231 fibril_mutex_unlock(&hound->list_guard); 228 232 return EBUSY; … … 259 263 { 260 264 assert(hound); 265 fibril_mutex_lock(&hound->list_guard); 266 const int ret = hound_disconnect_internal(hound, source_name, sink_name); 267 fibril_mutex_unlock(&hound->list_guard); 268 return ret; 269 } 270 271 static int hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name) 272 { 273 assert(hound); 274 assert(fibril_mutex_is_locked(&hound->list_guard)); 261 275 log_verbose("Disconnecting '%s' to '%s'.", source_name, sink_name); 262 fibril_mutex_lock(&hound->list_guard);263 276 audio_sink_t *sink = find_sink_by_name(&hound->sinks, sink_name); 264 277 audio_source_t *source = sink ? find_source_by_name(&sink->sources, source_name) : NULL; 265 278 if (!source || !sink) { 266 fibril_mutex_unlock(&hound->list_guard);267 279 log_debug("Source (%p), or sink (%p) not found", source, sink); 268 280 return ENOENT; … … 274 286 list_append(&source->link, &hound->sources); 275 287 } 276 fibril_mutex_unlock(&hound->list_guard); 277 return EOK; 278 return ENOTSUP; 288 return EOK; 279 289 } 280 290 /**
Note:
See TracChangeset
for help on using the changeset viewer.