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