Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 458e40c in mainline


Ignore:
Timestamp:
2011-02-04T14:26:40Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial
Children:
400575c5, 89acf204
Parents:
bfc12ef (diff), 6f8f808 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged minor fixes and improvements

See log messages of merged revisions.

Location:
uspace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhub/main.c

    rbfc12ef r458e40c  
    6565int main(int argc, char *argv[])
    6666{
    67         usb_dprintf_enable(NAME, USB_LOG_LEVEL_INFO);
     67        usb_log_enable(USB_LOG_LEVEL_INFO, NAME);
    6868       
    6969        fibril_mutex_initialize(&usb_hub_list_lock);
  • uspace/drv/usbhub/usbhub_private.h

    rbfc12ef r458e40c  
    6565//************
    6666#define dprintf(level, format, ...) \
    67         usb_dprintf(NAME, (level), format "\n", ##__VA_ARGS__)
     67        usb_log_printf((level), format "\n", ##__VA_ARGS__)
    6868
    6969
  • uspace/lib/usb/src/debug.c

    rbfc12ef r458e40c  
    206206void usb_log_printf(usb_log_level_t level, const char *format, ...)
    207207{
    208         FILE *stream = NULL;
     208        FILE *screen_stream = NULL;
    209209        switch (level) {
    210210                case USB_LOG_LEVEL_FATAL:
    211211                case USB_LOG_LEVEL_ERROR:
    212                         stream = stderr;
     212                        screen_stream = stderr;
    213213                        break;
    214214                default:
    215                         stream = stdout;
     215                        screen_stream = stdout;
    216216                        break;
    217217        }
    218         assert(stream != NULL);
     218        assert(screen_stream != NULL);
    219219
    220220        va_list args;
    221         va_start(args, format);
    222221
    223222        /*
     
    231230
    232231        if (log_stream != NULL) {
     232                va_start(args, format);
     233
    233234                fprintf(log_stream, "[%s]%s: ", log_prefix, level_name);
    234235                vfprintf(log_stream, format, args);
     236                fflush(log_stream);
     237
     238                va_end(args);
    235239        }
    236240
    237241        if (level <= log_level) {
    238                 fprintf(stream, "[%s]%s: ", log_prefix, level_name);
    239                 vfprintf(stream, format, args);
     242                va_start(args, format);
     243
     244                fprintf(screen_stream, "[%s]%s: ", log_prefix, level_name);
     245                vfprintf(screen_stream, format, args);
     246                fflush(screen_stream);
     247
     248                va_end(args);
    240249        }
    241250
    242251        fibril_mutex_unlock(&log_serializer);
    243 
    244         va_end(args);
    245252}
    246253
  • uspace/lib/usb/src/recognise.c

    rbfc12ef r458e40c  
    359359{
    360360        static size_t device_name_index = 0;
     361        static FIBRIL_MUTEX_INITIALIZE(device_name_index_mutex);
     362
     363        size_t this_device_name_index;
     364
     365        fibril_mutex_lock(&device_name_index_mutex);
     366        this_device_name_index = device_name_index;
     367        device_name_index++;
     368        fibril_mutex_unlock(&device_name_index_mutex);
     369
    361370
    362371        device_t *child = NULL;
     
    374383         * naming etc., something more descriptive could be created.
    375384         */
    376         rc = asprintf(&child_name, "usbdev%02zu", device_name_index);
     385        rc = asprintf(&child_name, "usbdev%02zu", this_device_name_index);
    377386        if (rc < 0) {
    378387                goto failure;
     
    396405        }
    397406       
    398         device_name_index++;
    399 
    400407        return EOK;
    401408
Note: See TracChangeset for help on using the changeset viewer.