ar71xx: fix legacy image build error
[openwrt/staging/hauke.git] / target / linux / generic / patches-4.1 / 902-debloat_proc.patch
index fef538254c4275f1a29b0c72729b34eef1c797fe..b0dce818b507e095792fb4e4e416d2ea94606978 100644 (file)
@@ -1,6 +1,6 @@
 --- a/fs/locks.c
 +++ b/fs/locks.c
-@@ -2676,6 +2676,8 @@ static const struct file_operations proc
+@@ -2683,6 +2683,8 @@ static const struct file_operations proc
  
  static int __init proc_locks_init(void)
  {
  }
 --- a/kernel/irq/proc.c
 +++ b/kernel/irq/proc.c
-@@ -325,6 +325,9 @@ void register_irq_proc(unsigned int irq,
- {
+@@ -327,6 +327,9 @@ void register_irq_proc(unsigned int irq,
+       static DEFINE_MUTEX(register_lock);
        char name [MAX_NAMELEN];
  
 +      if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP))
 +              return;
 +
-       if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip) || desc->dir)
+       if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip))
                return;
  
-@@ -361,6 +364,9 @@ void unregister_irq_proc(unsigned int ir
+@@ -376,6 +379,9 @@ void unregister_irq_proc(unsigned int ir
  {
        char name [MAX_NAMELEN];
  
@@ -99,7 +99,7 @@
        if (!root_irq_dir || !desc->dir)
                return;
  #ifdef CONFIG_SMP
-@@ -396,6 +402,9 @@ void init_irq_proc(void)
+@@ -411,6 +417,9 @@ void init_irq_proc(void)
        unsigned int irq;
        struct irq_desc *desc;
  
                goto err;
 --- a/net/core/sock.c
 +++ b/net/core/sock.c
-@@ -2971,6 +2971,8 @@ static __net_initdata struct pernet_oper
+@@ -2970,6 +2970,8 @@ static __net_initdata struct pernet_oper
  
  static int __init proto_init(void)
  {
  
 --- a/net/ipv4/fib_trie.c
 +++ b/net/ipv4/fib_trie.c
-@@ -2630,10 +2630,12 @@ static const struct file_operations fib_
+@@ -2626,10 +2626,12 @@ static const struct file_operations fib_
  
  int __net_init fib_proc_init(struct net *net)
  {
                         &fib_triestat_fops))
                goto out2;
  
-@@ -2643,17 +2645,21 @@ int __net_init fib_proc_init(struct net
+@@ -2639,17 +2641,21 @@ int __net_init fib_proc_init(struct net
        return 0;
  
  out3:
  
 --- a/net/ipv4/route.c
 +++ b/net/ipv4/route.c
-@@ -415,6 +415,9 @@ static struct pernet_operations ip_rt_pr
+@@ -416,6 +416,9 @@ static struct pernet_operations ip_rt_pr
  
  static int __init ip_rt_proc_init(void)
  {
        remove_proc_entry("dev", net->proc_net);
  }
  
+--- a/include/net/snmp.h
++++ b/include/net/snmp.h
+@@ -123,6 +123,30 @@ struct linux_xfrm_mib {
+ #define DECLARE_SNMP_STAT(type, name) \
+       extern __typeof__(type) __percpu *name
++#ifdef CONFIG_PROC_STRIPPED
++#define SNMP_INC_STATS_BH(mib, field) \
++      do { (void) mib->mibs[0]; } while(0)
++#define SNMP_INC_STATS_USER(mib, field)       \
++      do { (void) mib->mibs[0]; } while(0)
++#define SNMP_INC_STATS_ATOMIC_LONG(mib, field)        \
++      do { (void) mib->mibs[0]; } while(0)
++#define SNMP_INC_STATS(mib, field)    \
++      do { (void) mib->mibs[0]; } while(0)
++#define SNMP_DEC_STATS(mib, field)    \
++      do { (void) mib->mibs[0]; } while(0)
++#define SNMP_ADD_STATS_BH(mib, field, addend) \
++      do { (void) mib->mibs[0]; } while(0)
++#define SNMP_ADD_STATS_USER(mib, field, addend)       \
++      do { (void) mib->mibs[0]; } while(0)
++#define SNMP_ADD_STATS(mib, field, addend)    \
++      do { (void) mib->mibs[0]; } while(0)
++#define SNMP_UPD_PO_STATS(mib, basefield, addend)     \
++      do { (void) mib->mibs[0]; } while(0)
++#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend)  \
++      do { (void) mib->mibs[0]; } while(0)
++
++#else
++
+ #define SNMP_INC_STATS_BH(mib, field) \
+                       __this_cpu_inc(mib->mibs[field])
+@@ -159,8 +183,9 @@ struct linux_xfrm_mib {
+               __this_cpu_add(ptr[basefield##OCTETS], addend); \
+       } while (0)
++#endif
+-#if BITS_PER_LONG==32
++#if (BITS_PER_LONG==32) && !defined(CONFIG_PROC_STRIPPED)
+ #define SNMP_ADD_STATS64_BH(mib, field, addend)                       \
+       do {                                                            \