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

Changeset 8aa9265 in mainline


Ignore:
Timestamp:
2010-05-21T12:39:05Z (11 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
7de7cde
Parents:
d0ee0de
Message:

improve compatibility of interrupts-disabled spinlocks with non-SMP builds

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/synch/spinlock.h

    rd0ee0de r8aa9265  
    184184
    185185typedef struct {
    186         SPINLOCK_DECLARE(lock); /**< Spinlock */
    187         bool guard;             /**< Flag whether ipl is valid */
    188         ipl_t ipl;              /**< Original interrupt level */
     186        SPINLOCK_DECLARE(lock);  /**< Spinlock */
     187        bool guard;              /**< Flag whether ipl is valid */
     188        ipl_t ipl;               /**< Original interrupt level */
    189189} irq_spinlock_t;
    190190
    191191#define IRQ_SPINLOCK_DECLARE(lock_name)  irq_spinlock_t lock_name
    192192#define IRQ_SPINLOCK_EXTERN(lock_name)   extern irq_spinlock_t lock_name
     193
     194#ifdef CONFIG_SMP
    193195
    194196#define ASSERT_IRQ_SPINLOCK(expr, irq_lock) \
     
    243245
    244246#endif /* CONFIG_DEBUG_SPINLOCK */
     247
     248#else /* CONFIG_SMP */
     249
     250/*
     251 * Since the spinlocks are void on UP systems, we also need
     252 * to have a special variant of interrupts-disabled spinlock
     253 * macros which take this into account.
     254 */
     255
     256#define ASSERT_IRQ_SPINLOCK(expr, irq_lock) \
     257        ASSERT_SPINLOCK(expr, NULL)
     258
     259#define IRQ_SPINLOCK_INITIALIZE_NAME(lock_name, desc_name) \
     260        irq_spinlock_t lock_name = { \
     261                .guard = false, \
     262                .ipl = 0 \
     263        }
     264
     265#define IRQ_SPINLOCK_STATIC_INITIALIZE_NAME(lock_name, desc_name) \
     266        static irq_spinlock_t lock_name = { \
     267                .guard = false, \
     268                .ipl = 0 \
     269        }
     270
     271#endif /* CONFIG_SMP */
    245272
    246273#define IRQ_SPINLOCK_INITIALIZE(lock_name) \
Note: See TracChangeset for help on using the changeset viewer.