source: trunk/package/mac80211/patches/022-atomic64_backport.patch @ 27958

Last change on this file since 27958 was 27958, checked in by nbd, 5 years ago

mac80211: update to 2011-08-10

File size: 2.4 KB
  • compat/Makefile

    a b compat-$(CONFIG_COMPAT_KERNEL_2_6_39) += 
    3434        compat-2.6.39.o \ 
    3535        kstrtox.o 
    3636 
     37ifndef CONFIG_64BIT 
     38ifndef CONFIG_GENERIC_ATOMIC64 
     39  compat-y += compat_atomic.o 
     40endif 
     41endif 
  • include/linux/compat-2.6.31.h

    a b void compat_synchronize_threaded_irq(str 
    202202#define skb_walk_frags(skb, iter)       \ 
    203203        for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) 
    204204 
     205#ifndef CONFIG_64BIT 
     206 
     207typedef struct { 
     208        long long counter; 
     209} atomic64_t; 
     210 
     211extern long long atomic64_read(const atomic64_t *v); 
     212extern long long atomic64_add_return(long long a, atomic64_t *v); 
     213 
     214#define atomic64_inc_return(v)          atomic64_add_return(1LL, (v)) 
     215 
     216#endif 
     217 
     218 
    205219#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */ 
    206220 
    207221#endif /* LINUX_26_31_COMPAT_H */ 
  • new file compat/compat_atomic.c

    - +  
     1#include <linux/spinlock.h> 
     2#include <linux/module.h> 
     3 
     4#if !defined(CONFIG_X86) && !((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) && defined(CONFIG_ARM) && !defined(CONFIG_GENERIC_ATOMIC64)) 
     5 
     6static DEFINE_SPINLOCK(lock); 
     7 
     8long long atomic64_read(const atomic64_t *v) 
     9{ 
     10    unsigned long flags; 
     11    long long val; 
     12 
     13    spin_lock_irqsave(&lock, flags); 
     14    val = v->counter; 
     15    spin_unlock_irqrestore(&lock, flags); 
     16    return val; 
     17} 
     18EXPORT_SYMBOL(atomic64_read); 
     19 
     20long long atomic64_add_return(long long a, atomic64_t *v) 
     21{ 
     22    unsigned long flags; 
     23    long long val; 
     24 
     25    spin_lock_irqsave(&lock, flags); 
     26    val = v->counter += a; 
     27    spin_unlock_irqrestore(&lock, flags); 
     28    return val; 
     29} 
     30EXPORT_SYMBOL(atomic64_add_return); 
     31 
     32#endif 
     33 
  • include/linux/compat-3.1.h

    a b  
    3636        .prod_id = { NULL, NULL, (v3), NULL }, \ 
    3737        .prod_id_hash = { 0, 0, (vh3), 0 }, } 
    3838 
     39/* 
     40 * In many versions, several architectures do not seem to include an 
     41 * atomic64_t implementation, and do not include the software emulation from 
     42 * asm-generic/atomic64_t. 
     43 * Detect and handle this here. 
     44 */ 
     45#include <asm/atomic.h> 
     46 
     47#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) && !defined(ATOMIC64_INIT) && !defined(CONFIG_X86) && !((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) && defined(CONFIG_ARM) && !defined(CONFIG_GENERIC_ATOMIC64)) 
     48#include <asm-generic/atomic64.h> 
     49#endif 
     50 
    3951#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) */ 
    4052 
    4153#endif /* LINUX_3_1_COMPAT_H */ 
Note: See TracBrowser for help on using the repository browser.