Subversion Repositories HelenOS

Rev

Rev 4254 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4254 Rev 4274
Line 133... Line 133...
133
 * @param devno     Device number.
133
 * @param devno  Device number.
134
 * @param method    Method to be associated with the notification.
134
 * @param method Method to be associated with the notification.
135
 * @param ucode     Uspace pointer to top-half pseudocode.
135
 * @param ucode  Uspace pointer to top-half pseudocode.
136
 *
136
 *
137
 * @return      EBADMEM, ENOENT or EEXISTS on failure or 0 on success.
137
 * @return EBADMEM, ENOENT or EEXISTS on failure or 0 on success.
-
 
138
 *
138
 */
139
 */
139
int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno,
140
int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno,
140
    unative_t method, irq_code_t *ucode)
141
    unative_t method, irq_code_t *ucode)
141
{
142
{
142
    ipl_t ipl;
143
    ipl_t ipl;
Line 177... Line 178...
177
     */
178
     */
178
    ipl = interrupts_disable();
179
    ipl = interrupts_disable();
179
    spinlock_lock(&irq_uspace_hash_table_lock);
180
    spinlock_lock(&irq_uspace_hash_table_lock);
180
    hlp = hash_table_find(&irq_uspace_hash_table, key);
181
    hlp = hash_table_find(&irq_uspace_hash_table, key);
181
    if (hlp) {
182
    if (hlp) {
-
 
183
        irq_t *hirq __attribute__((unused))
182
        irq_t *hirq = hash_table_get_instance(hlp, irq_t, link);
184
            = hash_table_get_instance(hlp, irq_t, link);
-
 
185
       
183
        /* hirq is locked */
186
        /* hirq is locked */
184
        spinlock_unlock(&hirq->lock);
187
        spinlock_unlock(&hirq->lock);
185
        code_free(code);
188
        code_free(code);
186
        spinlock_unlock(&irq_uspace_hash_table_lock);
189
        spinlock_unlock(&irq_uspace_hash_table_lock);
187
        free(irq);
190
        free(irq);
188
        interrupts_restore(ipl);
191
        interrupts_restore(ipl);
189
        return EEXISTS;
192
        return EEXISTS;
190
    }
193
    }
-
 
194
   
191
    spinlock_lock(&irq->lock);  /* not really necessary, but paranoid */
195
    spinlock_lock(&irq->lock);  /* Not really necessary, but paranoid */
192
    spinlock_lock(&box->irq_lock);
196
    spinlock_lock(&box->irq_lock);
193
    hash_table_insert(&irq_uspace_hash_table, key, &irq->link);
197
    hash_table_insert(&irq_uspace_hash_table, key, &irq->link);
194
    list_append(&irq->notif_cfg.link, &box->irq_head);
198
    list_append(&irq->notif_cfg.link, &box->irq_head);
195
    spinlock_unlock(&box->irq_lock);
199
    spinlock_unlock(&box->irq_lock);
196
    spinlock_unlock(&irq->lock);
200
    spinlock_unlock(&irq->lock);