]> git.pld-linux.org Git - packages/kernel.git/blob - atm-30-idt77105-cleanup.patch
- ported from linux-2.4.25-atmdd.patch
[packages/kernel.git] / atm-30-idt77105-cleanup.patch
1 In message <20030308.130112.09061347.davem@redhat.com>,"David S. Miller" writes:
2 >This patch doesn't apply at all, it deletes lines referencing
3 >idt77105_priv_lock but that does not appear in the sources.
4
5 yes that's my fault.  i had an intermediate change i forgot about.
6 this would be the correct diff for idt77105 --
7
8 Index: linux/drivers/atm/idt77105.c
9 ===================================================================
10 RCS file: /home/chas/CVSROOT/linux/drivers/atm/idt77105.c,v
11 retrieving revision 1.1
12 retrieving revision 1.3
13 diff -u -r1.1 -r1.3
14 --- linux/drivers/atm/idt77105.c        20 Feb 2003 13:45:03 -0000      1.1
15 +++ linux/drivers/atm/idt77105.c        5 Mar 2003 16:39:56 -0000       1.3
16 @@ -15,6 +15,7 @@
17  #include <linux/init.h>
18  #include <linux/capability.h>
19  #include <linux/atm_idt77105.h>
20 +#include <linux/spinlock.h>
21  #include <asm/system.h>
22  #include <asm/param.h>
23  #include <asm/uaccess.h>
24 @@ -38,6 +39,7 @@
25          unsigned char old_mcr;          /* storage of MCR reg while signal lost */
26  };
27  
28 +static spinlock_t idt77105_priv_lock = SPIN_LOCK_UNLOCKED;
29  
30  #define PRIV(dev) ((struct idt77105_priv *) dev->phy_data)
31  
32 @@ -144,12 +146,11 @@
33         unsigned long flags;
34         struct idt77105_stats stats;
35  
36 -       save_flags(flags);
37 -       cli();
38 +       spin_lock_irqsave(&idt77105_priv_lock, flags);
39         memcpy(&stats, &PRIV(dev)->stats, sizeof(struct idt77105_stats));
40         if (zero)
41                 memset(&PRIV(dev)->stats, 0, sizeof(struct idt77105_stats));
42 -       restore_flags(flags);
43 +       spin_unlock_irqrestore(&idt77105_priv_lock, flags);
44         if (arg == NULL)
45                 return 0;
46         return copy_to_user(arg, &PRIV(dev)->stats,
47 @@ -267,11 +268,10 @@
48         if (!(PRIV(dev) = kmalloc(sizeof(struct idt77105_priv),GFP_KERNEL)))
49                 return -ENOMEM;
50         PRIV(dev)->dev = dev;
51 -       save_flags(flags);
52 -       cli();
53 +       spin_lock_irqsave(&idt77105_priv_lock, flags);
54         PRIV(dev)->next = idt77105_all;
55         idt77105_all = PRIV(dev);
56 -       restore_flags(flags);
57 +       spin_unlock_irqrestore(&idt77105_priv_lock, flags);
58         memset(&PRIV(dev)->stats,0,sizeof(struct idt77105_stats));
59          
60          /* initialise dev->signal from Good Signal Bit */
61 @@ -305,11 +305,9 @@
62         idt77105_stats_timer_func(0); /* clear 77105 counters */
63         (void) fetch_stats(dev,NULL,1); /* clear kernel counters */
64          
65 -       cli();
66 -       if (!start_timer) restore_flags(flags);
67 -       else {
68 +       spin_lock_irqsave(&idt77105_priv_lock, flags);
69 +       if (start_timer) {
70                 start_timer = 0;
71 -               restore_flags(flags);
72                  
73                 init_timer(&stats_timer);
74                 stats_timer.expires = jiffies+IDT77105_STATS_TIMER_PERIOD;
75 @@ -321,32 +319,11 @@
76                 restart_timer.function = idt77105_restart_timer_func;
77                 add_timer(&restart_timer);
78         }
79 +       spin_unlock_irqrestore(&idt77105_priv_lock, flags);
80         return 0;
81  }
82  
83  
84 -static const struct atmphy_ops idt77105_ops = {
85 -       idt77105_start,
86 -       idt77105_ioctl,
87 -       idt77105_int
88 -};
89 -
90 -
91 -int __init idt77105_init(struct atm_dev *dev)
92 -{
93 -       MOD_INC_USE_COUNT;
94 -
95 -       dev->phy = &idt77105_ops;
96 -       return 0;
97 -}
98 -
99 -
100 -/*
101 - * TODO: this function should be called through phy_ops
102 - * but that will not be possible for some time as there is
103 - * currently a freeze on modifying that structure
104 - * -- Greg Banks, 13 Sep 1999
105 - */
106  int idt77105_stop(struct atm_dev *dev)
107  {
108         struct idt77105_priv *walk, *prev;
109 @@ -372,30 +349,33 @@
110              }
111          }
112  
113 -       MOD_DEC_USE_COUNT;
114         return 0;
115  }
116  
117  
118 +static const struct atmphy_ops idt77105_ops = {
119 +       start:          idt77105_start,
120 +       ioctl:          idt77105_ioctl,
121 +       interrupt:      idt77105_int,
122 +       stop:           idt77105_stop,
123 +};
124  
125 -EXPORT_SYMBOL(idt77105_init);
126 -EXPORT_SYMBOL(idt77105_stop);
127 -
128 -MODULE_LICENSE("GPL");
129 -
130 -#ifdef MODULE
131  
132 -int init_module(void)
133 +int idt77105_init(struct atm_dev *dev)
134  {
135 +       dev->phy = &idt77105_ops;
136         return 0;
137  }
138  
139 +EXPORT_SYMBOL(idt77105_init);
140  
141 -void cleanup_module(void)
142 +static void __exit idt77105_exit(void)
143  {
144          /* turn off timers */
145          del_timer(&stats_timer);
146          del_timer(&restart_timer);
147  }
148  
149 -#endif
150 +module_exit(idt77105_exit);
151 +
152 +MODULE_LICENSE("GPL");
153 -
154 To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
155 the body of a message to majordomo@vger.kernel.org
156 More majordomo info at  http://vger.kernel.org/majordomo-info.html
157 Please read the FAQ at  http://www.tux.org/lkml/
This page took 0.036096 seconds and 3 git commands to generate.