Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipwireless: Explicitly request io and mem regions

ipwireless: Explicitly request io and mem regions

Documentation/pcmcia/driver-changes.txt says, that driver should call request_region
for used memory/io regions since PCMCIA does not do this (since 2.6.8).

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

David Sterba and committed by
Linus Torvalds
09e491e9 ff3e990e

+50 -34
+45 -34
drivers/char/pcmcia/ipwireless/main.c
··· 88 88 unsigned short buf[64]; 89 89 cisparse_t parse; 90 90 unsigned short cor_value; 91 - win_req_t request_attr_memory; 92 - win_req_t request_common_memory; 93 91 memreq_t memreq_attr_memory; 94 92 memreq_t memreq_common_memory; 95 93 ··· 186 188 goto exit0; 187 189 } 188 190 191 + request_region(link->io.BasePort1, link->io.NumPorts1, 192 + IPWIRELESS_PCCARD_NAME); 193 + 189 194 /* memory settings */ 190 195 191 196 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; ··· 215 214 } 216 215 217 216 if (parse.cftable_entry.mem.nwin > 0) { 218 - request_common_memory.Attributes = 217 + ipw->request_common_memory.Attributes = 219 218 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; 220 - request_common_memory.Base = 219 + ipw->request_common_memory.Base = 221 220 parse.cftable_entry.mem.win[0].host_addr; 222 - request_common_memory.Size = parse.cftable_entry.mem.win[0].len; 223 - if (request_common_memory.Size < 0x1000) 224 - request_common_memory.Size = 0x1000; 225 - request_common_memory.AccessSpeed = 0; 221 + ipw->request_common_memory.Size = parse.cftable_entry.mem.win[0].len; 222 + if (ipw->request_common_memory.Size < 0x1000) 223 + ipw->request_common_memory.Size = 0x1000; 224 + ipw->request_common_memory.AccessSpeed = 0; 226 225 227 - ret = pcmcia_request_window(&link, &request_common_memory, 226 + ret = pcmcia_request_window(&link, &ipw->request_common_memory, 228 227 &ipw->handle_common_memory); 229 228 230 229 if (ret != CS_SUCCESS) { ··· 247 246 ipw->is_v2_card = 248 247 parse.cftable_entry.mem.win[0].len == 0x100; 249 248 250 - ipw->common_memory = ioremap(request_common_memory.Base, 251 - request_common_memory.Size); 249 + ipw->common_memory = ioremap(ipw->request_common_memory.Base, 250 + ipw->request_common_memory.Size); 251 + request_mem_region(ipw->request_common_memory.Base, 252 + ipw->request_common_memory.Size, IPWIRELESS_PCCARD_NAME); 252 253 253 - request_attr_memory.Attributes = 254 + ipw->request_attr_memory.Attributes = 254 255 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | WIN_ENABLE; 255 - request_attr_memory.Base = 0; 256 - request_attr_memory.Size = 0; /* this used to be 0x1000 */ 257 - request_attr_memory.AccessSpeed = 0; 256 + ipw->request_attr_memory.Base = 0; 257 + ipw->request_attr_memory.Size = 0; /* this used to be 0x1000 */ 258 + ipw->request_attr_memory.AccessSpeed = 0; 258 259 259 - ret = pcmcia_request_window(&link, &request_attr_memory, 260 + ret = pcmcia_request_window(&link, &ipw->request_attr_memory, 260 261 &ipw->handle_attr_memory); 261 262 262 263 if (ret != CS_SUCCESS) { ··· 277 274 goto exit2; 278 275 } 279 276 280 - ipw->attr_memory = ioremap(request_attr_memory.Base, 281 - request_attr_memory.Size); 277 + ipw->attr_memory = ioremap(ipw->request_attr_memory.Base, 278 + ipw->request_attr_memory.Size); 279 + request_mem_region(ipw->request_attr_memory.Base, ipw->request_attr_memory.Size, 280 + IPWIRELESS_PCCARD_NAME); 282 281 } 283 282 284 283 INIT_WORK(&ipw->work_reboot, signalled_reboot_work); ··· 317 312 if (ipw->attr_memory && ipw->common_memory) 318 313 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 319 314 ": attr memory 0x%08lx-0x%08lx, common memory 0x%08lx-0x%08lx\n", 320 - request_attr_memory.Base, 321 - request_attr_memory.Base 322 - + request_attr_memory.Size - 1, 323 - request_common_memory.Base, 324 - request_common_memory.Base 325 - + request_common_memory.Size - 1); 315 + ipw->request_attr_memory.Base, 316 + ipw->request_attr_memory.Base 317 + + ipw->request_attr_memory.Size - 1, 318 + ipw->request_common_memory.Base, 319 + ipw->request_common_memory.Base 320 + + ipw->request_common_memory.Size - 1); 326 321 327 322 ipw->network = ipwireless_network_create(ipw->hardware); 328 323 if (!ipw->network) ··· 354 349 pcmcia_disable_device(link); 355 350 exit3: 356 351 if (ipw->attr_memory) { 352 + release_mem_region(ipw->request_attr_memory.Base, 353 + ipw->request_attr_memory.Size); 357 354 iounmap(ipw->attr_memory); 358 355 pcmcia_release_window(ipw->handle_attr_memory); 359 356 pcmcia_disable_device(link); 360 357 } 361 358 exit2: 362 359 if (ipw->common_memory) { 360 + release_mem_region(ipw->request_common_memory.Base, 361 + ipw->request_common_memory.Size); 363 362 iounmap(ipw->common_memory); 364 363 pcmcia_release_window(ipw->handle_common_memory); 365 364 } ··· 375 366 376 367 static void release_ipwireless(struct ipw_dev *ipw) 377 368 { 378 - struct pcmcia_device *link = ipw->link; 369 + pcmcia_disable_device(ipw->link); 379 370 380 - pcmcia_disable_device(link); 381 - 382 - if (ipw->common_memory) 371 + if (ipw->common_memory) { 372 + release_mem_region(ipw->request_common_memory.Base, 373 + ipw->request_common_memory.Size); 383 374 iounmap(ipw->common_memory); 384 - if (ipw->attr_memory) 375 + } 376 + if (ipw->attr_memory) { 377 + release_mem_region(ipw->request_attr_memory.Base, 378 + ipw->request_attr_memory.Size); 385 379 iounmap(ipw->attr_memory); 380 + } 386 381 if (ipw->common_memory) 387 382 pcmcia_release_window(ipw->handle_common_memory); 388 383 if (ipw->attr_memory) 389 384 pcmcia_release_window(ipw->handle_attr_memory); 390 - pcmcia_disable_device(link); 385 + 386 + /* Break the link with Card Services */ 387 + pcmcia_disable_device(ipw->link); 391 388 } 392 389 393 390 /* ··· 450 435 struct ipw_dev *ipw = link->priv; 451 436 452 437 release_ipwireless(ipw); 453 - 454 - /* Break the link with Card Services */ 455 - if (link) 456 - pcmcia_disable_device(link); 457 438 458 439 if (ipw->tty != NULL) 459 440 ipwireless_tty_free(ipw->tty);
+5
drivers/char/pcmcia/ipwireless/main.h
··· 45 45 struct ipw_dev { 46 46 struct pcmcia_device *link; 47 47 int is_v2_card; 48 + 48 49 window_handle_t handle_attr_memory; 49 50 void __iomem *attr_memory; 51 + win_req_t request_attr_memory; 52 + 50 53 window_handle_t handle_common_memory; 51 54 void __iomem *common_memory; 55 + win_req_t request_common_memory; 56 + 52 57 dev_node_t nodes[2]; 53 58 /* Reference to attribute memory, containing CIS data */ 54 59 void *attribute_memory;