mac80211: update brcmsmac patches
[15.05/openwrt.git] / target / linux / generic / patches-3.3 / 941-ocf_20110720.patch
1 --- a/kernel/pid.c
2 +++ b/kernel/pid.c
3 @@ -430,6 +430,7 @@ struct task_struct *find_task_by_vpid(pi
4  {
5         return find_task_by_pid_ns(vnr, current->nsproxy->pid_ns);
6  }
7 +EXPORT_SYMBOL(find_task_by_vpid);
8  
9  struct pid *get_task_pid(struct task_struct *task, enum pid_type type)
10  {
11 --- a/drivers/char/random.c
12 +++ b/drivers/char/random.c
13 @@ -130,6 +130,9 @@
14   *     void add_interrupt_randomness(int irq);
15   *     void add_disk_randomness(struct gendisk *disk);
16   *
17 + *      void random_input_words(__u32 *buf, size_t wordcount, int ent_count)
18 + *      int random_input_wait(void);
19 + *
20   * add_input_randomness() uses the input layer interrupt timing, as well as
21   * the event type information from the hardware.
22   *
23 @@ -147,6 +150,13 @@
24   * seek times do not make for good sources of entropy, as their seek
25   * times are usually fairly consistent.
26   *
27 + * random_input_words() just provides a raw block of entropy to the input
28 + * pool, such as from a hardware entropy generator.
29 + *
30 + * random_input_wait() suspends the caller until such time as the
31 + * entropy pool falls below the write threshold, and returns a count of how
32 + * much entropy (in bits) is needed to sustain the pool.
33 + *
34   * All of these routines try to estimate how many bits of randomness a
35   * particular randomness source.  They do this by keeping track of the
36   * first and second order deltas of the event timings.
37 @@ -726,6 +736,63 @@ void add_disk_randomness(struct gendisk
38  }
39  #endif
40  
41 +/*
42 + * random_input_words - add bulk entropy to pool
43 + *
44 + * @buf: buffer to add
45 + * @wordcount: number of __u32 words to add
46 + * @ent_count: total amount of entropy (in bits) to credit
47 + *
48 + * this provides bulk input of entropy to the input pool
49 + *
50 + */
51 +void random_input_words(__u32 *buf, size_t wordcount, int ent_count)
52 +{
53 +       mix_pool_bytes(&input_pool, buf, wordcount*4);
54 +
55 +       credit_entropy_bits(&input_pool, ent_count);
56 +
57 +       DEBUG_ENT("crediting %d bits => %d\n",
58 +                 ent_count, input_pool.entropy_count);
59 +       /*
60 +        * Wake up waiting processes if we have enough
61 +        * entropy.
62 +        */
63 +       if (input_pool.entropy_count >= random_read_wakeup_thresh)
64 +               wake_up_interruptible(&random_read_wait);
65 +}
66 +EXPORT_SYMBOL(random_input_words);
67 +
68 +/*
69 + * random_input_wait - wait until random needs entropy
70 + *
71 + * this function sleeps until the /dev/random subsystem actually
72 + * needs more entropy, and then return the amount of entropy
73 + * that it would be nice to have added to the system.
74 + */
75 +int random_input_wait(void)
76 +{
77 +       int count;
78 +
79 +       wait_event_interruptible(random_write_wait, 
80 +                        input_pool.entropy_count < random_write_wakeup_thresh);
81 +
82 +       count = random_write_wakeup_thresh - input_pool.entropy_count;
83 +
84 +        /* likely we got woken up due to a signal */
85 +       if (count <= 0) count = random_read_wakeup_thresh; 
86 +
87 +       DEBUG_ENT("requesting %d bits from input_wait()er %d<%d\n",
88 +                 count,
89 +                 input_pool.entropy_count, random_write_wakeup_thresh);
90 +
91 +       return count;
92 +}
93 +EXPORT_SYMBOL(random_input_wait);
94 +
95 +
96 +#define EXTRACT_SIZE 10
97 +
98  /*********************************************************************
99   *
100   * Entropy extraction routines
101 --- a/fs/fcntl.c
102 +++ b/fs/fcntl.c
103 @@ -142,6 +142,7 @@ SYSCALL_DEFINE1(dup, unsigned int, filde
104         }
105         return ret;
106  }
107 +EXPORT_SYMBOL(sys_dup);
108  
109  #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
110  
111 --- a/include/linux/miscdevice.h
112 +++ b/include/linux/miscdevice.h
113 @@ -19,6 +19,7 @@
114  #define APOLLO_MOUSE_MINOR     7
115  #define PC110PAD_MINOR         9
116  /*#define ADB_MOUSE_MINOR      10      FIXME OBSOLETE */
117 +#define CRYPTODEV_MINOR                70      /* /dev/crypto */
118  #define WATCHDOG_MINOR         130     /* Watchdog timer     */
119  #define TEMP_MINOR             131     /* Temperature Sensor */
120  #define RTC_MINOR              135
121 --- a/include/linux/random.h
122 +++ b/include/linux/random.h
123 @@ -54,6 +54,10 @@ extern void add_input_randomness(unsigne
124                                  unsigned int value);
125  extern void add_interrupt_randomness(int irq);
126  
127 +extern void random_input_words(__u32 *buf, size_t wordcount, int ent_count);
128 +extern int random_input_wait(void);
129 +#define HAS_RANDOM_INPUT_WAIT 1
130 +
131  extern void get_random_bytes(void *buf, int nbytes);
132  void generate_random_uuid(unsigned char uuid_out[16]);
133