can_spin_lock(&outends->ends_lock);
if(atomic_dec_and_test(&edge->edge_used)) {
dead_fl=canque_fifo_test_and_set_fl(&edge->fifo,DEAD);
- /*This should not be there, but it cannot be outside of the lock :-(*/
- canque_notify_bothends(edge,CANQUEUE_NOTIFY_NOUSR);
+ /* Because of former evolution of edge references
+ management notify of CANQUEUE_NOTIFY_NOUSR could
+ be moved to canque_edge_do_dead :-) */
can_spin_unlock(&outends->ends_lock);
can_spin_unlock_irqrestore(&inends->ends_lock, flags);
canque_edge_do_dead(edge, dead_fl);
extern atomic_t edge_num_cnt;
#ifdef CAN_DEBUG
- #define DEBUGQUE(fmt,args...) can_printk(KERN_ERR "can_queue (debug): " fmt,\
+ #define DEBUGQUE(fmt,args...) can_printk(KERN_ERR "can_quekern (debug): " fmt,\
##args)
#else
#define DEBUGQUE(fmt,args...)
#endif
-#define ERRMSGQUE(fmt,args...) can_printk(KERN_ERR "can_queue: " fmt,\
+#define ERRMSGQUE(fmt,args...) can_printk(KERN_ERR "can_quekern: " fmt,\
##args)
if(dead_fl) return;
+ canque_notify_bothends(edge,CANQUEUE_NOTIFY_NOUSR);
+ #ifdef CAN_WITH_RTL
+ /* The problem of the above call is, that in RT-Linux to Linux notify
+ case is edge scheduled for delayed notify delivery, this needs
+ to be reflected there */
+ if(atomic_read(&edge->edge_used)>0){
+ can_spin_lock_irqsave(&edge->inends->ends_lock, flags);
+ can_spin_lock(&edge->outends->ends_lock);
+ if(atomic_read(&edge->edge_used)>0){
+ /* left edge to live for a while, banshee comes again in a while */
+ canque_fifo_clear_fl(&edge->fifo,DEAD);
+ can_spin_unlock(&edge->outends->ends_lock);
+ can_spin_unlock_irqrestore(&edge->inends->ends_lock, flags);
+ can_printk(KERN_ERR "can_quertl (debug): canque_edge_do_dead postponed\n");
+ return;
+ }
+ can_spin_unlock(&edge->outends->ends_lock);
+ can_spin_unlock_irqrestore(&edge->inends->ends_lock, flags);
+ }
+ #endif /*CAN_WITH_RTL*/
+
if(canqueue_disconnect_edge(edge)<0){
ERRMSGQUE("canque_edge_do_dead: canqueue_disconnect_edge failed !!!\n");
return;
qends = (struct canque_ends_t *)rt_malloc(sizeof(struct canque_ends_t));
if(qends == NULL) goto no_qends;
canqueue_ends_init_rtl(qends);
+ /* mark memory as allocated from RTL memory pool */
+ qends->ends_flags|=CAN_ENDSF_MEM_RTL;
canuser->qends = qends;
can_spin_lock_irqsave(&canuser_manipulation_lock, iflags);