Changeset a35b458 in mainline for kernel/generic/src/ipc/kbox.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/kbox.c

    r3061bc1 ra35b458  
    6363        TASK->kb.finished = true;
    6464        mutex_unlock(&TASK->kb.cleanup_lock);
    65        
     65
    6666        bool have_kb_thread = (TASK->kb.thread != NULL);
    67        
     67
    6868        /*
    6969         * From now on nobody will try to connect phones or attach
    7070         * kbox threads
    7171         */
    72        
     72
    7373        /*
    7474         * Disconnect all phones connected to our kbox. Passing true for
     
    7878         */
    7979        ipc_answerbox_slam_phones(&TASK->kb.box, have_kb_thread);
    80        
     80
    8181        /*
    8282         * If the task was being debugged, clean up debugging session.
     
    8787        udebug_task_cleanup(TASK);
    8888        mutex_unlock(&TASK->udebug.lock);
    89        
     89
    9090        if (have_kb_thread) {
    9191                LOG("Join kb.thread.");
     
    9595                TASK->kb.thread = NULL;
    9696        }
    97        
     97
    9898        /* Answer all messages in 'calls' and 'dispatched_calls' queues. */
    9999        ipc_cleanup_call_list(&TASK->kb.box, &TASK->kb.box.calls);
     
    120120                LOG("Was not debugger.");
    121121        }
    122        
     122
    123123        LOG("Continue with hangup message.");
    124124        IPC_SET_RETVAL(call->data, 0);
    125125        ipc_answer(&TASK->kb.box, call);
    126        
     126
    127127        mutex_lock(&TASK->kb.cleanup_lock);
    128        
     128
    129129        irq_spinlock_lock(&TASK->lock, true);
    130130        irq_spinlock_lock(&TASK->kb.box.lock, false);
     
    134134                 * gets freed and signal to the caller.
    135135                 */
    136                
     136
    137137                /* Only detach kbox thread unless already terminating. */
    138138                if (TASK->kb.finished == false) {
     
    141141                        TASK->kb.thread = NULL;
    142142                }
    143                
     143
    144144                LOG("Phone list is empty.");
    145145                *last = true;
    146146        } else
    147147                *last = false;
    148        
     148
    149149        irq_spinlock_unlock(&TASK->kb.box.lock, false);
    150150        irq_spinlock_unlock(&TASK->lock, true);
    151        
     151
    152152        mutex_unlock(&TASK->kb.cleanup_lock);
    153153}
     
    166166        LOG("Starting.");
    167167        bool done = false;
    168        
     168
    169169        while (!done) {
    170170                call_t *call = ipc_wait_for_call(&TASK->kb.box, SYNCH_NO_TIMEOUT,
    171171                    SYNCH_FLAGS_NONE);
    172                
     172
    173173                if (call == NULL)
    174174                        continue;  /* Try again. */
    175                
     175
    176176                switch (IPC_GET_IMETHOD(call->data)) {
    177                
     177
    178178                case IPC_M_DEBUG:
    179179                        /* Handle debug call. */
    180180                        udebug_call_receive(call);
    181181                        break;
    182                
     182
    183183                case IPC_M_PHONE_HUNGUP:
    184184                        /*
     
    189189                        kbox_proc_phone_hungup(call, &done);
    190190                        break;
    191                
     191
    192192                default:
    193193                        /* Ignore */
     
    195195                }
    196196        }
    197        
     197
    198198        LOG("Exiting.");
    199199}
     
    213213{
    214214        irq_spinlock_lock(&tasks_lock, true);
    215        
     215
    216216        task_t *task = task_find_by_id(taskid);
    217217        if (task == NULL) {
     
    219219                return ENOENT;
    220220        }
    221        
     221
    222222        atomic_inc(&task->refcount);
    223        
     223
    224224        irq_spinlock_unlock(&tasks_lock, true);
    225        
     225
    226226        mutex_lock(&task->kb.cleanup_lock);
    227        
     227
    228228        if (atomic_predec(&task->refcount) == 0) {
    229229                mutex_unlock(&task->kb.cleanup_lock);
     
    231231                return ENOENT;
    232232        }
    233        
     233
    234234        if (task->kb.finished) {
    235235                mutex_unlock(&task->kb.cleanup_lock);
    236236                return EINVAL;
    237237        }
    238        
     238
    239239        /* Create a kbox thread if necessary. */
    240240        if (task->kb.thread == NULL) {
    241241                thread_t *kb_thread = thread_create(kbox_thread_proc, NULL, task,
    242242                    THREAD_FLAG_NONE, "kbox");
    243                
     243
    244244                if (!kb_thread) {
    245245                        mutex_unlock(&task->kb.cleanup_lock);
    246246                        return ENOMEM;
    247247                }
    248                
     248
    249249                task->kb.thread = kb_thread;
    250250                thread_ready(kb_thread);
    251251        }
    252        
     252
    253253        /* Allocate a new phone. */
    254254        cap_handle_t phone_handle;
     
    258258                return rc;
    259259        }
    260        
     260
    261261        kobject_t *phone_obj = kobject_get(TASK, phone_handle,
    262262            KOBJECT_TYPE_PHONE);
     
    264264        /* Hand over phone_obj's reference to ipc_phone_connect() */
    265265        (void) ipc_phone_connect(phone_obj->phone, &task->kb.box);
    266        
     266
    267267        mutex_unlock(&task->kb.cleanup_lock);
    268268        *out_phone = phone_handle;
Note: See TracChangeset for help on using the changeset viewer.