aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/resource.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 61145491f363..a795864dc695 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -80,40 +80,40 @@ struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
80int pnp_register_irq_resource(struct pnp_dev *dev, struct pnp_option *option, 80int pnp_register_irq_resource(struct pnp_dev *dev, struct pnp_option *option,
81 pnp_irq_mask_t *map, unsigned char flags) 81 pnp_irq_mask_t *map, unsigned char flags)
82{ 82{
83 struct pnp_irq *data, *ptr; 83 struct pnp_irq *irq, *ptr;
84#ifdef DEBUG 84#ifdef DEBUG
85 char buf[PNP_IRQ_NR]; /* hex-encoded, so this is overkill but safe */ 85 char buf[PNP_IRQ_NR]; /* hex-encoded, so this is overkill but safe */
86#endif 86#endif
87 87
88 data = kzalloc(sizeof(struct pnp_irq), GFP_KERNEL); 88 irq = kzalloc(sizeof(struct pnp_irq), GFP_KERNEL);
89 if (!data) 89 if (!irq)
90 return -ENOMEM; 90 return -ENOMEM;
91 91
92 data->map = *map; 92 irq->map = *map;
93 data->flags = flags; 93 irq->flags = flags;
94 94
95 ptr = option->irq; 95 ptr = option->irq;
96 while (ptr && ptr->next) 96 while (ptr && ptr->next)
97 ptr = ptr->next; 97 ptr = ptr->next;
98 if (ptr) 98 if (ptr)
99 ptr->next = data; 99 ptr->next = irq;
100 else 100 else
101 option->irq = data; 101 option->irq = irq;
102 102
103#ifdef CONFIG_PCI 103#ifdef CONFIG_PCI
104 { 104 {
105 int i; 105 int i;
106 106
107 for (i = 0; i < 16; i++) 107 for (i = 0; i < 16; i++)
108 if (test_bit(i, data->map.bits)) 108 if (test_bit(i, irq->map.bits))
109 pcibios_penalize_isa_irq(i, 0); 109 pcibios_penalize_isa_irq(i, 0);
110 } 110 }
111#endif 111#endif
112 112
113#ifdef DEBUG 113#ifdef DEBUG
114 bitmap_scnprintf(buf, sizeof(buf), data->map.bits, PNP_IRQ_NR); 114 bitmap_scnprintf(buf, sizeof(buf), irq->map.bits, PNP_IRQ_NR);
115 dev_dbg(&dev->dev, " irq bitmask %s flags %#x\n", buf, 115 dev_dbg(&dev->dev, " irq bitmask %s flags %#x\n", buf,
116 data->flags); 116 irq->flags);
117#endif 117#endif
118 return 0; 118 return 0;
119} 119}
@@ -121,25 +121,25 @@ int pnp_register_irq_resource(struct pnp_dev *dev, struct pnp_option *option,
121int pnp_register_dma_resource(struct pnp_dev *dev, struct pnp_option *option, 121int pnp_register_dma_resource(struct pnp_dev *dev, struct pnp_option *option,
122 unsigned char map, unsigned char flags) 122 unsigned char map, unsigned char flags)
123{ 123{
124 struct pnp_dma *data, *ptr; 124 struct pnp_dma *dma, *ptr;
125 125
126 data = kzalloc(sizeof(struct pnp_dma), GFP_KERNEL); 126 dma = kzalloc(sizeof(struct pnp_dma), GFP_KERNEL);
127 if (!data) 127 if (!dma)
128 return -ENOMEM; 128 return -ENOMEM;
129 129
130 data->map = map; 130 dma->map = map;
131 data->flags = flags; 131 dma->flags = flags;
132 132
133 ptr = option->dma; 133 ptr = option->dma;
134 while (ptr && ptr->next) 134 while (ptr && ptr->next)
135 ptr = ptr->next; 135 ptr = ptr->next;
136 if (ptr) 136 if (ptr)
137 ptr->next = data; 137 ptr->next = dma;
138 else 138 else
139 option->dma = data; 139 option->dma = dma;
140 140
141 dev_dbg(&dev->dev, " dma bitmask %#x flags %#x\n", data->map, 141 dev_dbg(&dev->dev, " dma bitmask %#x flags %#x\n", dma->map,
142 data->flags); 142 dma->flags);
143 return 0; 143 return 0;
144} 144}
145 145
@@ -148,32 +148,32 @@ int pnp_register_port_resource(struct pnp_dev *dev, struct pnp_option *option,
148 resource_size_t align, resource_size_t size, 148 resource_size_t align, resource_size_t size,
149 unsigned char flags) 149 unsigned char flags)
150{ 150{
151 struct pnp_port *data, *ptr; 151 struct pnp_port *port, *ptr;
152 152
153 data = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); 153 port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL);
154 if (!data) 154 if (!port)
155 return -ENOMEM; 155 return -ENOMEM;
156 156
157 data->min = min; 157 port->min = min;
158 data->max = max; 158 port->max = max;
159 data->align = align; 159 port->align = align;
160 data->size = size; 160 port->size = size;
161 data->flags = flags; 161 port->flags = flags;
162 162
163 ptr = option->port; 163 ptr = option->port;
164 while (ptr && ptr->next) 164 while (ptr && ptr->next)
165 ptr = ptr->next; 165 ptr = ptr->next;
166 if (ptr) 166 if (ptr)
167 ptr->next = data; 167 ptr->next = port;
168 else 168 else
169 option->port = data; 169 option->port = port;
170 170
171 dev_dbg(&dev->dev, " io " 171 dev_dbg(&dev->dev, " io "
172 "min %#llx max %#llx align %lld size %lld flags %#x\n", 172 "min %#llx max %#llx align %lld size %lld flags %#x\n",
173 (unsigned long long) data->min, 173 (unsigned long long) port->min,
174 (unsigned long long) data->max, 174 (unsigned long long) port->max,
175 (unsigned long long) data->align, 175 (unsigned long long) port->align,
176 (unsigned long long) data->size, data->flags); 176 (unsigned long long) port->size, port->flags);
177 return 0; 177 return 0;
178} 178}
179 179
@@ -182,32 +182,32 @@ int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option,
182 resource_size_t align, resource_size_t size, 182 resource_size_t align, resource_size_t size,
183 unsigned char flags) 183 unsigned char flags)
184{ 184{
185 struct pnp_mem *data, *ptr; 185 struct pnp_mem *mem, *ptr;
186 186
187 data = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); 187 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL);
188 if (!data) 188 if (!mem)
189 return -ENOMEM; 189 return -ENOMEM;
190 190
191 data->min = min; 191 mem->min = min;
192 data->max = max; 192 mem->max = max;
193 data->align = align; 193 mem->align = align;
194 data->size = size; 194 mem->size = size;
195 data->flags = flags; 195 mem->flags = flags;
196 196
197 ptr = option->mem; 197 ptr = option->mem;
198 while (ptr && ptr->next) 198 while (ptr && ptr->next)
199 ptr = ptr->next; 199 ptr = ptr->next;
200 if (ptr) 200 if (ptr)
201 ptr->next = data; 201 ptr->next = mem;
202 else 202 else
203 option->mem = data; 203 option->mem = mem;
204 204
205 dev_dbg(&dev->dev, " mem " 205 dev_dbg(&dev->dev, " mem "
206 "min %#llx max %#llx align %lld size %lld flags %#x\n", 206 "min %#llx max %#llx align %lld size %lld flags %#x\n",
207 (unsigned long long) data->min, 207 (unsigned long long) mem->min,
208 (unsigned long long) data->max, 208 (unsigned long long) mem->max,
209 (unsigned long long) data->align, 209 (unsigned long long) mem->align,
210 (unsigned long long) data->size, data->flags); 210 (unsigned long long) mem->size, mem->flags);
211 return 0; 211 return 0;
212} 212}
213 213