diff options
Diffstat (limited to 'drivers')
216 files changed, 3256 insertions, 7508 deletions
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 3937adf4e5e5..aa993715d644 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -203,6 +203,7 @@ acpi_handle acpi_get_pci_rootbridge_handle(unsigned int seg, unsigned int bus) | |||
203 | acpi_get_devices(PCI_ROOT_HID_STRING, find_pci_rootbridge, &find, NULL); | 203 | acpi_get_devices(PCI_ROOT_HID_STRING, find_pci_rootbridge, &find, NULL); |
204 | return find.handle; | 204 | return find.handle; |
205 | } | 205 | } |
206 | EXPORT_SYMBOL_GPL(acpi_get_pci_rootbridge_handle); | ||
206 | 207 | ||
207 | /* Get device's handler per its address under its parent */ | 208 | /* Get device's handler per its address under its parent */ |
208 | struct acpi_find_child { | 209 | struct acpi_find_child { |
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c index 0cded0468003..821c81e8cd38 100644 --- a/drivers/atm/horizon.c +++ b/drivers/atm/horizon.c | |||
@@ -1511,8 +1511,8 @@ static inline short setup_idle_tx_channel (hrz_dev * dev, hrz_vcc * vcc) { | |||
1511 | // a.k.a. prepare the channel and remember that we have done so. | 1511 | // a.k.a. prepare the channel and remember that we have done so. |
1512 | 1512 | ||
1513 | tx_ch_desc * tx_desc = &memmap->tx_descs[tx_channel]; | 1513 | tx_ch_desc * tx_desc = &memmap->tx_descs[tx_channel]; |
1514 | u16 rd_ptr; | 1514 | u32 rd_ptr; |
1515 | u16 wr_ptr; | 1515 | u32 wr_ptr; |
1516 | u16 channel = vcc->channel; | 1516 | u16 channel = vcc->channel; |
1517 | 1517 | ||
1518 | unsigned long flags; | 1518 | unsigned long flags; |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 6d4736e89f1a..8827dafba945 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -20,6 +20,8 @@ | |||
20 | 20 | ||
21 | #include "base.h" | 21 | #include "base.h" |
22 | 22 | ||
23 | #define to_platform_driver(drv) (container_of((drv), struct platform_driver, driver)) | ||
24 | |||
23 | struct device platform_bus = { | 25 | struct device platform_bus = { |
24 | .bus_id = "platform", | 26 | .bus_id = "platform", |
25 | }; | 27 | }; |
@@ -354,6 +356,77 @@ error: | |||
354 | return ERR_PTR(retval); | 356 | return ERR_PTR(retval); |
355 | } | 357 | } |
356 | 358 | ||
359 | static int platform_drv_probe(struct device *_dev) | ||
360 | { | ||
361 | struct platform_driver *drv = to_platform_driver(_dev->driver); | ||
362 | struct platform_device *dev = to_platform_device(_dev); | ||
363 | |||
364 | return drv->probe(dev); | ||
365 | } | ||
366 | |||
367 | static int platform_drv_remove(struct device *_dev) | ||
368 | { | ||
369 | struct platform_driver *drv = to_platform_driver(_dev->driver); | ||
370 | struct platform_device *dev = to_platform_device(_dev); | ||
371 | |||
372 | return drv->remove(dev); | ||
373 | } | ||
374 | |||
375 | static void platform_drv_shutdown(struct device *_dev) | ||
376 | { | ||
377 | struct platform_driver *drv = to_platform_driver(_dev->driver); | ||
378 | struct platform_device *dev = to_platform_device(_dev); | ||
379 | |||
380 | drv->shutdown(dev); | ||
381 | } | ||
382 | |||
383 | static int platform_drv_suspend(struct device *_dev, pm_message_t state) | ||
384 | { | ||
385 | struct platform_driver *drv = to_platform_driver(_dev->driver); | ||
386 | struct platform_device *dev = to_platform_device(_dev); | ||
387 | |||
388 | return drv->suspend(dev, state); | ||
389 | } | ||
390 | |||
391 | static int platform_drv_resume(struct device *_dev) | ||
392 | { | ||
393 | struct platform_driver *drv = to_platform_driver(_dev->driver); | ||
394 | struct platform_device *dev = to_platform_device(_dev); | ||
395 | |||
396 | return drv->resume(dev); | ||
397 | } | ||
398 | |||
399 | /** | ||
400 | * platform_driver_register | ||
401 | * @drv: platform driver structure | ||
402 | */ | ||
403 | int platform_driver_register(struct platform_driver *drv) | ||
404 | { | ||
405 | drv->driver.bus = &platform_bus_type; | ||
406 | if (drv->probe) | ||
407 | drv->driver.probe = platform_drv_probe; | ||
408 | if (drv->remove) | ||
409 | drv->driver.remove = platform_drv_remove; | ||
410 | if (drv->shutdown) | ||
411 | drv->driver.shutdown = platform_drv_shutdown; | ||
412 | if (drv->suspend) | ||
413 | drv->driver.suspend = platform_drv_suspend; | ||
414 | if (drv->resume) | ||
415 | drv->driver.resume = platform_drv_resume; | ||
416 | return driver_register(&drv->driver); | ||
417 | } | ||
418 | EXPORT_SYMBOL_GPL(platform_driver_register); | ||
419 | |||
420 | /** | ||
421 | * platform_driver_unregister | ||
422 | * @drv: platform driver structure | ||
423 | */ | ||
424 | void platform_driver_unregister(struct platform_driver *drv) | ||
425 | { | ||
426 | driver_unregister(&drv->driver); | ||
427 | } | ||
428 | EXPORT_SYMBOL_GPL(platform_driver_unregister); | ||
429 | |||
357 | 430 | ||
358 | /** | 431 | /** |
359 | * platform_match - bind platform device to platform driver. | 432 | * platform_match - bind platform device to platform driver. |
diff --git a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c index ba54b5872578..b02fc2267159 100644 --- a/drivers/char/agp/ali-agp.c +++ b/drivers/char/agp/ali-agp.c | |||
@@ -389,7 +389,6 @@ static struct pci_device_id agp_ali_pci_table[] = { | |||
389 | MODULE_DEVICE_TABLE(pci, agp_ali_pci_table); | 389 | MODULE_DEVICE_TABLE(pci, agp_ali_pci_table); |
390 | 390 | ||
391 | static struct pci_driver agp_ali_pci_driver = { | 391 | static struct pci_driver agp_ali_pci_driver = { |
392 | .owner = THIS_MODULE, | ||
393 | .name = "agpgart-ali", | 392 | .name = "agpgart-ali", |
394 | .id_table = agp_ali_pci_table, | 393 | .id_table = agp_ali_pci_table, |
395 | .probe = agp_ali_probe, | 394 | .probe = agp_ali_probe, |
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c index 40fcd88b2cea..1f776651ac64 100644 --- a/drivers/char/agp/amd-k7-agp.c +++ b/drivers/char/agp/amd-k7-agp.c | |||
@@ -515,7 +515,6 @@ static struct pci_device_id agp_amdk7_pci_table[] = { | |||
515 | MODULE_DEVICE_TABLE(pci, agp_amdk7_pci_table); | 515 | MODULE_DEVICE_TABLE(pci, agp_amdk7_pci_table); |
516 | 516 | ||
517 | static struct pci_driver agp_amdk7_pci_driver = { | 517 | static struct pci_driver agp_amdk7_pci_driver = { |
518 | .owner = THIS_MODULE, | ||
519 | .name = "agpgart-amdk7", | 518 | .name = "agpgart-amdk7", |
520 | .id_table = agp_amdk7_pci_table, | 519 | .id_table = agp_amdk7_pci_table, |
521 | .probe = agp_amdk7_probe, | 520 | .probe = agp_amdk7_probe, |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 8f748fddca94..78ce98a69f37 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -703,7 +703,6 @@ static struct pci_device_id agp_amd64_pci_table[] = { | |||
703 | MODULE_DEVICE_TABLE(pci, agp_amd64_pci_table); | 703 | MODULE_DEVICE_TABLE(pci, agp_amd64_pci_table); |
704 | 704 | ||
705 | static struct pci_driver agp_amd64_pci_driver = { | 705 | static struct pci_driver agp_amd64_pci_driver = { |
706 | .owner = THIS_MODULE, | ||
707 | .name = "agpgart-amd64", | 706 | .name = "agpgart-amd64", |
708 | .id_table = agp_amd64_pci_table, | 707 | .id_table = agp_amd64_pci_table, |
709 | .probe = agp_amd64_probe, | 708 | .probe = agp_amd64_probe, |
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c index fbd415565463..53372a83b675 100644 --- a/drivers/char/agp/ati-agp.c +++ b/drivers/char/agp/ati-agp.c | |||
@@ -521,7 +521,6 @@ static struct pci_device_id agp_ati_pci_table[] = { | |||
521 | MODULE_DEVICE_TABLE(pci, agp_ati_pci_table); | 521 | MODULE_DEVICE_TABLE(pci, agp_ati_pci_table); |
522 | 522 | ||
523 | static struct pci_driver agp_ati_pci_driver = { | 523 | static struct pci_driver agp_ati_pci_driver = { |
524 | .owner = THIS_MODULE, | ||
525 | .name = "agpgart-ati", | 524 | .name = "agpgart-ati", |
526 | .id_table = agp_ati_pci_table, | 525 | .id_table = agp_ati_pci_table, |
527 | .probe = agp_ati_probe, | 526 | .probe = agp_ati_probe, |
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c index d41e0a62e32e..e7aea77a60f9 100644 --- a/drivers/char/agp/efficeon-agp.c +++ b/drivers/char/agp/efficeon-agp.c | |||
@@ -429,7 +429,6 @@ static struct pci_device_id agp_efficeon_pci_table[] = { | |||
429 | MODULE_DEVICE_TABLE(pci, agp_efficeon_pci_table); | 429 | MODULE_DEVICE_TABLE(pci, agp_efficeon_pci_table); |
430 | 430 | ||
431 | static struct pci_driver agp_efficeon_pci_driver = { | 431 | static struct pci_driver agp_efficeon_pci_driver = { |
432 | .owner = THIS_MODULE, | ||
433 | .name = "agpgart-efficeon", | 432 | .name = "agpgart-efficeon", |
434 | .id_table = agp_efficeon_pci_table, | 433 | .id_table = agp_efficeon_pci_table, |
435 | .probe = agp_efficeon_probe, | 434 | .probe = agp_efficeon_probe, |
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c index 34a444658ffe..8ee19a4a6bce 100644 --- a/drivers/char/agp/i460-agp.c +++ b/drivers/char/agp/i460-agp.c | |||
@@ -622,7 +622,6 @@ static struct pci_device_id agp_intel_i460_pci_table[] = { | |||
622 | MODULE_DEVICE_TABLE(pci, agp_intel_i460_pci_table); | 622 | MODULE_DEVICE_TABLE(pci, agp_intel_i460_pci_table); |
623 | 623 | ||
624 | static struct pci_driver agp_intel_i460_pci_driver = { | 624 | static struct pci_driver agp_intel_i460_pci_driver = { |
625 | .owner = THIS_MODULE, | ||
626 | .name = "agpgart-intel-i460", | 625 | .name = "agpgart-intel-i460", |
627 | .id_table = agp_intel_i460_pci_table, | 626 | .id_table = agp_intel_i460_pci_table, |
628 | .probe = agp_intel_i460_probe, | 627 | .probe = agp_intel_i460_probe, |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 027161ab88e9..e7bed5047dcc 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -1827,7 +1827,6 @@ static struct pci_device_id agp_intel_pci_table[] = { | |||
1827 | MODULE_DEVICE_TABLE(pci, agp_intel_pci_table); | 1827 | MODULE_DEVICE_TABLE(pci, agp_intel_pci_table); |
1828 | 1828 | ||
1829 | static struct pci_driver agp_intel_pci_driver = { | 1829 | static struct pci_driver agp_intel_pci_driver = { |
1830 | .owner = THIS_MODULE, | ||
1831 | .name = "agpgart-intel", | 1830 | .name = "agpgart-intel", |
1832 | .id_table = agp_intel_pci_table, | 1831 | .id_table = agp_intel_pci_table, |
1833 | .probe = agp_intel_probe, | 1832 | .probe = agp_intel_probe, |
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c index 3aed0c5e2f92..80dafa3030bd 100644 --- a/drivers/char/agp/nvidia-agp.c +++ b/drivers/char/agp/nvidia-agp.c | |||
@@ -398,7 +398,6 @@ static struct pci_device_id agp_nvidia_pci_table[] = { | |||
398 | MODULE_DEVICE_TABLE(pci, agp_nvidia_pci_table); | 398 | MODULE_DEVICE_TABLE(pci, agp_nvidia_pci_table); |
399 | 399 | ||
400 | static struct pci_driver agp_nvidia_pci_driver = { | 400 | static struct pci_driver agp_nvidia_pci_driver = { |
401 | .owner = THIS_MODULE, | ||
402 | .name = "agpgart-nvidia", | 401 | .name = "agpgart-nvidia", |
403 | .id_table = agp_nvidia_pci_table, | 402 | .id_table = agp_nvidia_pci_table, |
404 | .probe = agp_nvidia_probe, | 403 | .probe = agp_nvidia_probe, |
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c index a701361a8890..ebc05554045c 100644 --- a/drivers/char/agp/sis-agp.c +++ b/drivers/char/agp/sis-agp.c | |||
@@ -332,7 +332,6 @@ static struct pci_device_id agp_sis_pci_table[] = { | |||
332 | MODULE_DEVICE_TABLE(pci, agp_sis_pci_table); | 332 | MODULE_DEVICE_TABLE(pci, agp_sis_pci_table); |
333 | 333 | ||
334 | static struct pci_driver agp_sis_pci_driver = { | 334 | static struct pci_driver agp_sis_pci_driver = { |
335 | .owner = THIS_MODULE, | ||
336 | .name = "agpgart-sis", | 335 | .name = "agpgart-sis", |
337 | .id_table = agp_sis_pci_table, | 336 | .id_table = agp_sis_pci_table, |
338 | .probe = agp_sis_probe, | 337 | .probe = agp_sis_probe, |
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c index 5a5392dd1254..3f8f7fa6b0ff 100644 --- a/drivers/char/agp/sworks-agp.c +++ b/drivers/char/agp/sworks-agp.c | |||
@@ -545,7 +545,6 @@ static struct pci_device_id agp_serverworks_pci_table[] = { | |||
545 | MODULE_DEVICE_TABLE(pci, agp_serverworks_pci_table); | 545 | MODULE_DEVICE_TABLE(pci, agp_serverworks_pci_table); |
546 | 546 | ||
547 | static struct pci_driver agp_serverworks_pci_driver = { | 547 | static struct pci_driver agp_serverworks_pci_driver = { |
548 | .owner = THIS_MODULE, | ||
549 | .name = "agpgart-serverworks", | 548 | .name = "agpgart-serverworks", |
550 | .id_table = agp_serverworks_pci_table, | 549 | .id_table = agp_serverworks_pci_table, |
551 | .probe = agp_serverworks_probe, | 550 | .probe = agp_serverworks_probe, |
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c index 183c50acab27..c8255312b8c1 100644 --- a/drivers/char/agp/uninorth-agp.c +++ b/drivers/char/agp/uninorth-agp.c | |||
@@ -658,7 +658,6 @@ static struct pci_device_id agp_uninorth_pci_table[] = { | |||
658 | MODULE_DEVICE_TABLE(pci, agp_uninorth_pci_table); | 658 | MODULE_DEVICE_TABLE(pci, agp_uninorth_pci_table); |
659 | 659 | ||
660 | static struct pci_driver agp_uninorth_pci_driver = { | 660 | static struct pci_driver agp_uninorth_pci_driver = { |
661 | .owner = THIS_MODULE, | ||
662 | .name = "agpgart-uninorth", | 661 | .name = "agpgart-uninorth", |
663 | .id_table = agp_uninorth_pci_table, | 662 | .id_table = agp_uninorth_pci_table, |
664 | .probe = agp_uninorth_probe, | 663 | .probe = agp_uninorth_probe, |
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c index 5d9a13700074..c847df575cf5 100644 --- a/drivers/char/agp/via-agp.c +++ b/drivers/char/agp/via-agp.c | |||
@@ -518,7 +518,6 @@ MODULE_DEVICE_TABLE(pci, agp_via_pci_table); | |||
518 | 518 | ||
519 | 519 | ||
520 | static struct pci_driver agp_via_pci_driver = { | 520 | static struct pci_driver agp_via_pci_driver = { |
521 | .owner = THIS_MODULE, | ||
522 | .name = "agpgart-via", | 521 | .name = "agpgart-via", |
523 | .id_table = agp_via_pci_table, | 522 | .id_table = agp_via_pci_table, |
524 | .probe = agp_via_probe, | 523 | .probe = agp_via_probe, |
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index b7a0e4d6b934..407708a001e4 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -3113,7 +3113,6 @@ MODULE_DEVICE_TABLE(pci, epca_pci_tbl); | |||
3113 | int __init init_PCI (void) | 3113 | int __init init_PCI (void) |
3114 | { /* Begin init_PCI */ | 3114 | { /* Begin init_PCI */ |
3115 | memset (&epca_driver, 0, sizeof (epca_driver)); | 3115 | memset (&epca_driver, 0, sizeof (epca_driver)); |
3116 | epca_driver.owner = THIS_MODULE; | ||
3117 | epca_driver.name = "epca"; | 3116 | epca_driver.name = "epca"; |
3118 | epca_driver.id_table = epca_pci_tbl; | 3117 | epca_driver.id_table = epca_pci_tbl; |
3119 | epca_driver.probe = epca_init_one; | 3118 | epca_driver.probe = epca_init_one; |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index c1d06ba449b6..d16bd4b5c117 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -2648,7 +2648,7 @@ void ipmi_smi_msg_received(ipmi_smi_t intf, | |||
2648 | spin_lock_irqsave(&intf->waiting_msgs_lock, flags); | 2648 | spin_lock_irqsave(&intf->waiting_msgs_lock, flags); |
2649 | if (!list_empty(&intf->waiting_msgs)) { | 2649 | if (!list_empty(&intf->waiting_msgs)) { |
2650 | list_add_tail(&msg->link, &intf->waiting_msgs); | 2650 | list_add_tail(&msg->link, &intf->waiting_msgs); |
2651 | spin_unlock(&intf->waiting_msgs_lock); | 2651 | spin_unlock_irqrestore(&intf->waiting_msgs_lock, flags); |
2652 | goto out; | 2652 | goto out; |
2653 | } | 2653 | } |
2654 | spin_unlock_irqrestore(&intf->waiting_msgs_lock, flags); | 2654 | spin_unlock_irqrestore(&intf->waiting_msgs_lock, flags); |
@@ -2657,9 +2657,9 @@ void ipmi_smi_msg_received(ipmi_smi_t intf, | |||
2657 | if (rv > 0) { | 2657 | if (rv > 0) { |
2658 | /* Could not handle the message now, just add it to a | 2658 | /* Could not handle the message now, just add it to a |
2659 | list to handle later. */ | 2659 | list to handle later. */ |
2660 | spin_lock(&intf->waiting_msgs_lock); | 2660 | spin_lock_irqsave(&intf->waiting_msgs_lock, flags); |
2661 | list_add_tail(&msg->link, &intf->waiting_msgs); | 2661 | list_add_tail(&msg->link, &intf->waiting_msgs); |
2662 | spin_unlock(&intf->waiting_msgs_lock); | 2662 | spin_unlock_irqrestore(&intf->waiting_msgs_lock, flags); |
2663 | } else if (rv == 0) { | 2663 | } else if (rv == 0) { |
2664 | ipmi_free_smi_msg(msg); | 2664 | ipmi_free_smi_msg(msg); |
2665 | } | 2665 | } |
diff --git a/drivers/char/s3c2410-rtc.c b/drivers/char/s3c2410-rtc.c index d724c0de4f28..3df7a574267b 100644 --- a/drivers/char/s3c2410-rtc.c +++ b/drivers/char/s3c2410-rtc.c | |||
@@ -382,7 +382,7 @@ static struct rtc_ops s3c2410_rtcops = { | |||
382 | .proc = s3c2410_rtc_proc, | 382 | .proc = s3c2410_rtc_proc, |
383 | }; | 383 | }; |
384 | 384 | ||
385 | static void s3c2410_rtc_enable(struct device *dev, int en) | 385 | static void s3c2410_rtc_enable(struct platform_device *pdev, int en) |
386 | { | 386 | { |
387 | unsigned int tmp; | 387 | unsigned int tmp; |
388 | 388 | ||
@@ -399,21 +399,21 @@ static void s3c2410_rtc_enable(struct device *dev, int en) | |||
399 | /* re-enable the device, and check it is ok */ | 399 | /* re-enable the device, and check it is ok */ |
400 | 400 | ||
401 | if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){ | 401 | if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){ |
402 | dev_info(dev, "rtc disabled, re-enabling\n"); | 402 | dev_info(&pdev->dev, "rtc disabled, re-enabling\n"); |
403 | 403 | ||
404 | tmp = readb(S3C2410_RTCCON); | 404 | tmp = readb(S3C2410_RTCCON); |
405 | writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON); | 405 | writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON); |
406 | } | 406 | } |
407 | 407 | ||
408 | if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){ | 408 | if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){ |
409 | dev_info(dev, "removing S3C2410_RTCCON_CNTSEL\n"); | 409 | dev_info(&pdev->dev, "removing S3C2410_RTCCON_CNTSEL\n"); |
410 | 410 | ||
411 | tmp = readb(S3C2410_RTCCON); | 411 | tmp = readb(S3C2410_RTCCON); |
412 | writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON); | 412 | writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON); |
413 | } | 413 | } |
414 | 414 | ||
415 | if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){ | 415 | if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){ |
416 | dev_info(dev, "removing S3C2410_RTCCON_CLKRST\n"); | 416 | dev_info(&pdev->dev, "removing S3C2410_RTCCON_CLKRST\n"); |
417 | 417 | ||
418 | tmp = readb(S3C2410_RTCCON); | 418 | tmp = readb(S3C2410_RTCCON); |
419 | writeb(tmp & ~S3C2410_RTCCON_CLKRST, S3C2410_RTCCON); | 419 | writeb(tmp & ~S3C2410_RTCCON_CLKRST, S3C2410_RTCCON); |
@@ -421,7 +421,7 @@ static void s3c2410_rtc_enable(struct device *dev, int en) | |||
421 | } | 421 | } |
422 | } | 422 | } |
423 | 423 | ||
424 | static int s3c2410_rtc_remove(struct device *dev) | 424 | static int s3c2410_rtc_remove(struct platform_device *dev) |
425 | { | 425 | { |
426 | unregister_rtc(&s3c2410_rtcops); | 426 | unregister_rtc(&s3c2410_rtcops); |
427 | 427 | ||
@@ -438,25 +438,24 @@ static int s3c2410_rtc_remove(struct device *dev) | |||
438 | return 0; | 438 | return 0; |
439 | } | 439 | } |
440 | 440 | ||
441 | static int s3c2410_rtc_probe(struct device *dev) | 441 | static int s3c2410_rtc_probe(struct platform_device *pdev) |
442 | { | 442 | { |
443 | struct platform_device *pdev = to_platform_device(dev); | ||
444 | struct resource *res; | 443 | struct resource *res; |
445 | int ret; | 444 | int ret; |
446 | 445 | ||
447 | pr_debug("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev); | 446 | pr_debug("%s: probe=%p\n", __FUNCTION__, pdev); |
448 | 447 | ||
449 | /* find the IRQs */ | 448 | /* find the IRQs */ |
450 | 449 | ||
451 | s3c2410_rtc_tickno = platform_get_irq(pdev, 1); | 450 | s3c2410_rtc_tickno = platform_get_irq(pdev, 1); |
452 | if (s3c2410_rtc_tickno <= 0) { | 451 | if (s3c2410_rtc_tickno <= 0) { |
453 | dev_err(dev, "no irq for rtc tick\n"); | 452 | dev_err(&pdev->dev, "no irq for rtc tick\n"); |
454 | return -ENOENT; | 453 | return -ENOENT; |
455 | } | 454 | } |
456 | 455 | ||
457 | s3c2410_rtc_alarmno = platform_get_irq(pdev, 0); | 456 | s3c2410_rtc_alarmno = platform_get_irq(pdev, 0); |
458 | if (s3c2410_rtc_alarmno <= 0) { | 457 | if (s3c2410_rtc_alarmno <= 0) { |
459 | dev_err(dev, "no irq for alarm\n"); | 458 | dev_err(&pdev->dev, "no irq for alarm\n"); |
460 | return -ENOENT; | 459 | return -ENOENT; |
461 | } | 460 | } |
462 | 461 | ||
@@ -467,7 +466,7 @@ static int s3c2410_rtc_probe(struct device *dev) | |||
467 | 466 | ||
468 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 467 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
469 | if (res == NULL) { | 468 | if (res == NULL) { |
470 | dev_err(dev, "failed to get memory region resource\n"); | 469 | dev_err(&pdev->dev, "failed to get memory region resource\n"); |
471 | return -ENOENT; | 470 | return -ENOENT; |
472 | } | 471 | } |
473 | 472 | ||
@@ -475,14 +474,14 @@ static int s3c2410_rtc_probe(struct device *dev) | |||
475 | pdev->name); | 474 | pdev->name); |
476 | 475 | ||
477 | if (s3c2410_rtc_mem == NULL) { | 476 | if (s3c2410_rtc_mem == NULL) { |
478 | dev_err(dev, "failed to reserve memory region\n"); | 477 | dev_err(&pdev->dev, "failed to reserve memory region\n"); |
479 | ret = -ENOENT; | 478 | ret = -ENOENT; |
480 | goto exit_err; | 479 | goto exit_err; |
481 | } | 480 | } |
482 | 481 | ||
483 | s3c2410_rtc_base = ioremap(res->start, res->end - res->start + 1); | 482 | s3c2410_rtc_base = ioremap(res->start, res->end - res->start + 1); |
484 | if (s3c2410_rtc_base == NULL) { | 483 | if (s3c2410_rtc_base == NULL) { |
485 | dev_err(dev, "failed ioremap()\n"); | 484 | dev_err(&pdev->dev, "failed ioremap()\n"); |
486 | ret = -EINVAL; | 485 | ret = -EINVAL; |
487 | goto exit_err; | 486 | goto exit_err; |
488 | } | 487 | } |
@@ -494,7 +493,7 @@ static int s3c2410_rtc_probe(struct device *dev) | |||
494 | 493 | ||
495 | /* check to see if everything is setup correctly */ | 494 | /* check to see if everything is setup correctly */ |
496 | 495 | ||
497 | s3c2410_rtc_enable(dev, 1); | 496 | s3c2410_rtc_enable(pdev, 1); |
498 | 497 | ||
499 | pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON)); | 498 | pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON)); |
500 | 499 | ||
@@ -506,7 +505,7 @@ static int s3c2410_rtc_probe(struct device *dev) | |||
506 | return 0; | 505 | return 0; |
507 | 506 | ||
508 | exit_err: | 507 | exit_err: |
509 | dev_err(dev, "error %d during initialisation\n", ret); | 508 | dev_err(&pdev->dev, "error %d during initialisation\n", ret); |
510 | 509 | ||
511 | return ret; | 510 | return ret; |
512 | } | 511 | } |
@@ -519,7 +518,7 @@ static struct timespec s3c2410_rtc_delta; | |||
519 | 518 | ||
520 | static int ticnt_save; | 519 | static int ticnt_save; |
521 | 520 | ||
522 | static int s3c2410_rtc_suspend(struct device *dev, pm_message_t state) | 521 | static int s3c2410_rtc_suspend(struct platform_device *pdev, pm_message_t state) |
523 | { | 522 | { |
524 | struct rtc_time tm; | 523 | struct rtc_time tm; |
525 | struct timespec time; | 524 | struct timespec time; |
@@ -535,19 +534,19 @@ static int s3c2410_rtc_suspend(struct device *dev, pm_message_t state) | |||
535 | s3c2410_rtc_gettime(&tm); | 534 | s3c2410_rtc_gettime(&tm); |
536 | rtc_tm_to_time(&tm, &time.tv_sec); | 535 | rtc_tm_to_time(&tm, &time.tv_sec); |
537 | save_time_delta(&s3c2410_rtc_delta, &time); | 536 | save_time_delta(&s3c2410_rtc_delta, &time); |
538 | s3c2410_rtc_enable(dev, 0); | 537 | s3c2410_rtc_enable(pdev, 0); |
539 | 538 | ||
540 | return 0; | 539 | return 0; |
541 | } | 540 | } |
542 | 541 | ||
543 | static int s3c2410_rtc_resume(struct device *dev) | 542 | static int s3c2410_rtc_resume(struct platform_device *pdev) |
544 | { | 543 | { |
545 | struct rtc_time tm; | 544 | struct rtc_time tm; |
546 | struct timespec time; | 545 | struct timespec time; |
547 | 546 | ||
548 | time.tv_nsec = 0; | 547 | time.tv_nsec = 0; |
549 | 548 | ||
550 | s3c2410_rtc_enable(dev, 1); | 549 | s3c2410_rtc_enable(pdev, 1); |
551 | s3c2410_rtc_gettime(&tm); | 550 | s3c2410_rtc_gettime(&tm); |
552 | rtc_tm_to_time(&tm, &time.tv_sec); | 551 | rtc_tm_to_time(&tm, &time.tv_sec); |
553 | restore_time_delta(&s3c2410_rtc_delta, &time); | 552 | restore_time_delta(&s3c2410_rtc_delta, &time); |
@@ -560,14 +559,15 @@ static int s3c2410_rtc_resume(struct device *dev) | |||
560 | #define s3c2410_rtc_resume NULL | 559 | #define s3c2410_rtc_resume NULL |
561 | #endif | 560 | #endif |
562 | 561 | ||
563 | static struct device_driver s3c2410_rtcdrv = { | 562 | static struct platform_driver s3c2410_rtcdrv = { |
564 | .name = "s3c2410-rtc", | ||
565 | .owner = THIS_MODULE, | ||
566 | .bus = &platform_bus_type, | ||
567 | .probe = s3c2410_rtc_probe, | 563 | .probe = s3c2410_rtc_probe, |
568 | .remove = s3c2410_rtc_remove, | 564 | .remove = s3c2410_rtc_remove, |
569 | .suspend = s3c2410_rtc_suspend, | 565 | .suspend = s3c2410_rtc_suspend, |
570 | .resume = s3c2410_rtc_resume, | 566 | .resume = s3c2410_rtc_resume, |
567 | .driver = { | ||
568 | .name = "s3c2410-rtc", | ||
569 | .owner = THIS_MODULE, | ||
570 | }, | ||
571 | }; | 571 | }; |
572 | 572 | ||
573 | static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n"; | 573 | static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n"; |
@@ -575,12 +575,12 @@ static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n"; | |||
575 | static int __init s3c2410_rtc_init(void) | 575 | static int __init s3c2410_rtc_init(void) |
576 | { | 576 | { |
577 | printk(banner); | 577 | printk(banner); |
578 | return driver_register(&s3c2410_rtcdrv); | 578 | return platform_driver_register(&s3c2410_rtcdrv); |
579 | } | 579 | } |
580 | 580 | ||
581 | static void __exit s3c2410_rtc_exit(void) | 581 | static void __exit s3c2410_rtc_exit(void) |
582 | { | 582 | { |
583 | driver_unregister(&s3c2410_rtcdrv); | 583 | platform_driver_unregister(&s3c2410_rtcdrv); |
584 | } | 584 | } |
585 | 585 | ||
586 | module_init(s3c2410_rtc_init); | 586 | module_init(s3c2410_rtc_init); |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index d05067dcea01..51a07370e636 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -1168,7 +1168,7 @@ static int sonypi_disable(void) | |||
1168 | #ifdef CONFIG_PM | 1168 | #ifdef CONFIG_PM |
1169 | static int old_camera_power; | 1169 | static int old_camera_power; |
1170 | 1170 | ||
1171 | static int sonypi_suspend(struct device *dev, pm_message_t state) | 1171 | static int sonypi_suspend(struct platform_device *dev, pm_message_t state) |
1172 | { | 1172 | { |
1173 | old_camera_power = sonypi_device.camera_power; | 1173 | old_camera_power = sonypi_device.camera_power; |
1174 | sonypi_disable(); | 1174 | sonypi_disable(); |
@@ -1176,26 +1176,27 @@ static int sonypi_suspend(struct device *dev, pm_message_t state) | |||
1176 | return 0; | 1176 | return 0; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | static int sonypi_resume(struct device *dev) | 1179 | static int sonypi_resume(struct platform_device *dev) |
1180 | { | 1180 | { |
1181 | sonypi_enable(old_camera_power); | 1181 | sonypi_enable(old_camera_power); |
1182 | return 0; | 1182 | return 0; |
1183 | } | 1183 | } |
1184 | #endif | 1184 | #endif |
1185 | 1185 | ||
1186 | static void sonypi_shutdown(struct device *dev) | 1186 | static void sonypi_shutdown(struct platform_device *dev) |
1187 | { | 1187 | { |
1188 | sonypi_disable(); | 1188 | sonypi_disable(); |
1189 | } | 1189 | } |
1190 | 1190 | ||
1191 | static struct device_driver sonypi_driver = { | 1191 | static struct platform_driver sonypi_driver = { |
1192 | .name = "sonypi", | ||
1193 | .bus = &platform_bus_type, | ||
1194 | #ifdef CONFIG_PM | 1192 | #ifdef CONFIG_PM |
1195 | .suspend = sonypi_suspend, | 1193 | .suspend = sonypi_suspend, |
1196 | .resume = sonypi_resume, | 1194 | .resume = sonypi_resume, |
1197 | #endif | 1195 | #endif |
1198 | .shutdown = sonypi_shutdown, | 1196 | .shutdown = sonypi_shutdown, |
1197 | .driver = { | ||
1198 | .name = "sonypi", | ||
1199 | }, | ||
1199 | }; | 1200 | }; |
1200 | 1201 | ||
1201 | static int __devinit sonypi_create_input_devices(void) | 1202 | static int __devinit sonypi_create_input_devices(void) |
@@ -1455,20 +1456,20 @@ static int __init sonypi_init(void) | |||
1455 | if (!dmi_check_system(sonypi_dmi_table)) | 1456 | if (!dmi_check_system(sonypi_dmi_table)) |
1456 | return -ENODEV; | 1457 | return -ENODEV; |
1457 | 1458 | ||
1458 | ret = driver_register(&sonypi_driver); | 1459 | ret = platform_driver_register(&sonypi_driver); |
1459 | if (ret) | 1460 | if (ret) |
1460 | return ret; | 1461 | return ret; |
1461 | 1462 | ||
1462 | ret = sonypi_probe(); | 1463 | ret = sonypi_probe(); |
1463 | if (ret) | 1464 | if (ret) |
1464 | driver_unregister(&sonypi_driver); | 1465 | platform_driver_unregister(&sonypi_driver); |
1465 | 1466 | ||
1466 | return ret; | 1467 | return ret; |
1467 | } | 1468 | } |
1468 | 1469 | ||
1469 | static void __exit sonypi_exit(void) | 1470 | static void __exit sonypi_exit(void) |
1470 | { | 1471 | { |
1471 | driver_unregister(&sonypi_driver); | 1472 | platform_driver_unregister(&sonypi_driver); |
1472 | sonypi_remove(); | 1473 | sonypi_remove(); |
1473 | } | 1474 | } |
1474 | 1475 | ||
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 5d1ffa3bd4c3..82c6abde68df 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -912,7 +912,6 @@ MODULE_DEVICE_TABLE(pci, synclink_pci_tbl); | |||
912 | MODULE_LICENSE("GPL"); | 912 | MODULE_LICENSE("GPL"); |
913 | 913 | ||
914 | static struct pci_driver synclink_pci_driver = { | 914 | static struct pci_driver synclink_pci_driver = { |
915 | .owner = THIS_MODULE, | ||
916 | .name = "synclink", | 915 | .name = "synclink", |
917 | .id_table = synclink_pci_tbl, | 916 | .id_table = synclink_pci_tbl, |
918 | .probe = synclink_init_one, | 917 | .probe = synclink_init_one, |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 7c063c5abc55..ee5a40be9f99 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -500,7 +500,6 @@ MODULE_DEVICE_TABLE(pci, synclinkmp_pci_tbl); | |||
500 | MODULE_LICENSE("GPL"); | 500 | MODULE_LICENSE("GPL"); |
501 | 501 | ||
502 | static struct pci_driver synclinkmp_pci_driver = { | 502 | static struct pci_driver synclinkmp_pci_driver = { |
503 | .owner = THIS_MODULE, | ||
504 | .name = "synclinkmp", | 503 | .name = "synclinkmp", |
505 | .id_table = synclinkmp_pci_tbl, | 504 | .id_table = synclinkmp_pci_tbl, |
506 | .probe = synclinkmp_init_one, | 505 | .probe = synclinkmp_init_one, |
diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c index 24355b23b2ca..b3d411a756fe 100644 --- a/drivers/char/tb0219.c +++ b/drivers/char/tb0219.c | |||
@@ -283,7 +283,7 @@ static void tb0219_pci_irq_init(void) | |||
283 | vr41xx_set_irq_level(TB0219_PCI_SLOT3_PIN, IRQ_LEVEL_LOW); | 283 | vr41xx_set_irq_level(TB0219_PCI_SLOT3_PIN, IRQ_LEVEL_LOW); |
284 | } | 284 | } |
285 | 285 | ||
286 | static int tb0219_probe(struct device *dev) | 286 | static int tb0219_probe(struct platform_device *dev) |
287 | { | 287 | { |
288 | int retval; | 288 | int retval; |
289 | 289 | ||
@@ -319,7 +319,7 @@ static int tb0219_probe(struct device *dev) | |||
319 | return 0; | 319 | return 0; |
320 | } | 320 | } |
321 | 321 | ||
322 | static int tb0219_remove(struct device *dev) | 322 | static int tb0219_remove(struct platform_device *dev) |
323 | { | 323 | { |
324 | _machine_restart = old_machine_restart; | 324 | _machine_restart = old_machine_restart; |
325 | 325 | ||
@@ -333,11 +333,12 @@ static int tb0219_remove(struct device *dev) | |||
333 | 333 | ||
334 | static struct platform_device *tb0219_platform_device; | 334 | static struct platform_device *tb0219_platform_device; |
335 | 335 | ||
336 | static struct device_driver tb0219_device_driver = { | 336 | static struct platform_driver tb0219_device_driver = { |
337 | .name = "TB0219", | ||
338 | .bus = &platform_bus_type, | ||
339 | .probe = tb0219_probe, | 337 | .probe = tb0219_probe, |
340 | .remove = tb0219_remove, | 338 | .remove = tb0219_remove, |
339 | .driver = { | ||
340 | .name = "TB0219", | ||
341 | }, | ||
341 | }; | 342 | }; |
342 | 343 | ||
343 | static int __devinit tanbac_tb0219_init(void) | 344 | static int __devinit tanbac_tb0219_init(void) |
@@ -348,7 +349,7 @@ static int __devinit tanbac_tb0219_init(void) | |||
348 | if (IS_ERR(tb0219_platform_device)) | 349 | if (IS_ERR(tb0219_platform_device)) |
349 | return PTR_ERR(tb0219_platform_device); | 350 | return PTR_ERR(tb0219_platform_device); |
350 | 351 | ||
351 | retval = driver_register(&tb0219_device_driver); | 352 | retval = platform_driver_register(&tb0219_device_driver); |
352 | if (retval < 0) | 353 | if (retval < 0) |
353 | platform_device_unregister(tb0219_platform_device); | 354 | platform_device_unregister(tb0219_platform_device); |
354 | 355 | ||
@@ -357,7 +358,7 @@ static int __devinit tanbac_tb0219_init(void) | |||
357 | 358 | ||
358 | static void __devexit tanbac_tb0219_exit(void) | 359 | static void __devexit tanbac_tb0219_exit(void) |
359 | { | 360 | { |
360 | driver_unregister(&tb0219_device_driver); | 361 | platform_driver_unregister(&tb0219_device_driver); |
361 | 362 | ||
362 | platform_device_unregister(tb0219_platform_device); | 363 | platform_device_unregister(tb0219_platform_device); |
363 | } | 364 | } |
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c index 94641085faf8..9ac6d43437b3 100644 --- a/drivers/char/vr41xx_giu.c +++ b/drivers/char/vr41xx_giu.c | |||
@@ -613,7 +613,7 @@ static struct file_operations gpio_fops = { | |||
613 | .release = gpio_release, | 613 | .release = gpio_release, |
614 | }; | 614 | }; |
615 | 615 | ||
616 | static int giu_probe(struct device *dev) | 616 | static int giu_probe(struct platform_device *dev) |
617 | { | 617 | { |
618 | unsigned long start, size, flags = 0; | 618 | unsigned long start, size, flags = 0; |
619 | unsigned int nr_pins = 0; | 619 | unsigned int nr_pins = 0; |
@@ -697,7 +697,7 @@ static int giu_probe(struct device *dev) | |||
697 | return cascade_irq(GIUINT_IRQ, giu_get_irq); | 697 | return cascade_irq(GIUINT_IRQ, giu_get_irq); |
698 | } | 698 | } |
699 | 699 | ||
700 | static int giu_remove(struct device *dev) | 700 | static int giu_remove(struct platform_device *dev) |
701 | { | 701 | { |
702 | iounmap(giu_base); | 702 | iounmap(giu_base); |
703 | 703 | ||
@@ -710,11 +710,12 @@ static int giu_remove(struct device *dev) | |||
710 | 710 | ||
711 | static struct platform_device *giu_platform_device; | 711 | static struct platform_device *giu_platform_device; |
712 | 712 | ||
713 | static struct device_driver giu_device_driver = { | 713 | static struct platform_driver giu_device_driver = { |
714 | .name = "GIU", | ||
715 | .bus = &platform_bus_type, | ||
716 | .probe = giu_probe, | 714 | .probe = giu_probe, |
717 | .remove = giu_remove, | 715 | .remove = giu_remove, |
716 | .driver = { | ||
717 | .name = "GIU", | ||
718 | }, | ||
718 | }; | 719 | }; |
719 | 720 | ||
720 | static int __devinit vr41xx_giu_init(void) | 721 | static int __devinit vr41xx_giu_init(void) |
@@ -725,7 +726,7 @@ static int __devinit vr41xx_giu_init(void) | |||
725 | if (IS_ERR(giu_platform_device)) | 726 | if (IS_ERR(giu_platform_device)) |
726 | return PTR_ERR(giu_platform_device); | 727 | return PTR_ERR(giu_platform_device); |
727 | 728 | ||
728 | retval = driver_register(&giu_device_driver); | 729 | retval = platform_driver_register(&giu_device_driver); |
729 | if (retval < 0) | 730 | if (retval < 0) |
730 | platform_device_unregister(giu_platform_device); | 731 | platform_device_unregister(giu_platform_device); |
731 | 732 | ||
@@ -734,7 +735,7 @@ static int __devinit vr41xx_giu_init(void) | |||
734 | 735 | ||
735 | static void __devexit vr41xx_giu_exit(void) | 736 | static void __devexit vr41xx_giu_exit(void) |
736 | { | 737 | { |
737 | driver_unregister(&giu_device_driver); | 738 | platform_driver_unregister(&giu_device_driver); |
738 | 739 | ||
739 | platform_device_unregister(giu_platform_device); | 740 | platform_device_unregister(giu_platform_device); |
740 | } | 741 | } |
diff --git a/drivers/char/vr41xx_rtc.c b/drivers/char/vr41xx_rtc.c index 5e3292df69d8..435b30748e23 100644 --- a/drivers/char/vr41xx_rtc.c +++ b/drivers/char/vr41xx_rtc.c | |||
@@ -560,13 +560,11 @@ static struct miscdevice rtc_miscdevice = { | |||
560 | .fops = &rtc_fops, | 560 | .fops = &rtc_fops, |
561 | }; | 561 | }; |
562 | 562 | ||
563 | static int rtc_probe(struct device *dev) | 563 | static int rtc_probe(struct platform_device *pdev) |
564 | { | 564 | { |
565 | struct platform_device *pdev; | ||
566 | unsigned int irq; | 565 | unsigned int irq; |
567 | int retval; | 566 | int retval; |
568 | 567 | ||
569 | pdev = to_platform_device(dev); | ||
570 | if (pdev->num_resources != 2) | 568 | if (pdev->num_resources != 2) |
571 | return -EBUSY; | 569 | return -EBUSY; |
572 | 570 | ||
@@ -635,7 +633,7 @@ static int rtc_probe(struct device *dev) | |||
635 | return 0; | 633 | return 0; |
636 | } | 634 | } |
637 | 635 | ||
638 | static int rtc_remove(struct device *dev) | 636 | static int rtc_remove(struct platform_device *dev) |
639 | { | 637 | { |
640 | int retval; | 638 | int retval; |
641 | 639 | ||
@@ -655,11 +653,12 @@ static int rtc_remove(struct device *dev) | |||
655 | 653 | ||
656 | static struct platform_device *rtc_platform_device; | 654 | static struct platform_device *rtc_platform_device; |
657 | 655 | ||
658 | static struct device_driver rtc_device_driver = { | 656 | static struct platform_driver rtc_device_driver = { |
659 | .name = rtc_name, | ||
660 | .bus = &platform_bus_type, | ||
661 | .probe = rtc_probe, | 657 | .probe = rtc_probe, |
662 | .remove = rtc_remove, | 658 | .remove = rtc_remove, |
659 | .driver = { | ||
660 | .name = rtc_name, | ||
661 | }, | ||
663 | }; | 662 | }; |
664 | 663 | ||
665 | static int __devinit vr41xx_rtc_init(void) | 664 | static int __devinit vr41xx_rtc_init(void) |
@@ -691,7 +690,7 @@ static int __devinit vr41xx_rtc_init(void) | |||
691 | if (IS_ERR(rtc_platform_device)) | 690 | if (IS_ERR(rtc_platform_device)) |
692 | return PTR_ERR(rtc_platform_device); | 691 | return PTR_ERR(rtc_platform_device); |
693 | 692 | ||
694 | retval = driver_register(&rtc_device_driver); | 693 | retval = platform_driver_register(&rtc_device_driver); |
695 | if (retval < 0) | 694 | if (retval < 0) |
696 | platform_device_unregister(rtc_platform_device); | 695 | platform_device_unregister(rtc_platform_device); |
697 | 696 | ||
@@ -700,7 +699,7 @@ static int __devinit vr41xx_rtc_init(void) | |||
700 | 699 | ||
701 | static void __devexit vr41xx_rtc_exit(void) | 700 | static void __devexit vr41xx_rtc_exit(void) |
702 | { | 701 | { |
703 | driver_unregister(&rtc_device_driver); | 702 | platform_driver_unregister(&rtc_device_driver); |
704 | 703 | ||
705 | platform_device_unregister(rtc_platform_device); | 704 | platform_device_unregister(rtc_platform_device); |
706 | } | 705 | } |
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c index da631c114fd1..9defcf861b67 100644 --- a/drivers/char/watchdog/mpcore_wdt.c +++ b/drivers/char/watchdog/mpcore_wdt.c | |||
@@ -139,7 +139,7 @@ static int mpcore_wdt_set_heartbeat(int t) | |||
139 | */ | 139 | */ |
140 | static int mpcore_wdt_open(struct inode *inode, struct file *file) | 140 | static int mpcore_wdt_open(struct inode *inode, struct file *file) |
141 | { | 141 | { |
142 | struct mpcore_wdt *wdt = dev_get_drvdata(&mpcore_wdt_dev->dev); | 142 | struct mpcore_wdt *wdt = platform_get_drvdata(mpcore_wdt_dev); |
143 | 143 | ||
144 | if (test_and_set_bit(0, &wdt->timer_alive)) | 144 | if (test_and_set_bit(0, &wdt->timer_alive)) |
145 | return -EBUSY; | 145 | return -EBUSY; |
@@ -291,9 +291,9 @@ static int mpcore_wdt_ioctl(struct inode *inode, struct file *file, | |||
291 | * System shutdown handler. Turn off the watchdog if we're | 291 | * System shutdown handler. Turn off the watchdog if we're |
292 | * restarting or halting the system. | 292 | * restarting or halting the system. |
293 | */ | 293 | */ |
294 | static void mpcore_wdt_shutdown(struct device *_dev) | 294 | static void mpcore_wdt_shutdown(struct platform_device *dev) |
295 | { | 295 | { |
296 | struct mpcore_wdt *wdt = dev_get_drvdata(_dev); | 296 | struct mpcore_wdt *wdt = platform_get_drvdata(dev); |
297 | 297 | ||
298 | if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT) | 298 | if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT) |
299 | mpcore_wdt_stop(wdt); | 299 | mpcore_wdt_stop(wdt); |
@@ -317,9 +317,8 @@ static struct miscdevice mpcore_wdt_miscdev = { | |||
317 | .fops = &mpcore_wdt_fops, | 317 | .fops = &mpcore_wdt_fops, |
318 | }; | 318 | }; |
319 | 319 | ||
320 | static int __devinit mpcore_wdt_probe(struct device *_dev) | 320 | static int __devinit mpcore_wdt_probe(struct platform_device *dev) |
321 | { | 321 | { |
322 | struct platform_device *dev = to_platform_device(_dev); | ||
323 | struct mpcore_wdt *wdt; | 322 | struct mpcore_wdt *wdt; |
324 | struct resource *res; | 323 | struct resource *res; |
325 | int ret; | 324 | int ret; |
@@ -364,7 +363,7 @@ static int __devinit mpcore_wdt_probe(struct device *_dev) | |||
364 | } | 363 | } |
365 | 364 | ||
366 | mpcore_wdt_stop(wdt); | 365 | mpcore_wdt_stop(wdt); |
367 | dev_set_drvdata(&dev->dev, wdt); | 366 | platform_set_drvdata(&dev->dev, wdt); |
368 | mpcore_wdt_dev = dev; | 367 | mpcore_wdt_dev = dev; |
369 | 368 | ||
370 | return 0; | 369 | return 0; |
@@ -379,11 +378,11 @@ static int __devinit mpcore_wdt_probe(struct device *_dev) | |||
379 | return ret; | 378 | return ret; |
380 | } | 379 | } |
381 | 380 | ||
382 | static int __devexit mpcore_wdt_remove(struct device *dev) | 381 | static int __devexit mpcore_wdt_remove(struct platform_device *dev) |
383 | { | 382 | { |
384 | struct mpcore_wdt *wdt = dev_get_drvdata(dev); | 383 | struct mpcore_wdt *wdt = platform_get_drvdata(dev); |
385 | 384 | ||
386 | dev_set_drvdata(dev, NULL); | 385 | platform_set_drvdata(dev, NULL); |
387 | 386 | ||
388 | misc_deregister(&mpcore_wdt_miscdev); | 387 | misc_deregister(&mpcore_wdt_miscdev); |
389 | 388 | ||
@@ -395,13 +394,14 @@ static int __devexit mpcore_wdt_remove(struct device *dev) | |||
395 | return 0; | 394 | return 0; |
396 | } | 395 | } |
397 | 396 | ||
398 | static struct device_driver mpcore_wdt_driver = { | 397 | static struct platform_driver mpcore_wdt_driver = { |
399 | .owner = THIS_MODULE, | ||
400 | .name = "mpcore_wdt", | ||
401 | .bus = &platform_bus_type, | ||
402 | .probe = mpcore_wdt_probe, | 398 | .probe = mpcore_wdt_probe, |
403 | .remove = __devexit_p(mpcore_wdt_remove), | 399 | .remove = __devexit_p(mpcore_wdt_remove), |
404 | .shutdown = mpcore_wdt_shutdown, | 400 | .shutdown = mpcore_wdt_shutdown, |
401 | .driver = { | ||
402 | .owner = THIS_MODULE, | ||
403 | .name = "mpcore_wdt", | ||
404 | }, | ||
405 | }; | 405 | }; |
406 | 406 | ||
407 | static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n"; | 407 | static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n"; |
@@ -420,12 +420,12 @@ static int __init mpcore_wdt_init(void) | |||
420 | 420 | ||
421 | printk(banner, mpcore_noboot, mpcore_margin, nowayout); | 421 | printk(banner, mpcore_noboot, mpcore_margin, nowayout); |
422 | 422 | ||
423 | return driver_register(&mpcore_wdt_driver); | 423 | return platform_driver_register(&mpcore_wdt_driver); |
424 | } | 424 | } |
425 | 425 | ||
426 | static void __exit mpcore_wdt_exit(void) | 426 | static void __exit mpcore_wdt_exit(void) |
427 | { | 427 | { |
428 | driver_unregister(&mpcore_wdt_driver); | 428 | platform_driver_unregister(&mpcore_wdt_driver); |
429 | } | 429 | } |
430 | 430 | ||
431 | module_init(mpcore_wdt_init); | 431 | module_init(mpcore_wdt_init); |
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c index 119b3c541d95..00d9ef04a369 100644 --- a/drivers/char/watchdog/mv64x60_wdt.c +++ b/drivers/char/watchdog/mv64x60_wdt.c | |||
@@ -182,10 +182,9 @@ static struct miscdevice mv64x60_wdt_miscdev = { | |||
182 | .fops = &mv64x60_wdt_fops, | 182 | .fops = &mv64x60_wdt_fops, |
183 | }; | 183 | }; |
184 | 184 | ||
185 | static int __devinit mv64x60_wdt_probe(struct device *dev) | 185 | static int __devinit mv64x60_wdt_probe(struct platform_device *dev) |
186 | { | 186 | { |
187 | struct platform_device *pd = to_platform_device(dev); | 187 | struct mv64x60_wdt_pdata *pdata = dev->dev.platform_data; |
188 | struct mv64x60_wdt_pdata *pdata = pd->dev.platform_data; | ||
189 | int bus_clk = 133; | 188 | int bus_clk = 133; |
190 | 189 | ||
191 | mv64x60_wdt_timeout = 10; | 190 | mv64x60_wdt_timeout = 10; |
@@ -202,7 +201,7 @@ static int __devinit mv64x60_wdt_probe(struct device *dev) | |||
202 | return misc_register(&mv64x60_wdt_miscdev); | 201 | return misc_register(&mv64x60_wdt_miscdev); |
203 | } | 202 | } |
204 | 203 | ||
205 | static int __devexit mv64x60_wdt_remove(struct device *dev) | 204 | static int __devexit mv64x60_wdt_remove(struct platform_device *dev) |
206 | { | 205 | { |
207 | misc_deregister(&mv64x60_wdt_miscdev); | 206 | misc_deregister(&mv64x60_wdt_miscdev); |
208 | 207 | ||
@@ -212,12 +211,13 @@ static int __devexit mv64x60_wdt_remove(struct device *dev) | |||
212 | return 0; | 211 | return 0; |
213 | } | 212 | } |
214 | 213 | ||
215 | static struct device_driver mv64x60_wdt_driver = { | 214 | static struct platform_driver mv64x60_wdt_driver = { |
216 | .owner = THIS_MODULE, | ||
217 | .name = MV64x60_WDT_NAME, | ||
218 | .bus = &platform_bus_type, | ||
219 | .probe = mv64x60_wdt_probe, | 215 | .probe = mv64x60_wdt_probe, |
220 | .remove = __devexit_p(mv64x60_wdt_remove), | 216 | .remove = __devexit_p(mv64x60_wdt_remove), |
217 | .driver = { | ||
218 | .owner = THIS_MODULE, | ||
219 | .name = MV64x60_WDT_NAME, | ||
220 | }, | ||
221 | }; | 221 | }; |
222 | 222 | ||
223 | static struct platform_device *mv64x60_wdt_dev; | 223 | static struct platform_device *mv64x60_wdt_dev; |
@@ -235,14 +235,14 @@ static int __init mv64x60_wdt_init(void) | |||
235 | goto out; | 235 | goto out; |
236 | } | 236 | } |
237 | 237 | ||
238 | ret = driver_register(&mv64x60_wdt_driver); | 238 | ret = platform_driver_register(&mv64x60_wdt_driver); |
239 | out: | 239 | out: |
240 | return ret; | 240 | return ret; |
241 | } | 241 | } |
242 | 242 | ||
243 | static void __exit mv64x60_wdt_exit(void) | 243 | static void __exit mv64x60_wdt_exit(void) |
244 | { | 244 | { |
245 | driver_unregister(&mv64x60_wdt_driver); | 245 | platform_driver_unregister(&mv64x60_wdt_driver); |
246 | platform_device_unregister(mv64x60_wdt_dev); | 246 | platform_device_unregister(mv64x60_wdt_dev); |
247 | } | 247 | } |
248 | 248 | ||
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c index d9ef55bdf88a..2451edbefece 100644 --- a/drivers/char/watchdog/pcwd_pci.c +++ b/drivers/char/watchdog/pcwd_pci.c | |||
@@ -755,7 +755,6 @@ static struct pci_device_id pcipcwd_pci_tbl[] = { | |||
755 | MODULE_DEVICE_TABLE(pci, pcipcwd_pci_tbl); | 755 | MODULE_DEVICE_TABLE(pci, pcipcwd_pci_tbl); |
756 | 756 | ||
757 | static struct pci_driver pcipcwd_driver = { | 757 | static struct pci_driver pcipcwd_driver = { |
758 | .owner = THIS_MODULE, | ||
759 | .name = WATCHDOG_NAME, | 758 | .name = WATCHDOG_NAME, |
760 | .id_table = pcipcwd_pci_tbl, | 759 | .id_table = pcipcwd_pci_tbl, |
761 | .probe = pcipcwd_card_init, | 760 | .probe = pcipcwd_card_init, |
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c index 751cb77b0715..eb667daee19b 100644 --- a/drivers/char/watchdog/s3c2410_wdt.c +++ b/drivers/char/watchdog/s3c2410_wdt.c | |||
@@ -347,15 +347,14 @@ static irqreturn_t s3c2410wdt_irq(int irqno, void *param, | |||
347 | } | 347 | } |
348 | /* device interface */ | 348 | /* device interface */ |
349 | 349 | ||
350 | static int s3c2410wdt_probe(struct device *dev) | 350 | static int s3c2410wdt_probe(struct platform_device *pdev) |
351 | { | 351 | { |
352 | struct platform_device *pdev = to_platform_device(dev); | ||
353 | struct resource *res; | 352 | struct resource *res; |
354 | int started = 0; | 353 | int started = 0; |
355 | int ret; | 354 | int ret; |
356 | int size; | 355 | int size; |
357 | 356 | ||
358 | DBG("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev); | 357 | DBG("%s: probe=%p\n", __FUNCTION__, pdev); |
359 | 358 | ||
360 | /* get the memory region for the watchdog timer */ | 359 | /* get the memory region for the watchdog timer */ |
361 | 360 | ||
@@ -386,13 +385,13 @@ static int s3c2410wdt_probe(struct device *dev) | |||
386 | return -ENOENT; | 385 | return -ENOENT; |
387 | } | 386 | } |
388 | 387 | ||
389 | ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, dev); | 388 | ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, pdev); |
390 | if (ret != 0) { | 389 | if (ret != 0) { |
391 | printk(KERN_INFO PFX "failed to install irq (%d)\n", ret); | 390 | printk(KERN_INFO PFX "failed to install irq (%d)\n", ret); |
392 | return ret; | 391 | return ret; |
393 | } | 392 | } |
394 | 393 | ||
395 | wdt_clock = clk_get(dev, "watchdog"); | 394 | wdt_clock = clk_get(&pdev->dev, "watchdog"); |
396 | if (wdt_clock == NULL) { | 395 | if (wdt_clock == NULL) { |
397 | printk(KERN_INFO PFX "failed to find watchdog clock source\n"); | 396 | printk(KERN_INFO PFX "failed to find watchdog clock source\n"); |
398 | return -ENOENT; | 397 | return -ENOENT; |
@@ -430,7 +429,7 @@ static int s3c2410wdt_probe(struct device *dev) | |||
430 | return 0; | 429 | return 0; |
431 | } | 430 | } |
432 | 431 | ||
433 | static int s3c2410wdt_remove(struct device *dev) | 432 | static int s3c2410wdt_remove(struct platform_device *dev) |
434 | { | 433 | { |
435 | if (wdt_mem != NULL) { | 434 | if (wdt_mem != NULL) { |
436 | release_resource(wdt_mem); | 435 | release_resource(wdt_mem); |
@@ -454,7 +453,7 @@ static int s3c2410wdt_remove(struct device *dev) | |||
454 | return 0; | 453 | return 0; |
455 | } | 454 | } |
456 | 455 | ||
457 | static void s3c2410wdt_shutdown(struct device *dev) | 456 | static void s3c2410wdt_shutdown(struct platform_device *dev) |
458 | { | 457 | { |
459 | s3c2410wdt_stop(); | 458 | s3c2410wdt_stop(); |
460 | } | 459 | } |
@@ -464,7 +463,7 @@ static void s3c2410wdt_shutdown(struct device *dev) | |||
464 | static unsigned long wtcon_save; | 463 | static unsigned long wtcon_save; |
465 | static unsigned long wtdat_save; | 464 | static unsigned long wtdat_save; |
466 | 465 | ||
467 | static int s3c2410wdt_suspend(struct device *dev, pm_message_t state) | 466 | static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state) |
468 | { | 467 | { |
469 | /* Save watchdog state, and turn it off. */ | 468 | /* Save watchdog state, and turn it off. */ |
470 | wtcon_save = readl(wdt_base + S3C2410_WTCON); | 469 | wtcon_save = readl(wdt_base + S3C2410_WTCON); |
@@ -476,7 +475,7 @@ static int s3c2410wdt_suspend(struct device *dev, pm_message_t state) | |||
476 | return 0; | 475 | return 0; |
477 | } | 476 | } |
478 | 477 | ||
479 | static int s3c2410wdt_resume(struct device *dev) | 478 | static int s3c2410wdt_resume(struct platform_device *dev) |
480 | { | 479 | { |
481 | /* Restore watchdog state. */ | 480 | /* Restore watchdog state. */ |
482 | 481 | ||
@@ -496,15 +495,16 @@ static int s3c2410wdt_resume(struct device *dev) | |||
496 | #endif /* CONFIG_PM */ | 495 | #endif /* CONFIG_PM */ |
497 | 496 | ||
498 | 497 | ||
499 | static struct device_driver s3c2410wdt_driver = { | 498 | static struct platform_driver s3c2410wdt_driver = { |
500 | .owner = THIS_MODULE, | ||
501 | .name = "s3c2410-wdt", | ||
502 | .bus = &platform_bus_type, | ||
503 | .probe = s3c2410wdt_probe, | 499 | .probe = s3c2410wdt_probe, |
504 | .remove = s3c2410wdt_remove, | 500 | .remove = s3c2410wdt_remove, |
505 | .shutdown = s3c2410wdt_shutdown, | 501 | .shutdown = s3c2410wdt_shutdown, |
506 | .suspend = s3c2410wdt_suspend, | 502 | .suspend = s3c2410wdt_suspend, |
507 | .resume = s3c2410wdt_resume, | 503 | .resume = s3c2410wdt_resume, |
504 | .driver = { | ||
505 | .owner = THIS_MODULE, | ||
506 | .name = "s3c2410-wdt", | ||
507 | }, | ||
508 | }; | 508 | }; |
509 | 509 | ||
510 | 510 | ||
@@ -513,12 +513,12 @@ static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Si | |||
513 | static int __init watchdog_init(void) | 513 | static int __init watchdog_init(void) |
514 | { | 514 | { |
515 | printk(banner); | 515 | printk(banner); |
516 | return driver_register(&s3c2410wdt_driver); | 516 | return platform_driver_register(&s3c2410wdt_driver); |
517 | } | 517 | } |
518 | 518 | ||
519 | static void __exit watchdog_exit(void) | 519 | static void __exit watchdog_exit(void) |
520 | { | 520 | { |
521 | driver_unregister(&s3c2410wdt_driver); | 521 | platform_driver_unregister(&s3c2410wdt_driver); |
522 | } | 522 | } |
523 | 523 | ||
524 | module_init(watchdog_init); | 524 | module_init(watchdog_init); |
diff --git a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c index dc9370f6c348..4b3311993d48 100644 --- a/drivers/char/watchdog/wdt_pci.c +++ b/drivers/char/watchdog/wdt_pci.c | |||
@@ -711,7 +711,6 @@ MODULE_DEVICE_TABLE(pci, wdtpci_pci_tbl); | |||
711 | 711 | ||
712 | 712 | ||
713 | static struct pci_driver wdtpci_driver = { | 713 | static struct pci_driver wdtpci_driver = { |
714 | .owner = THIS_MODULE, | ||
715 | .name = "wdt_pci", | 714 | .name = "wdt_pci", |
716 | .id_table = wdtpci_pci_tbl, | 715 | .id_table = wdtpci_pci_tbl, |
717 | .probe = wdtpci_init_one, | 716 | .probe = wdtpci_init_one, |
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c index 1e5dfc7805e2..c81bd4bce1b8 100644 --- a/drivers/hwmon/hdaps.c +++ b/drivers/hwmon/hdaps.c | |||
@@ -60,9 +60,11 @@ | |||
60 | 60 | ||
61 | #define HDAPS_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */ | 61 | #define HDAPS_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */ |
62 | #define HDAPS_INPUT_FUZZ 4 /* input event threshold */ | 62 | #define HDAPS_INPUT_FUZZ 4 /* input event threshold */ |
63 | #define HDAPS_INPUT_FLAT 4 | ||
63 | 64 | ||
64 | static struct timer_list hdaps_timer; | 65 | static struct timer_list hdaps_timer; |
65 | static struct platform_device *pdev; | 66 | static struct platform_device *pdev; |
67 | static struct input_dev *hdaps_idev; | ||
66 | static unsigned int hdaps_invert; | 68 | static unsigned int hdaps_invert; |
67 | static u8 km_activity; | 69 | static u8 km_activity; |
68 | static int rest_x; | 70 | static int rest_x; |
@@ -284,7 +286,7 @@ out: | |||
284 | 286 | ||
285 | /* Device model stuff */ | 287 | /* Device model stuff */ |
286 | 288 | ||
287 | static int hdaps_probe(struct device *dev) | 289 | static int hdaps_probe(struct platform_device *dev) |
288 | { | 290 | { |
289 | int ret; | 291 | int ret; |
290 | 292 | ||
@@ -296,29 +298,18 @@ static int hdaps_probe(struct device *dev) | |||
296 | return 0; | 298 | return 0; |
297 | } | 299 | } |
298 | 300 | ||
299 | static int hdaps_resume(struct device *dev) | 301 | static int hdaps_resume(struct platform_device *dev) |
300 | { | 302 | { |
301 | return hdaps_device_init(); | 303 | return hdaps_device_init(); |
302 | } | 304 | } |
303 | 305 | ||
304 | static struct device_driver hdaps_driver = { | 306 | static struct platform_driver hdaps_driver = { |
305 | .name = "hdaps", | ||
306 | .bus = &platform_bus_type, | ||
307 | .owner = THIS_MODULE, | ||
308 | .probe = hdaps_probe, | 307 | .probe = hdaps_probe, |
309 | .resume = hdaps_resume | 308 | .resume = hdaps_resume, |
310 | }; | 309 | .driver = { |
311 | 310 | .name = "hdaps", | |
312 | /* Input class stuff */ | 311 | .owner = THIS_MODULE, |
313 | 312 | }, | |
314 | static struct input_dev hdaps_idev = { | ||
315 | .name = "hdaps", | ||
316 | .evbit = { BIT(EV_ABS) }, | ||
317 | .absbit = { BIT(ABS_X) | BIT(ABS_Y) }, | ||
318 | .absmin = { [ABS_X] = -256, [ABS_Y] = -256 }, | ||
319 | .absmax = { [ABS_X] = 256, [ABS_Y] = 256 }, | ||
320 | .absfuzz = { [ABS_X] = HDAPS_INPUT_FUZZ, [ABS_Y] = HDAPS_INPUT_FUZZ }, | ||
321 | .absflat = { [ABS_X] = HDAPS_INPUT_FUZZ, [ABS_Y] = HDAPS_INPUT_FUZZ }, | ||
322 | }; | 313 | }; |
323 | 314 | ||
324 | /* | 315 | /* |
@@ -342,9 +333,9 @@ static void hdaps_mousedev_poll(unsigned long unused) | |||
342 | if (__hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y)) | 333 | if (__hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y)) |
343 | goto out; | 334 | goto out; |
344 | 335 | ||
345 | input_report_abs(&hdaps_idev, ABS_X, x - rest_x); | 336 | input_report_abs(hdaps_idev, ABS_X, x - rest_x); |
346 | input_report_abs(&hdaps_idev, ABS_Y, y - rest_y); | 337 | input_report_abs(hdaps_idev, ABS_Y, y - rest_y); |
347 | input_sync(&hdaps_idev); | 338 | input_sync(hdaps_idev); |
348 | 339 | ||
349 | mod_timer(&hdaps_timer, jiffies + HDAPS_POLL_PERIOD); | 340 | mod_timer(&hdaps_timer, jiffies + HDAPS_POLL_PERIOD); |
350 | 341 | ||
@@ -550,7 +541,7 @@ static int __init hdaps_init(void) | |||
550 | goto out; | 541 | goto out; |
551 | } | 542 | } |
552 | 543 | ||
553 | ret = driver_register(&hdaps_driver); | 544 | ret = platform_driver_register(&hdaps_driver); |
554 | if (ret) | 545 | if (ret) |
555 | goto out_region; | 546 | goto out_region; |
556 | 547 | ||
@@ -564,12 +555,25 @@ static int __init hdaps_init(void) | |||
564 | if (ret) | 555 | if (ret) |
565 | goto out_device; | 556 | goto out_device; |
566 | 557 | ||
558 | hdaps_idev = input_allocate_device(); | ||
559 | if (!hdaps_idev) { | ||
560 | ret = -ENOMEM; | ||
561 | goto out_group; | ||
562 | } | ||
563 | |||
567 | /* initial calibrate for the input device */ | 564 | /* initial calibrate for the input device */ |
568 | hdaps_calibrate(); | 565 | hdaps_calibrate(); |
569 | 566 | ||
570 | /* initialize the input class */ | 567 | /* initialize the input class */ |
571 | hdaps_idev.dev = &pdev->dev; | 568 | hdaps_idev->name = "hdaps"; |
572 | input_register_device(&hdaps_idev); | 569 | hdaps_idev->cdev.dev = &pdev->dev; |
570 | hdaps_idev->evbit[0] = BIT(EV_ABS); | ||
571 | input_set_abs_params(hdaps_idev, ABS_X, | ||
572 | -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); | ||
573 | input_set_abs_params(hdaps_idev, ABS_X, | ||
574 | -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); | ||
575 | |||
576 | input_register_device(hdaps_idev); | ||
573 | 577 | ||
574 | /* start up our timer for the input device */ | 578 | /* start up our timer for the input device */ |
575 | init_timer(&hdaps_timer); | 579 | init_timer(&hdaps_timer); |
@@ -580,10 +584,12 @@ static int __init hdaps_init(void) | |||
580 | printk(KERN_INFO "hdaps: driver successfully loaded.\n"); | 584 | printk(KERN_INFO "hdaps: driver successfully loaded.\n"); |
581 | return 0; | 585 | return 0; |
582 | 586 | ||
587 | out_group: | ||
588 | sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); | ||
583 | out_device: | 589 | out_device: |
584 | platform_device_unregister(pdev); | 590 | platform_device_unregister(pdev); |
585 | out_driver: | 591 | out_driver: |
586 | driver_unregister(&hdaps_driver); | 592 | platform_driver_unregister(&hdaps_driver); |
587 | out_region: | 593 | out_region: |
588 | release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); | 594 | release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); |
589 | out: | 595 | out: |
@@ -594,10 +600,10 @@ out: | |||
594 | static void __exit hdaps_exit(void) | 600 | static void __exit hdaps_exit(void) |
595 | { | 601 | { |
596 | del_timer_sync(&hdaps_timer); | 602 | del_timer_sync(&hdaps_timer); |
597 | input_unregister_device(&hdaps_idev); | 603 | input_unregister_device(hdaps_idev); |
598 | sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); | 604 | sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); |
599 | platform_device_unregister(pdev); | 605 | platform_device_unregister(pdev); |
600 | driver_unregister(&hdaps_driver); | 606 | platform_driver_unregister(&hdaps_driver); |
601 | release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); | 607 | release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); |
602 | 608 | ||
603 | printk(KERN_INFO "hdaps: driver unloaded.\n"); | 609 | printk(KERN_INFO "hdaps: driver unloaded.\n"); |
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c index ba90f5140af6..3eb47890db40 100644 --- a/drivers/i2c/busses/i2c-ali1535.c +++ b/drivers/i2c/busses/i2c-ali1535.c | |||
@@ -513,7 +513,6 @@ static void __devexit ali1535_remove(struct pci_dev *dev) | |||
513 | } | 513 | } |
514 | 514 | ||
515 | static struct pci_driver ali1535_driver = { | 515 | static struct pci_driver ali1535_driver = { |
516 | .owner = THIS_MODULE, | ||
517 | .name = "ali1535_smbus", | 516 | .name = "ali1535_smbus", |
518 | .id_table = ali1535_ids, | 517 | .id_table = ali1535_ids, |
519 | .probe = ali1535_probe, | 518 | .probe = ali1535_probe, |
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c index f1a62d892425..e6f63208fc4a 100644 --- a/drivers/i2c/busses/i2c-ali1563.c +++ b/drivers/i2c/busses/i2c-ali1563.c | |||
@@ -408,7 +408,6 @@ static struct pci_device_id __devinitdata ali1563_id_table[] = { | |||
408 | MODULE_DEVICE_TABLE (pci, ali1563_id_table); | 408 | MODULE_DEVICE_TABLE (pci, ali1563_id_table); |
409 | 409 | ||
410 | static struct pci_driver ali1563_pci_driver = { | 410 | static struct pci_driver ali1563_pci_driver = { |
411 | .owner = THIS_MODULE, | ||
412 | .name = "ali1563_smbus", | 411 | .name = "ali1563_smbus", |
413 | .id_table = ali1563_id_table, | 412 | .id_table = ali1563_id_table, |
414 | .probe = ali1563_probe, | 413 | .probe = ali1563_probe, |
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c index 400b08ed4299..7a5c0941dbc1 100644 --- a/drivers/i2c/busses/i2c-ali15x3.c +++ b/drivers/i2c/busses/i2c-ali15x3.c | |||
@@ -504,7 +504,6 @@ static void __devexit ali15x3_remove(struct pci_dev *dev) | |||
504 | } | 504 | } |
505 | 505 | ||
506 | static struct pci_driver ali15x3_driver = { | 506 | static struct pci_driver ali15x3_driver = { |
507 | .owner = THIS_MODULE, | ||
508 | .name = "ali15x3_smbus", | 507 | .name = "ali15x3_smbus", |
509 | .id_table = ali15x3_ids, | 508 | .id_table = ali15x3_ids, |
510 | .probe = ali15x3_probe, | 509 | .probe = ali15x3_probe, |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index de035d137c3f..1750dedaf4b5 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -401,7 +401,6 @@ static void __devexit amd756_remove(struct pci_dev *dev) | |||
401 | } | 401 | } |
402 | 402 | ||
403 | static struct pci_driver amd756_driver = { | 403 | static struct pci_driver amd756_driver = { |
404 | .owner = THIS_MODULE, | ||
405 | .name = "amd756_smbus", | 404 | .name = "amd756_smbus", |
406 | .id_table = amd756_ids, | 405 | .id_table = amd756_ids, |
407 | .probe = amd756_probe, | 406 | .probe = amd756_probe, |
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c index f3b79a68dbec..e5ef560e686a 100644 --- a/drivers/i2c/busses/i2c-amd8111.c +++ b/drivers/i2c/busses/i2c-amd8111.c | |||
@@ -384,7 +384,6 @@ static void __devexit amd8111_remove(struct pci_dev *dev) | |||
384 | } | 384 | } |
385 | 385 | ||
386 | static struct pci_driver amd8111_driver = { | 386 | static struct pci_driver amd8111_driver = { |
387 | .owner = THIS_MODULE, | ||
388 | .name = "amd8111_smbus2", | 387 | .name = "amd8111_smbus2", |
389 | .id_table = amd8111_ids, | 388 | .id_table = amd8111_ids, |
390 | .probe = amd8111_probe, | 389 | .probe = amd8111_probe, |
diff --git a/drivers/i2c/busses/i2c-hydra.c b/drivers/i2c/busses/i2c-hydra.c index 1b5354e24bf5..e0cb3b0f92fa 100644 --- a/drivers/i2c/busses/i2c-hydra.c +++ b/drivers/i2c/busses/i2c-hydra.c | |||
@@ -155,7 +155,6 @@ static void __devexit hydra_remove(struct pci_dev *dev) | |||
155 | 155 | ||
156 | 156 | ||
157 | static struct pci_driver hydra_driver = { | 157 | static struct pci_driver hydra_driver = { |
158 | .owner = THIS_MODULE, | ||
159 | .name = "hydra_smbus", | 158 | .name = "hydra_smbus", |
160 | .id_table = hydra_ids, | 159 | .id_table = hydra_ids, |
161 | .probe = hydra_probe, | 160 | .probe = hydra_probe, |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 4f63195069da..ac3eafa8aac0 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -560,7 +560,6 @@ static void __devexit i801_remove(struct pci_dev *dev) | |||
560 | } | 560 | } |
561 | 561 | ||
562 | static struct pci_driver i801_driver = { | 562 | static struct pci_driver i801_driver = { |
563 | .owner = THIS_MODULE, | ||
564 | .name = "i801_smbus", | 563 | .name = "i801_smbus", |
565 | .id_table = i801_ids, | 564 | .id_table = i801_ids, |
566 | .probe = i801_probe, | 565 | .probe = i801_probe, |
diff --git a/drivers/i2c/busses/i2c-i810.c b/drivers/i2c/busses/i2c-i810.c index 52bc30593bd7..748be30f2bae 100644 --- a/drivers/i2c/busses/i2c-i810.c +++ b/drivers/i2c/busses/i2c-i810.c | |||
@@ -233,7 +233,6 @@ static void __devexit i810_remove(struct pci_dev *dev) | |||
233 | } | 233 | } |
234 | 234 | ||
235 | static struct pci_driver i810_driver = { | 235 | static struct pci_driver i810_driver = { |
236 | .owner = THIS_MODULE, | ||
237 | .name = "i810_smbus", | 236 | .name = "i810_smbus", |
238 | .id_table = i810_ids, | 237 | .id_table = i810_ids, |
239 | .probe = i810_probe, | 238 | .probe = i810_probe, |
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c index cfae4ad00fae..1414851a17b8 100644 --- a/drivers/i2c/busses/i2c-iop3xx.c +++ b/drivers/i2c/busses/i2c-iop3xx.c | |||
@@ -405,10 +405,9 @@ static struct i2c_algorithm iop3xx_i2c_algo = { | |||
405 | }; | 405 | }; |
406 | 406 | ||
407 | static int | 407 | static int |
408 | iop3xx_i2c_remove(struct device *device) | 408 | iop3xx_i2c_remove(struct platform_device *pdev) |
409 | { | 409 | { |
410 | struct platform_device *pdev = to_platform_device(device); | 410 | struct i2c_adapter *padapter = platform_get_drvdata(pdev); |
411 | struct i2c_adapter *padapter = dev_get_drvdata(&pdev->dev); | ||
412 | struct i2c_algo_iop3xx_data *adapter_data = | 411 | struct i2c_algo_iop3xx_data *adapter_data = |
413 | (struct i2c_algo_iop3xx_data *)padapter->algo_data; | 412 | (struct i2c_algo_iop3xx_data *)padapter->algo_data; |
414 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 413 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -426,15 +425,14 @@ iop3xx_i2c_remove(struct device *device) | |||
426 | kfree(adapter_data); | 425 | kfree(adapter_data); |
427 | kfree(padapter); | 426 | kfree(padapter); |
428 | 427 | ||
429 | dev_set_drvdata(&pdev->dev, NULL); | 428 | platform_set_drvdata(pdev, NULL); |
430 | 429 | ||
431 | return 0; | 430 | return 0; |
432 | } | 431 | } |
433 | 432 | ||
434 | static int | 433 | static int |
435 | iop3xx_i2c_probe(struct device *dev) | 434 | iop3xx_i2c_probe(struct platform_device *pdev) |
436 | { | 435 | { |
437 | struct platform_device *pdev = to_platform_device(dev); | ||
438 | struct resource *res; | 436 | struct resource *res; |
439 | int ret; | 437 | int ret; |
440 | struct i2c_adapter *new_adapter; | 438 | struct i2c_adapter *new_adapter; |
@@ -499,7 +497,7 @@ iop3xx_i2c_probe(struct device *dev) | |||
499 | iop3xx_i2c_set_slave_addr(adapter_data); | 497 | iop3xx_i2c_set_slave_addr(adapter_data); |
500 | iop3xx_i2c_enable(adapter_data); | 498 | iop3xx_i2c_enable(adapter_data); |
501 | 499 | ||
502 | dev_set_drvdata(&pdev->dev, new_adapter); | 500 | platform_set_drvdata(pdev, new_adapter); |
503 | new_adapter->algo_data = adapter_data; | 501 | new_adapter->algo_data = adapter_data; |
504 | 502 | ||
505 | i2c_add_adapter(new_adapter); | 503 | i2c_add_adapter(new_adapter); |
@@ -523,24 +521,25 @@ out: | |||
523 | } | 521 | } |
524 | 522 | ||
525 | 523 | ||
526 | static struct device_driver iop3xx_i2c_driver = { | 524 | static struct platform_driver iop3xx_i2c_driver = { |
527 | .owner = THIS_MODULE, | ||
528 | .name = "IOP3xx-I2C", | ||
529 | .bus = &platform_bus_type, | ||
530 | .probe = iop3xx_i2c_probe, | 525 | .probe = iop3xx_i2c_probe, |
531 | .remove = iop3xx_i2c_remove | 526 | .remove = iop3xx_i2c_remove, |
527 | .driver = { | ||
528 | .owner = THIS_MODULE, | ||
529 | .name = "IOP3xx-I2C", | ||
530 | }, | ||
532 | }; | 531 | }; |
533 | 532 | ||
534 | static int __init | 533 | static int __init |
535 | i2c_iop3xx_init (void) | 534 | i2c_iop3xx_init (void) |
536 | { | 535 | { |
537 | return driver_register(&iop3xx_i2c_driver); | 536 | return platform_driver_register(&iop3xx_i2c_driver); |
538 | } | 537 | } |
539 | 538 | ||
540 | static void __exit | 539 | static void __exit |
541 | i2c_iop3xx_exit (void) | 540 | i2c_iop3xx_exit (void) |
542 | { | 541 | { |
543 | driver_unregister(&iop3xx_i2c_driver); | 542 | platform_driver_unregister(&iop3xx_i2c_driver); |
544 | return; | 543 | return; |
545 | } | 544 | } |
546 | 545 | ||
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c index 64552a376f2d..cef024a7d048 100644 --- a/drivers/i2c/busses/i2c-ixp2000.c +++ b/drivers/i2c/busses/i2c-ixp2000.c | |||
@@ -86,12 +86,11 @@ struct ixp2000_i2c_data { | |||
86 | struct i2c_algo_bit_data algo_data; | 86 | struct i2c_algo_bit_data algo_data; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | static int ixp2000_i2c_remove(struct device *dev) | 89 | static int ixp2000_i2c_remove(struct platform_device *plat_dev) |
90 | { | 90 | { |
91 | struct platform_device *plat_dev = to_platform_device(dev); | 91 | struct ixp2000_i2c_data *drv_data = platform_get_drvdata(plat_dev); |
92 | struct ixp2000_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev); | ||
93 | 92 | ||
94 | dev_set_drvdata(&plat_dev->dev, NULL); | 93 | platform_set_drvdata(plat_dev, NULL); |
95 | 94 | ||
96 | i2c_bit_del_bus(&drv_data->adapter); | 95 | i2c_bit_del_bus(&drv_data->adapter); |
97 | 96 | ||
@@ -100,10 +99,9 @@ static int ixp2000_i2c_remove(struct device *dev) | |||
100 | return 0; | 99 | return 0; |
101 | } | 100 | } |
102 | 101 | ||
103 | static int ixp2000_i2c_probe(struct device *dev) | 102 | static int ixp2000_i2c_probe(struct platform_device *plat_dev) |
104 | { | 103 | { |
105 | int err; | 104 | int err; |
106 | struct platform_device *plat_dev = to_platform_device(dev); | ||
107 | struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data; | 105 | struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data; |
108 | struct ixp2000_i2c_data *drv_data = | 106 | struct ixp2000_i2c_data *drv_data = |
109 | kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL); | 107 | kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL); |
@@ -139,27 +137,28 @@ static int ixp2000_i2c_probe(struct device *dev) | |||
139 | return err; | 137 | return err; |
140 | } | 138 | } |
141 | 139 | ||
142 | dev_set_drvdata(&plat_dev->dev, drv_data); | 140 | platform_set_drvdata(plat_dev, drv_data); |
143 | 141 | ||
144 | return 0; | 142 | return 0; |
145 | } | 143 | } |
146 | 144 | ||
147 | static struct device_driver ixp2000_i2c_driver = { | 145 | static struct platform_driver ixp2000_i2c_driver = { |
148 | .owner = THIS_MODULE, | ||
149 | .name = "IXP2000-I2C", | ||
150 | .bus = &platform_bus_type, | ||
151 | .probe = ixp2000_i2c_probe, | 146 | .probe = ixp2000_i2c_probe, |
152 | .remove = ixp2000_i2c_remove, | 147 | .remove = ixp2000_i2c_remove, |
148 | .driver = { | ||
149 | .name = "IXP2000-I2C", | ||
150 | .owner = THIS_MODULE, | ||
151 | }, | ||
153 | }; | 152 | }; |
154 | 153 | ||
155 | static int __init ixp2000_i2c_init(void) | 154 | static int __init ixp2000_i2c_init(void) |
156 | { | 155 | { |
157 | return driver_register(&ixp2000_i2c_driver); | 156 | return platform_driver_register(&ixp2000_i2c_driver); |
158 | } | 157 | } |
159 | 158 | ||
160 | static void __exit ixp2000_i2c_exit(void) | 159 | static void __exit ixp2000_i2c_exit(void) |
161 | { | 160 | { |
162 | driver_unregister(&ixp2000_i2c_driver); | 161 | platform_driver_unregister(&ixp2000_i2c_driver); |
163 | } | 162 | } |
164 | 163 | ||
165 | module_init(ixp2000_i2c_init); | 164 | module_init(ixp2000_i2c_init); |
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c index cc652c350814..aa36855fa995 100644 --- a/drivers/i2c/busses/i2c-ixp4xx.c +++ b/drivers/i2c/busses/i2c-ixp4xx.c | |||
@@ -87,12 +87,11 @@ struct ixp4xx_i2c_data { | |||
87 | struct i2c_algo_bit_data algo_data; | 87 | struct i2c_algo_bit_data algo_data; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static int ixp4xx_i2c_remove(struct device *dev) | 90 | static int ixp4xx_i2c_remove(struct platform_device *plat_dev) |
91 | { | 91 | { |
92 | struct platform_device *plat_dev = to_platform_device(dev); | 92 | struct ixp4xx_i2c_data *drv_data = platform_get_drvdata(plat_dev); |
93 | struct ixp4xx_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev); | ||
94 | 93 | ||
95 | dev_set_drvdata(&plat_dev->dev, NULL); | 94 | platform_set_drvdata(plat_dev, NULL); |
96 | 95 | ||
97 | i2c_bit_del_bus(&drv_data->adapter); | 96 | i2c_bit_del_bus(&drv_data->adapter); |
98 | 97 | ||
@@ -101,10 +100,9 @@ static int ixp4xx_i2c_remove(struct device *dev) | |||
101 | return 0; | 100 | return 0; |
102 | } | 101 | } |
103 | 102 | ||
104 | static int ixp4xx_i2c_probe(struct device *dev) | 103 | static int ixp4xx_i2c_probe(struct platform_device *plat_dev) |
105 | { | 104 | { |
106 | int err; | 105 | int err; |
107 | struct platform_device *plat_dev = to_platform_device(dev); | ||
108 | struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data; | 106 | struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data; |
109 | struct ixp4xx_i2c_data *drv_data = | 107 | struct ixp4xx_i2c_data *drv_data = |
110 | kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL); | 108 | kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL); |
@@ -148,27 +146,28 @@ static int ixp4xx_i2c_probe(struct device *dev) | |||
148 | return err; | 146 | return err; |
149 | } | 147 | } |
150 | 148 | ||
151 | dev_set_drvdata(&plat_dev->dev, drv_data); | 149 | platform_set_drvdata(plat_dev, drv_data); |
152 | 150 | ||
153 | return 0; | 151 | return 0; |
154 | } | 152 | } |
155 | 153 | ||
156 | static struct device_driver ixp4xx_i2c_driver = { | 154 | static struct platform_driver ixp4xx_i2c_driver = { |
157 | .owner = THIS_MODULE, | ||
158 | .name = "IXP4XX-I2C", | ||
159 | .bus = &platform_bus_type, | ||
160 | .probe = ixp4xx_i2c_probe, | 155 | .probe = ixp4xx_i2c_probe, |
161 | .remove = ixp4xx_i2c_remove, | 156 | .remove = ixp4xx_i2c_remove, |
157 | .driver = { | ||
158 | .name = "IXP4XX-I2C", | ||
159 | .owner = THIS_MODULE, | ||
160 | }, | ||
162 | }; | 161 | }; |
163 | 162 | ||
164 | static int __init ixp4xx_i2c_init(void) | 163 | static int __init ixp4xx_i2c_init(void) |
165 | { | 164 | { |
166 | return driver_register(&ixp4xx_i2c_driver); | 165 | return platform_driver_register(&ixp4xx_i2c_driver); |
167 | } | 166 | } |
168 | 167 | ||
169 | static void __exit ixp4xx_i2c_exit(void) | 168 | static void __exit ixp4xx_i2c_exit(void) |
170 | { | 169 | { |
171 | driver_unregister(&ixp4xx_i2c_driver); | 170 | platform_driver_unregister(&ixp4xx_i2c_driver); |
172 | } | 171 | } |
173 | 172 | ||
174 | module_init(ixp4xx_i2c_init); | 173 | module_init(ixp4xx_i2c_init); |
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 65b939a059e9..5ccd338a9dc9 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -288,11 +288,10 @@ static struct i2c_adapter mpc_ops = { | |||
288 | .retries = 1 | 288 | .retries = 1 |
289 | }; | 289 | }; |
290 | 290 | ||
291 | static int fsl_i2c_probe(struct device *device) | 291 | static int fsl_i2c_probe(struct platform_device *pdev) |
292 | { | 292 | { |
293 | int result = 0; | 293 | int result = 0; |
294 | struct mpc_i2c *i2c; | 294 | struct mpc_i2c *i2c; |
295 | struct platform_device *pdev = to_platform_device(device); | ||
296 | struct fsl_i2c_platform_data *pdata; | 295 | struct fsl_i2c_platform_data *pdata; |
297 | struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 296 | struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
298 | 297 | ||
@@ -323,7 +322,7 @@ static int fsl_i2c_probe(struct device *device) | |||
323 | } | 322 | } |
324 | 323 | ||
325 | mpc_i2c_setclock(i2c); | 324 | mpc_i2c_setclock(i2c); |
326 | dev_set_drvdata(device, i2c); | 325 | platform_set_drvdata(pdev, i2c); |
327 | 326 | ||
328 | i2c->adap = mpc_ops; | 327 | i2c->adap = mpc_ops; |
329 | i2c_set_adapdata(&i2c->adap, i2c); | 328 | i2c_set_adapdata(&i2c->adap, i2c); |
@@ -345,12 +344,12 @@ static int fsl_i2c_probe(struct device *device) | |||
345 | return result; | 344 | return result; |
346 | }; | 345 | }; |
347 | 346 | ||
348 | static int fsl_i2c_remove(struct device *device) | 347 | static int fsl_i2c_remove(struct platform_device *pdev) |
349 | { | 348 | { |
350 | struct mpc_i2c *i2c = dev_get_drvdata(device); | 349 | struct mpc_i2c *i2c = platform_get_drvdata(pdev); |
351 | 350 | ||
352 | i2c_del_adapter(&i2c->adap); | 351 | i2c_del_adapter(&i2c->adap); |
353 | dev_set_drvdata(device, NULL); | 352 | platform_set_drvdata(pdev, NULL); |
354 | 353 | ||
355 | if (i2c->irq != 0) | 354 | if (i2c->irq != 0) |
356 | free_irq(i2c->irq, i2c); | 355 | free_irq(i2c->irq, i2c); |
@@ -361,22 +360,23 @@ static int fsl_i2c_remove(struct device *device) | |||
361 | }; | 360 | }; |
362 | 361 | ||
363 | /* Structure for a device driver */ | 362 | /* Structure for a device driver */ |
364 | static struct device_driver fsl_i2c_driver = { | 363 | static struct platform_driver fsl_i2c_driver = { |
365 | .owner = THIS_MODULE, | ||
366 | .name = "fsl-i2c", | ||
367 | .bus = &platform_bus_type, | ||
368 | .probe = fsl_i2c_probe, | 364 | .probe = fsl_i2c_probe, |
369 | .remove = fsl_i2c_remove, | 365 | .remove = fsl_i2c_remove, |
366 | .driver = { | ||
367 | .owner = THIS_MODULE, | ||
368 | .name = "fsl-i2c", | ||
369 | }, | ||
370 | }; | 370 | }; |
371 | 371 | ||
372 | static int __init fsl_i2c_init(void) | 372 | static int __init fsl_i2c_init(void) |
373 | { | 373 | { |
374 | return driver_register(&fsl_i2c_driver); | 374 | return platform_driver_register(&fsl_i2c_driver); |
375 | } | 375 | } |
376 | 376 | ||
377 | static void __exit fsl_i2c_exit(void) | 377 | static void __exit fsl_i2c_exit(void) |
378 | { | 378 | { |
379 | driver_unregister(&fsl_i2c_driver); | 379 | platform_driver_unregister(&fsl_i2c_driver); |
380 | } | 380 | } |
381 | 381 | ||
382 | module_init(fsl_i2c_init); | 382 | module_init(fsl_i2c_init); |
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 6b48027b2ee3..afd7634e5cc9 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -492,11 +492,10 @@ mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data) | |||
492 | } | 492 | } |
493 | 493 | ||
494 | static int __devinit | 494 | static int __devinit |
495 | mv64xxx_i2c_probe(struct device *dev) | 495 | mv64xxx_i2c_probe(struct platform_device *pd) |
496 | { | 496 | { |
497 | struct platform_device *pd = to_platform_device(dev); | ||
498 | struct mv64xxx_i2c_data *drv_data; | 497 | struct mv64xxx_i2c_data *drv_data; |
499 | struct mv64xxx_i2c_pdata *pdata = dev->platform_data; | 498 | struct mv64xxx_i2c_pdata *pdata = pd->dev.platform_data; |
500 | int rc; | 499 | int rc; |
501 | 500 | ||
502 | if ((pd->id != 0) || !pdata) | 501 | if ((pd->id != 0) || !pdata) |
@@ -526,7 +525,7 @@ mv64xxx_i2c_probe(struct device *dev) | |||
526 | drv_data->adapter.class = I2C_CLASS_HWMON; | 525 | drv_data->adapter.class = I2C_CLASS_HWMON; |
527 | drv_data->adapter.timeout = pdata->timeout; | 526 | drv_data->adapter.timeout = pdata->timeout; |
528 | drv_data->adapter.retries = pdata->retries; | 527 | drv_data->adapter.retries = pdata->retries; |
529 | dev_set_drvdata(dev, drv_data); | 528 | platform_set_drvdata(pd, drv_data); |
530 | i2c_set_adapdata(&drv_data->adapter, drv_data); | 529 | i2c_set_adapdata(&drv_data->adapter, drv_data); |
531 | 530 | ||
532 | if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0, | 531 | if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0, |
@@ -555,9 +554,9 @@ mv64xxx_i2c_probe(struct device *dev) | |||
555 | } | 554 | } |
556 | 555 | ||
557 | static int __devexit | 556 | static int __devexit |
558 | mv64xxx_i2c_remove(struct device *dev) | 557 | mv64xxx_i2c_remove(struct platform_device *dev) |
559 | { | 558 | { |
560 | struct mv64xxx_i2c_data *drv_data = dev_get_drvdata(dev); | 559 | struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(dev); |
561 | int rc; | 560 | int rc; |
562 | 561 | ||
563 | rc = i2c_del_adapter(&drv_data->adapter); | 562 | rc = i2c_del_adapter(&drv_data->adapter); |
@@ -568,24 +567,25 @@ mv64xxx_i2c_remove(struct device *dev) | |||
568 | return rc; | 567 | return rc; |
569 | } | 568 | } |
570 | 569 | ||
571 | static struct device_driver mv64xxx_i2c_driver = { | 570 | static struct platform_driver mv64xxx_i2c_driver = { |
572 | .owner = THIS_MODULE, | ||
573 | .name = MV64XXX_I2C_CTLR_NAME, | ||
574 | .bus = &platform_bus_type, | ||
575 | .probe = mv64xxx_i2c_probe, | 571 | .probe = mv64xxx_i2c_probe, |
576 | .remove = mv64xxx_i2c_remove, | 572 | .remove = mv64xxx_i2c_remove, |
573 | .driver = { | ||
574 | .owner = THIS_MODULE, | ||
575 | .name = MV64XXX_I2C_CTLR_NAME, | ||
576 | }, | ||
577 | }; | 577 | }; |
578 | 578 | ||
579 | static int __init | 579 | static int __init |
580 | mv64xxx_i2c_init(void) | 580 | mv64xxx_i2c_init(void) |
581 | { | 581 | { |
582 | return driver_register(&mv64xxx_i2c_driver); | 582 | return platform_driver_register(&mv64xxx_i2c_driver); |
583 | } | 583 | } |
584 | 584 | ||
585 | static void __exit | 585 | static void __exit |
586 | mv64xxx_i2c_exit(void) | 586 | mv64xxx_i2c_exit(void) |
587 | { | 587 | { |
588 | driver_unregister(&mv64xxx_i2c_driver); | 588 | platform_driver_unregister(&mv64xxx_i2c_driver); |
589 | } | 589 | } |
590 | 590 | ||
591 | module_init(mv64xxx_i2c_init); | 591 | module_init(mv64xxx_i2c_init); |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index fd26036e68a3..4d18e6e5f159 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -347,7 +347,6 @@ static void __devexit nforce2_remove(struct pci_dev *dev) | |||
347 | } | 347 | } |
348 | 348 | ||
349 | static struct pci_driver nforce2_driver = { | 349 | static struct pci_driver nforce2_driver = { |
350 | .owner = THIS_MODULE, | ||
351 | .name = "nForce2_smbus", | 350 | .name = "nForce2_smbus", |
352 | .id_table = nforce2_ids, | 351 | .id_table = nforce2_ids, |
353 | .probe = nforce2_probe, | 352 | .probe = nforce2_probe, |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 7d63eec423fe..692f47345481 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -462,7 +462,6 @@ static void __devexit piix4_remove(struct pci_dev *dev) | |||
462 | } | 462 | } |
463 | 463 | ||
464 | static struct pci_driver piix4_driver = { | 464 | static struct pci_driver piix4_driver = { |
465 | .owner = THIS_MODULE, | ||
466 | .name = "piix4_smbus", | 465 | .name = "piix4_smbus", |
467 | .id_table = piix4_ids, | 466 | .id_table = piix4_ids, |
468 | .probe = piix4_probe, | 467 | .probe = piix4_probe, |
diff --git a/drivers/i2c/busses/i2c-prosavage.c b/drivers/i2c/busses/i2c-prosavage.c index 42cb1d8ca659..9479525892e3 100644 --- a/drivers/i2c/busses/i2c-prosavage.c +++ b/drivers/i2c/busses/i2c-prosavage.c | |||
@@ -301,7 +301,6 @@ static struct pci_device_id prosavage_pci_tbl[] = { | |||
301 | MODULE_DEVICE_TABLE (pci, prosavage_pci_tbl); | 301 | MODULE_DEVICE_TABLE (pci, prosavage_pci_tbl); |
302 | 302 | ||
303 | static struct pci_driver prosavage_driver = { | 303 | static struct pci_driver prosavage_driver = { |
304 | .owner = THIS_MODULE, | ||
305 | .name = "prosavage_smbus", | 304 | .name = "prosavage_smbus", |
306 | .id_table = prosavage_pci_tbl, | 305 | .id_table = prosavage_pci_tbl, |
307 | .probe = prosavage_probe, | 306 | .probe = prosavage_probe, |
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 67ccbea24ba4..70f7ab829d36 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -936,10 +936,10 @@ static struct pxa_i2c i2c_pxa = { | |||
936 | }, | 936 | }, |
937 | }; | 937 | }; |
938 | 938 | ||
939 | static int i2c_pxa_probe(struct device *dev) | 939 | static int i2c_pxa_probe(struct platform_device *dev) |
940 | { | 940 | { |
941 | struct pxa_i2c *i2c = &i2c_pxa; | 941 | struct pxa_i2c *i2c = &i2c_pxa; |
942 | struct i2c_pxa_platform_data *plat = dev->platform_data; | 942 | struct i2c_pxa_platform_data *plat = dev->dev.platform_data; |
943 | int ret; | 943 | int ret; |
944 | 944 | ||
945 | #ifdef CONFIG_PXA27x | 945 | #ifdef CONFIG_PXA27x |
@@ -968,7 +968,7 @@ static int i2c_pxa_probe(struct device *dev) | |||
968 | i2c_pxa_reset(i2c); | 968 | i2c_pxa_reset(i2c); |
969 | 969 | ||
970 | i2c->adap.algo_data = i2c; | 970 | i2c->adap.algo_data = i2c; |
971 | i2c->adap.dev.parent = dev; | 971 | i2c->adap.dev.parent = &dev->dev; |
972 | 972 | ||
973 | ret = i2c_add_adapter(&i2c->adap); | 973 | ret = i2c_add_adapter(&i2c->adap); |
974 | if (ret < 0) { | 974 | if (ret < 0) { |
@@ -976,7 +976,7 @@ static int i2c_pxa_probe(struct device *dev) | |||
976 | goto err_irq; | 976 | goto err_irq; |
977 | } | 977 | } |
978 | 978 | ||
979 | dev_set_drvdata(dev, i2c); | 979 | platform_set_drvdata(dev, i2c); |
980 | 980 | ||
981 | #ifdef CONFIG_I2C_PXA_SLAVE | 981 | #ifdef CONFIG_I2C_PXA_SLAVE |
982 | printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n", | 982 | printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n", |
@@ -993,11 +993,11 @@ static int i2c_pxa_probe(struct device *dev) | |||
993 | return ret; | 993 | return ret; |
994 | } | 994 | } |
995 | 995 | ||
996 | static int i2c_pxa_remove(struct device *dev) | 996 | static int i2c_pxa_remove(struct platform_device *dev) |
997 | { | 997 | { |
998 | struct pxa_i2c *i2c = dev_get_drvdata(dev); | 998 | struct pxa_i2c *i2c = platform_get_drvdata(dev); |
999 | 999 | ||
1000 | dev_set_drvdata(dev, NULL); | 1000 | platform_set_drvdata(dev, NULL); |
1001 | 1001 | ||
1002 | i2c_del_adapter(&i2c->adap); | 1002 | i2c_del_adapter(&i2c->adap); |
1003 | free_irq(IRQ_I2C, i2c); | 1003 | free_irq(IRQ_I2C, i2c); |
@@ -1006,21 +1006,22 @@ static int i2c_pxa_remove(struct device *dev) | |||
1006 | return 0; | 1006 | return 0; |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | static struct device_driver i2c_pxa_driver = { | 1009 | static struct platform_driver i2c_pxa_driver = { |
1010 | .name = "pxa2xx-i2c", | ||
1011 | .bus = &platform_bus_type, | ||
1012 | .probe = i2c_pxa_probe, | 1010 | .probe = i2c_pxa_probe, |
1013 | .remove = i2c_pxa_remove, | 1011 | .remove = i2c_pxa_remove, |
1012 | .driver = { | ||
1013 | .name = "pxa2xx-i2c", | ||
1014 | }, | ||
1014 | }; | 1015 | }; |
1015 | 1016 | ||
1016 | static int __init i2c_adap_pxa_init(void) | 1017 | static int __init i2c_adap_pxa_init(void) |
1017 | { | 1018 | { |
1018 | return driver_register(&i2c_pxa_driver); | 1019 | return platform_driver_register(&i2c_pxa_driver); |
1019 | } | 1020 | } |
1020 | 1021 | ||
1021 | static void i2c_adap_pxa_exit(void) | 1022 | static void i2c_adap_pxa_exit(void) |
1022 | { | 1023 | { |
1023 | return driver_unregister(&i2c_pxa_driver); | 1024 | return platform_driver_unregister(&i2c_pxa_driver); |
1024 | } | 1025 | } |
1025 | 1026 | ||
1026 | module_init(i2c_adap_pxa_init); | 1027 | module_init(i2c_adap_pxa_init); |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 1b582262e677..58cfd3111ef6 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -760,24 +760,23 @@ static void s3c24xx_i2c_free(struct s3c24xx_i2c *i2c) | |||
760 | * called by the bus driver when a suitable device is found | 760 | * called by the bus driver when a suitable device is found |
761 | */ | 761 | */ |
762 | 762 | ||
763 | static int s3c24xx_i2c_probe(struct device *dev) | 763 | static int s3c24xx_i2c_probe(struct platform_device *pdev) |
764 | { | 764 | { |
765 | struct platform_device *pdev = to_platform_device(dev); | ||
766 | struct s3c24xx_i2c *i2c = &s3c24xx_i2c; | 765 | struct s3c24xx_i2c *i2c = &s3c24xx_i2c; |
767 | struct resource *res; | 766 | struct resource *res; |
768 | int ret; | 767 | int ret; |
769 | 768 | ||
770 | /* find the clock and enable it */ | 769 | /* find the clock and enable it */ |
771 | 770 | ||
772 | i2c->dev = dev; | 771 | i2c->dev = &pdev->dev; |
773 | i2c->clk = clk_get(dev, "i2c"); | 772 | i2c->clk = clk_get(&pdev->dev, "i2c"); |
774 | if (IS_ERR(i2c->clk)) { | 773 | if (IS_ERR(i2c->clk)) { |
775 | dev_err(dev, "cannot get clock\n"); | 774 | dev_err(&pdev->dev, "cannot get clock\n"); |
776 | ret = -ENOENT; | 775 | ret = -ENOENT; |
777 | goto out; | 776 | goto out; |
778 | } | 777 | } |
779 | 778 | ||
780 | dev_dbg(dev, "clock source %p\n", i2c->clk); | 779 | dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk); |
781 | 780 | ||
782 | clk_use(i2c->clk); | 781 | clk_use(i2c->clk); |
783 | clk_enable(i2c->clk); | 782 | clk_enable(i2c->clk); |
@@ -786,7 +785,7 @@ static int s3c24xx_i2c_probe(struct device *dev) | |||
786 | 785 | ||
787 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 786 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
788 | if (res == NULL) { | 787 | if (res == NULL) { |
789 | dev_err(dev, "cannot find IO resource\n"); | 788 | dev_err(&pdev->dev, "cannot find IO resource\n"); |
790 | ret = -ENOENT; | 789 | ret = -ENOENT; |
791 | goto out; | 790 | goto out; |
792 | } | 791 | } |
@@ -795,7 +794,7 @@ static int s3c24xx_i2c_probe(struct device *dev) | |||
795 | pdev->name); | 794 | pdev->name); |
796 | 795 | ||
797 | if (i2c->ioarea == NULL) { | 796 | if (i2c->ioarea == NULL) { |
798 | dev_err(dev, "cannot request IO\n"); | 797 | dev_err(&pdev->dev, "cannot request IO\n"); |
799 | ret = -ENXIO; | 798 | ret = -ENXIO; |
800 | goto out; | 799 | goto out; |
801 | } | 800 | } |
@@ -803,17 +802,17 @@ static int s3c24xx_i2c_probe(struct device *dev) | |||
803 | i2c->regs = ioremap(res->start, (res->end-res->start)+1); | 802 | i2c->regs = ioremap(res->start, (res->end-res->start)+1); |
804 | 803 | ||
805 | if (i2c->regs == NULL) { | 804 | if (i2c->regs == NULL) { |
806 | dev_err(dev, "cannot map IO\n"); | 805 | dev_err(&pdev->dev, "cannot map IO\n"); |
807 | ret = -ENXIO; | 806 | ret = -ENXIO; |
808 | goto out; | 807 | goto out; |
809 | } | 808 | } |
810 | 809 | ||
811 | dev_dbg(dev, "registers %p (%p, %p)\n", i2c->regs, i2c->ioarea, res); | 810 | dev_dbg(&pdev->dev, "registers %p (%p, %p)\n", i2c->regs, i2c->ioarea, res); |
812 | 811 | ||
813 | /* setup info block for the i2c core */ | 812 | /* setup info block for the i2c core */ |
814 | 813 | ||
815 | i2c->adap.algo_data = i2c; | 814 | i2c->adap.algo_data = i2c; |
816 | i2c->adap.dev.parent = dev; | 815 | i2c->adap.dev.parent = &pdev->dev; |
817 | 816 | ||
818 | /* initialise the i2c controller */ | 817 | /* initialise the i2c controller */ |
819 | 818 | ||
@@ -827,7 +826,7 @@ static int s3c24xx_i2c_probe(struct device *dev) | |||
827 | 826 | ||
828 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 827 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
829 | if (res == NULL) { | 828 | if (res == NULL) { |
830 | dev_err(dev, "cannot find IRQ\n"); | 829 | dev_err(&pdev->dev, "cannot find IRQ\n"); |
831 | ret = -ENOENT; | 830 | ret = -ENOENT; |
832 | goto out; | 831 | goto out; |
833 | } | 832 | } |
@@ -836,23 +835,23 @@ static int s3c24xx_i2c_probe(struct device *dev) | |||
836 | pdev->name, i2c); | 835 | pdev->name, i2c); |
837 | 836 | ||
838 | if (ret != 0) { | 837 | if (ret != 0) { |
839 | dev_err(dev, "cannot claim IRQ\n"); | 838 | dev_err(&pdev->dev, "cannot claim IRQ\n"); |
840 | goto out; | 839 | goto out; |
841 | } | 840 | } |
842 | 841 | ||
843 | i2c->irq = res; | 842 | i2c->irq = res; |
844 | 843 | ||
845 | dev_dbg(dev, "irq resource %p (%ld)\n", res, res->start); | 844 | dev_dbg(&pdev->dev, "irq resource %p (%ld)\n", res, res->start); |
846 | 845 | ||
847 | ret = i2c_add_adapter(&i2c->adap); | 846 | ret = i2c_add_adapter(&i2c->adap); |
848 | if (ret < 0) { | 847 | if (ret < 0) { |
849 | dev_err(dev, "failed to add bus to i2c core\n"); | 848 | dev_err(&pdev->dev, "failed to add bus to i2c core\n"); |
850 | goto out; | 849 | goto out; |
851 | } | 850 | } |
852 | 851 | ||
853 | dev_set_drvdata(dev, i2c); | 852 | platform_set_drvdata(pdev, i2c); |
854 | 853 | ||
855 | dev_info(dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id); | 854 | dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id); |
856 | 855 | ||
857 | out: | 856 | out: |
858 | if (ret < 0) | 857 | if (ret < 0) |
@@ -866,22 +865,22 @@ static int s3c24xx_i2c_probe(struct device *dev) | |||
866 | * called when device is removed from the bus | 865 | * called when device is removed from the bus |
867 | */ | 866 | */ |
868 | 867 | ||
869 | static int s3c24xx_i2c_remove(struct device *dev) | 868 | static int s3c24xx_i2c_remove(struct platform_device *pdev) |
870 | { | 869 | { |
871 | struct s3c24xx_i2c *i2c = dev_get_drvdata(dev); | 870 | struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); |
872 | 871 | ||
873 | if (i2c != NULL) { | 872 | if (i2c != NULL) { |
874 | s3c24xx_i2c_free(i2c); | 873 | s3c24xx_i2c_free(i2c); |
875 | dev_set_drvdata(dev, NULL); | 874 | platform_set_drvdata(pdev, NULL); |
876 | } | 875 | } |
877 | 876 | ||
878 | return 0; | 877 | return 0; |
879 | } | 878 | } |
880 | 879 | ||
881 | #ifdef CONFIG_PM | 880 | #ifdef CONFIG_PM |
882 | static int s3c24xx_i2c_resume(struct device *dev) | 881 | static int s3c24xx_i2c_resume(struct platform_device *dev) |
883 | { | 882 | { |
884 | struct s3c24xx_i2c *i2c = dev_get_drvdata(dev); | 883 | struct s3c24xx_i2c *i2c = platform_get_drvdata(dev); |
885 | 884 | ||
886 | if (i2c != NULL) | 885 | if (i2c != NULL) |
887 | s3c24xx_i2c_init(i2c); | 886 | s3c24xx_i2c_init(i2c); |
@@ -895,33 +894,35 @@ static int s3c24xx_i2c_resume(struct device *dev) | |||
895 | 894 | ||
896 | /* device driver for platform bus bits */ | 895 | /* device driver for platform bus bits */ |
897 | 896 | ||
898 | static struct device_driver s3c2410_i2c_driver = { | 897 | static struct platform_driver s3c2410_i2c_driver = { |
899 | .owner = THIS_MODULE, | ||
900 | .name = "s3c2410-i2c", | ||
901 | .bus = &platform_bus_type, | ||
902 | .probe = s3c24xx_i2c_probe, | 898 | .probe = s3c24xx_i2c_probe, |
903 | .remove = s3c24xx_i2c_remove, | 899 | .remove = s3c24xx_i2c_remove, |
904 | .resume = s3c24xx_i2c_resume, | 900 | .resume = s3c24xx_i2c_resume, |
901 | .driver = { | ||
902 | .owner = THIS_MODULE, | ||
903 | .name = "s3c2410-i2c", | ||
904 | }, | ||
905 | }; | 905 | }; |
906 | 906 | ||
907 | static struct device_driver s3c2440_i2c_driver = { | 907 | static struct platform_driver s3c2440_i2c_driver = { |
908 | .owner = THIS_MODULE, | ||
909 | .name = "s3c2440-i2c", | ||
910 | .bus = &platform_bus_type, | ||
911 | .probe = s3c24xx_i2c_probe, | 908 | .probe = s3c24xx_i2c_probe, |
912 | .remove = s3c24xx_i2c_remove, | 909 | .remove = s3c24xx_i2c_remove, |
913 | .resume = s3c24xx_i2c_resume, | 910 | .resume = s3c24xx_i2c_resume, |
911 | .driver = { | ||
912 | .owner = THIS_MODULE, | ||
913 | .name = "s3c2440-i2c", | ||
914 | }, | ||
914 | }; | 915 | }; |
915 | 916 | ||
916 | static int __init i2c_adap_s3c_init(void) | 917 | static int __init i2c_adap_s3c_init(void) |
917 | { | 918 | { |
918 | int ret; | 919 | int ret; |
919 | 920 | ||
920 | ret = driver_register(&s3c2410_i2c_driver); | 921 | ret = platform_driver_register(&s3c2410_i2c_driver); |
921 | if (ret == 0) { | 922 | if (ret == 0) { |
922 | ret = driver_register(&s3c2440_i2c_driver); | 923 | ret = platform_driver_register(&s3c2440_i2c_driver); |
923 | if (ret) | 924 | if (ret) |
924 | driver_unregister(&s3c2410_i2c_driver); | 925 | platform_driver_unregister(&s3c2410_i2c_driver); |
925 | } | 926 | } |
926 | 927 | ||
927 | return ret; | 928 | return ret; |
@@ -929,8 +930,8 @@ static int __init i2c_adap_s3c_init(void) | |||
929 | 930 | ||
930 | static void __exit i2c_adap_s3c_exit(void) | 931 | static void __exit i2c_adap_s3c_exit(void) |
931 | { | 932 | { |
932 | driver_unregister(&s3c2410_i2c_driver); | 933 | platform_driver_unregister(&s3c2410_i2c_driver); |
933 | driver_unregister(&s3c2440_i2c_driver); | 934 | platform_driver_unregister(&s3c2440_i2c_driver); |
934 | } | 935 | } |
935 | 936 | ||
936 | module_init(i2c_adap_s3c_init); | 937 | module_init(i2c_adap_s3c_init); |
diff --git a/drivers/i2c/busses/i2c-savage4.c b/drivers/i2c/busses/i2c-savage4.c index aebe87ba4033..0c8518298e4d 100644 --- a/drivers/i2c/busses/i2c-savage4.c +++ b/drivers/i2c/busses/i2c-savage4.c | |||
@@ -179,7 +179,6 @@ static void __devexit savage4_remove(struct pci_dev *dev) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | static struct pci_driver savage4_driver = { | 181 | static struct pci_driver savage4_driver = { |
182 | .owner = THIS_MODULE, | ||
183 | .name = "savage4_smbus", | 182 | .name = "savage4_smbus", |
184 | .id_table = savage4_ids, | 183 | .id_table = savage4_ids, |
185 | .probe = savage4_probe, | 184 | .probe = savage4_probe, |
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index 3ad27c3ba15b..b57ab74d23ec 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c | |||
@@ -398,7 +398,6 @@ static void __devexit sis5595_remove(struct pci_dev *dev) | |||
398 | } | 398 | } |
399 | 399 | ||
400 | static struct pci_driver sis5595_driver = { | 400 | static struct pci_driver sis5595_driver = { |
401 | .owner = THIS_MODULE, | ||
402 | .name = "sis5595_smbus", | 401 | .name = "sis5595_smbus", |
403 | .id_table = sis5595_ids, | 402 | .id_table = sis5595_ids, |
404 | .probe = sis5595_probe, | 403 | .probe = sis5595_probe, |
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index 7f49e5fd3ff0..acb75e282414 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c | |||
@@ -496,7 +496,6 @@ static void __devexit sis630_remove(struct pci_dev *dev) | |||
496 | 496 | ||
497 | 497 | ||
498 | static struct pci_driver sis630_driver = { | 498 | static struct pci_driver sis630_driver = { |
499 | .owner = THIS_MODULE, | ||
500 | .name = "sis630_smbus", | 499 | .name = "sis630_smbus", |
501 | .id_table = sis630_ids, | 500 | .id_table = sis630_ids, |
502 | .probe = sis630_probe, | 501 | .probe = sis630_probe, |
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c index 6a134c091324..3024907cdafe 100644 --- a/drivers/i2c/busses/i2c-sis96x.c +++ b/drivers/i2c/busses/i2c-sis96x.c | |||
@@ -329,7 +329,6 @@ static void __devexit sis96x_remove(struct pci_dev *dev) | |||
329 | } | 329 | } |
330 | 330 | ||
331 | static struct pci_driver sis96x_driver = { | 331 | static struct pci_driver sis96x_driver = { |
332 | .owner = THIS_MODULE, | ||
333 | .name = "sis96x_smbus", | 332 | .name = "sis96x_smbus", |
334 | .id_table = sis96x_ids, | 333 | .id_table = sis96x_ids, |
335 | .probe = sis96x_probe, | 334 | .probe = sis96x_probe, |
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c index 544a38e64394..484bbacfce6b 100644 --- a/drivers/i2c/busses/i2c-via.c +++ b/drivers/i2c/busses/i2c-via.c | |||
@@ -159,7 +159,6 @@ static void __devexit vt586b_remove(struct pci_dev *dev) | |||
159 | 159 | ||
160 | 160 | ||
161 | static struct pci_driver vt586b_driver = { | 161 | static struct pci_driver vt586b_driver = { |
162 | .owner = THIS_MODULE, | ||
163 | .name = "vt586b_smbus", | 162 | .name = "vt586b_smbus", |
164 | .id_table = vt586b_ids, | 163 | .id_table = vt586b_ids, |
165 | .probe = vt586b_probe, | 164 | .probe = vt586b_probe, |
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index a2237d4b2cf2..47e52bf2c5ec 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c | |||
@@ -440,7 +440,6 @@ static struct pci_device_id vt596_ids[] = { | |||
440 | MODULE_DEVICE_TABLE(pci, vt596_ids); | 440 | MODULE_DEVICE_TABLE(pci, vt596_ids); |
441 | 441 | ||
442 | static struct pci_driver vt596_driver = { | 442 | static struct pci_driver vt596_driver = { |
443 | .owner = THIS_MODULE, | ||
444 | .name = "vt596_smbus", | 443 | .name = "vt596_smbus", |
445 | .id_table = vt596_ids, | 444 | .id_table = vt596_ids, |
446 | .probe = vt596_probe, | 445 | .probe = vt596_probe, |
diff --git a/drivers/i2c/busses/i2c-voodoo3.c b/drivers/i2c/busses/i2c-voodoo3.c index 650c3ebde84c..b675773b0cc1 100644 --- a/drivers/i2c/busses/i2c-voodoo3.c +++ b/drivers/i2c/busses/i2c-voodoo3.c | |||
@@ -225,7 +225,6 @@ static void __devexit voodoo3_remove(struct pci_dev *dev) | |||
225 | } | 225 | } |
226 | 226 | ||
227 | static struct pci_driver voodoo3_driver = { | 227 | static struct pci_driver voodoo3_driver = { |
228 | .owner = THIS_MODULE, | ||
229 | .name = "voodoo3_smbus", | 228 | .name = "voodoo3_smbus", |
230 | .id_table = voodoo3_ids, | 229 | .id_table = voodoo3_ids, |
231 | .probe = voodoo3_probe, | 230 | .probe = voodoo3_probe, |
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c index 9dbb72fffbe2..d2a100d77839 100644 --- a/drivers/i2c/chips/isp1301_omap.c +++ b/drivers/i2c/chips/isp1301_omap.c | |||
@@ -873,26 +873,27 @@ static int otg_init(struct isp1301 *isp) | |||
873 | return 0; | 873 | return 0; |
874 | } | 874 | } |
875 | 875 | ||
876 | static int otg_probe(struct device *dev) | 876 | static int otg_probe(struct platform_device *dev) |
877 | { | 877 | { |
878 | // struct omap_usb_config *config = dev->platform_data; | 878 | // struct omap_usb_config *config = dev->platform_data; |
879 | 879 | ||
880 | otg_dev = to_platform_device(dev); | 880 | otg_dev = dev; |
881 | return 0; | 881 | return 0; |
882 | } | 882 | } |
883 | 883 | ||
884 | static int otg_remove(struct device *dev) | 884 | static int otg_remove(struct platform_device *dev) |
885 | { | 885 | { |
886 | otg_dev = 0; | 886 | otg_dev = 0; |
887 | return 0; | 887 | return 0; |
888 | } | 888 | } |
889 | 889 | ||
890 | struct device_driver omap_otg_driver = { | 890 | struct platform_driver omap_otg_driver = { |
891 | .owner = THIS_MODULE, | ||
892 | .name = "omap_otg", | ||
893 | .bus = &platform_bus_type, | ||
894 | .probe = otg_probe, | 891 | .probe = otg_probe, |
895 | .remove = otg_remove, | 892 | .remove = otg_remove, |
893 | .driver = { | ||
894 | .owner = THIS_MODULE, | ||
895 | .name = "omap_otg", | ||
896 | }, | ||
896 | }; | 897 | }; |
897 | 898 | ||
898 | static int otg_bind(struct isp1301 *isp) | 899 | static int otg_bind(struct isp1301 *isp) |
@@ -902,7 +903,7 @@ static int otg_bind(struct isp1301 *isp) | |||
902 | if (otg_dev) | 903 | if (otg_dev) |
903 | return -EBUSY; | 904 | return -EBUSY; |
904 | 905 | ||
905 | status = driver_register(&omap_otg_driver); | 906 | status = platform_driver_register(&omap_otg_driver); |
906 | if (status < 0) | 907 | if (status < 0) |
907 | return status; | 908 | return status; |
908 | 909 | ||
@@ -913,7 +914,7 @@ static int otg_bind(struct isp1301 *isp) | |||
913 | status = -ENODEV; | 914 | status = -ENODEV; |
914 | 915 | ||
915 | if (status < 0) | 916 | if (status < 0) |
916 | driver_unregister(&omap_otg_driver); | 917 | platform_driver_unregister(&omap_otg_driver); |
917 | return status; | 918 | return status; |
918 | } | 919 | } |
919 | 920 | ||
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 18ed7765417c..d4f2111d4364 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -787,8 +787,9 @@ static int pre_init = 1; /* Before first ordered IDE scan */ | |||
787 | static LIST_HEAD(ide_pci_drivers); | 787 | static LIST_HEAD(ide_pci_drivers); |
788 | 788 | ||
789 | /* | 789 | /* |
790 | * ide_register_pci_driver - attach IDE driver | 790 | * __ide_register_pci_driver - attach IDE driver |
791 | * @driver: pci driver | 791 | * @driver: pci driver |
792 | * @module: owner module of the driver | ||
792 | * | 793 | * |
793 | * Registers a driver with the IDE layer. The IDE layer arranges that | 794 | * Registers a driver with the IDE layer. The IDE layer arranges that |
794 | * boot time setup is done in the expected device order and then | 795 | * boot time setup is done in the expected device order and then |
@@ -801,15 +802,16 @@ static LIST_HEAD(ide_pci_drivers); | |||
801 | * Returns are the same as for pci_register_driver | 802 | * Returns are the same as for pci_register_driver |
802 | */ | 803 | */ |
803 | 804 | ||
804 | int ide_pci_register_driver(struct pci_driver *driver) | 805 | int __ide_pci_register_driver(struct pci_driver *driver, struct module *module) |
805 | { | 806 | { |
806 | if(!pre_init) | 807 | if(!pre_init) |
807 | return pci_module_init(driver); | 808 | return __pci_register_driver(driver, module); |
809 | driver->driver.owner = module; | ||
808 | list_add_tail(&driver->node, &ide_pci_drivers); | 810 | list_add_tail(&driver->node, &ide_pci_drivers); |
809 | return 0; | 811 | return 0; |
810 | } | 812 | } |
811 | 813 | ||
812 | EXPORT_SYMBOL_GPL(ide_pci_register_driver); | 814 | EXPORT_SYMBOL_GPL(__ide_pci_register_driver); |
813 | 815 | ||
814 | /** | 816 | /** |
815 | * ide_unregister_pci_driver - unregister an IDE driver | 817 | * ide_unregister_pci_driver - unregister an IDE driver |
@@ -897,6 +899,6 @@ void __init ide_scan_pcibus (int scan_direction) | |||
897 | { | 899 | { |
898 | list_del(l); | 900 | list_del(l); |
899 | d = list_entry(l, struct pci_driver, node); | 901 | d = list_entry(l, struct pci_driver, node); |
900 | pci_register_driver(d); | 902 | __pci_register_driver(d, d->driver.owner); |
901 | } | 903 | } |
902 | } | 904 | } |
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index aed5ca23fb22..5ea741f47fc8 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -31,7 +31,7 @@ | |||
31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
32 | * SOFTWARE. | 32 | * SOFTWARE. |
33 | * | 33 | * |
34 | * $Id: user_mad.c 2814 2005-07-06 19:14:09Z halr $ | 34 | * $Id: user_mad.c 4010 2005-11-09 23:11:56Z roland $ |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
@@ -110,13 +110,13 @@ struct ib_umad_device { | |||
110 | }; | 110 | }; |
111 | 111 | ||
112 | struct ib_umad_file { | 112 | struct ib_umad_file { |
113 | struct ib_umad_port *port; | 113 | struct ib_umad_port *port; |
114 | struct list_head recv_list; | 114 | struct list_head recv_list; |
115 | struct list_head port_list; | 115 | struct list_head port_list; |
116 | spinlock_t recv_lock; | 116 | spinlock_t recv_lock; |
117 | wait_queue_head_t recv_wait; | 117 | wait_queue_head_t recv_wait; |
118 | struct ib_mad_agent *agent[IB_UMAD_MAX_AGENTS]; | 118 | struct ib_mad_agent *agent[IB_UMAD_MAX_AGENTS]; |
119 | struct ib_mr *mr[IB_UMAD_MAX_AGENTS]; | 119 | int agents_dead; |
120 | }; | 120 | }; |
121 | 121 | ||
122 | struct ib_umad_packet { | 122 | struct ib_umad_packet { |
@@ -145,6 +145,12 @@ static void ib_umad_release_dev(struct kref *ref) | |||
145 | kfree(dev); | 145 | kfree(dev); |
146 | } | 146 | } |
147 | 147 | ||
148 | /* caller must hold port->mutex at least for reading */ | ||
149 | static struct ib_mad_agent *__get_agent(struct ib_umad_file *file, int id) | ||
150 | { | ||
151 | return file->agents_dead ? NULL : file->agent[id]; | ||
152 | } | ||
153 | |||
148 | static int queue_packet(struct ib_umad_file *file, | 154 | static int queue_packet(struct ib_umad_file *file, |
149 | struct ib_mad_agent *agent, | 155 | struct ib_mad_agent *agent, |
150 | struct ib_umad_packet *packet) | 156 | struct ib_umad_packet *packet) |
@@ -152,10 +158,11 @@ static int queue_packet(struct ib_umad_file *file, | |||
152 | int ret = 1; | 158 | int ret = 1; |
153 | 159 | ||
154 | down_read(&file->port->mutex); | 160 | down_read(&file->port->mutex); |
161 | |||
155 | for (packet->mad.hdr.id = 0; | 162 | for (packet->mad.hdr.id = 0; |
156 | packet->mad.hdr.id < IB_UMAD_MAX_AGENTS; | 163 | packet->mad.hdr.id < IB_UMAD_MAX_AGENTS; |
157 | packet->mad.hdr.id++) | 164 | packet->mad.hdr.id++) |
158 | if (agent == file->agent[packet->mad.hdr.id]) { | 165 | if (agent == __get_agent(file, packet->mad.hdr.id)) { |
159 | spin_lock_irq(&file->recv_lock); | 166 | spin_lock_irq(&file->recv_lock); |
160 | list_add_tail(&packet->list, &file->recv_list); | 167 | list_add_tail(&packet->list, &file->recv_list); |
161 | spin_unlock_irq(&file->recv_lock); | 168 | spin_unlock_irq(&file->recv_lock); |
@@ -327,7 +334,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf, | |||
327 | 334 | ||
328 | down_read(&file->port->mutex); | 335 | down_read(&file->port->mutex); |
329 | 336 | ||
330 | agent = file->agent[packet->mad.hdr.id]; | 337 | agent = __get_agent(file, packet->mad.hdr.id); |
331 | if (!agent) { | 338 | if (!agent) { |
332 | ret = -EINVAL; | 339 | ret = -EINVAL; |
333 | goto err_up; | 340 | goto err_up; |
@@ -481,7 +488,7 @@ static int ib_umad_reg_agent(struct ib_umad_file *file, unsigned long arg) | |||
481 | } | 488 | } |
482 | 489 | ||
483 | for (agent_id = 0; agent_id < IB_UMAD_MAX_AGENTS; ++agent_id) | 490 | for (agent_id = 0; agent_id < IB_UMAD_MAX_AGENTS; ++agent_id) |
484 | if (!file->agent[agent_id]) | 491 | if (!__get_agent(file, agent_id)) |
485 | goto found; | 492 | goto found; |
486 | 493 | ||
487 | ret = -ENOMEM; | 494 | ret = -ENOMEM; |
@@ -505,29 +512,15 @@ found: | |||
505 | goto out; | 512 | goto out; |
506 | } | 513 | } |
507 | 514 | ||
508 | file->agent[agent_id] = agent; | ||
509 | |||
510 | file->mr[agent_id] = ib_get_dma_mr(agent->qp->pd, IB_ACCESS_LOCAL_WRITE); | ||
511 | if (IS_ERR(file->mr[agent_id])) { | ||
512 | ret = -ENOMEM; | ||
513 | goto err; | ||
514 | } | ||
515 | |||
516 | if (put_user(agent_id, | 515 | if (put_user(agent_id, |
517 | (u32 __user *) (arg + offsetof(struct ib_user_mad_reg_req, id)))) { | 516 | (u32 __user *) (arg + offsetof(struct ib_user_mad_reg_req, id)))) { |
518 | ret = -EFAULT; | 517 | ret = -EFAULT; |
519 | goto err_mr; | 518 | ib_unregister_mad_agent(agent); |
519 | goto out; | ||
520 | } | 520 | } |
521 | 521 | ||
522 | file->agent[agent_id] = agent; | ||
522 | ret = 0; | 523 | ret = 0; |
523 | goto out; | ||
524 | |||
525 | err_mr: | ||
526 | ib_dereg_mr(file->mr[agent_id]); | ||
527 | |||
528 | err: | ||
529 | file->agent[agent_id] = NULL; | ||
530 | ib_unregister_mad_agent(agent); | ||
531 | 524 | ||
532 | out: | 525 | out: |
533 | up_write(&file->port->mutex); | 526 | up_write(&file->port->mutex); |
@@ -536,27 +529,29 @@ out: | |||
536 | 529 | ||
537 | static int ib_umad_unreg_agent(struct ib_umad_file *file, unsigned long arg) | 530 | static int ib_umad_unreg_agent(struct ib_umad_file *file, unsigned long arg) |
538 | { | 531 | { |
532 | struct ib_mad_agent *agent = NULL; | ||
539 | u32 id; | 533 | u32 id; |
540 | int ret = 0; | 534 | int ret = 0; |
541 | 535 | ||
542 | down_write(&file->port->mutex); | 536 | if (get_user(id, (u32 __user *) arg)) |
537 | return -EFAULT; | ||
543 | 538 | ||
544 | if (get_user(id, (u32 __user *) arg)) { | 539 | down_write(&file->port->mutex); |
545 | ret = -EFAULT; | ||
546 | goto out; | ||
547 | } | ||
548 | 540 | ||
549 | if (id < 0 || id >= IB_UMAD_MAX_AGENTS || !file->agent[id]) { | 541 | if (id < 0 || id >= IB_UMAD_MAX_AGENTS || !__get_agent(file, id)) { |
550 | ret = -EINVAL; | 542 | ret = -EINVAL; |
551 | goto out; | 543 | goto out; |
552 | } | 544 | } |
553 | 545 | ||
554 | ib_dereg_mr(file->mr[id]); | 546 | agent = file->agent[id]; |
555 | ib_unregister_mad_agent(file->agent[id]); | ||
556 | file->agent[id] = NULL; | 547 | file->agent[id] = NULL; |
557 | 548 | ||
558 | out: | 549 | out: |
559 | up_write(&file->port->mutex); | 550 | up_write(&file->port->mutex); |
551 | |||
552 | if (agent) | ||
553 | ib_unregister_mad_agent(agent); | ||
554 | |||
560 | return ret; | 555 | return ret; |
561 | } | 556 | } |
562 | 557 | ||
@@ -621,23 +616,29 @@ static int ib_umad_close(struct inode *inode, struct file *filp) | |||
621 | struct ib_umad_file *file = filp->private_data; | 616 | struct ib_umad_file *file = filp->private_data; |
622 | struct ib_umad_device *dev = file->port->umad_dev; | 617 | struct ib_umad_device *dev = file->port->umad_dev; |
623 | struct ib_umad_packet *packet, *tmp; | 618 | struct ib_umad_packet *packet, *tmp; |
619 | int already_dead; | ||
624 | int i; | 620 | int i; |
625 | 621 | ||
626 | down_write(&file->port->mutex); | 622 | down_write(&file->port->mutex); |
627 | for (i = 0; i < IB_UMAD_MAX_AGENTS; ++i) | 623 | |
628 | if (file->agent[i]) { | 624 | already_dead = file->agents_dead; |
629 | ib_dereg_mr(file->mr[i]); | 625 | file->agents_dead = 1; |
630 | ib_unregister_mad_agent(file->agent[i]); | ||
631 | } | ||
632 | 626 | ||
633 | list_for_each_entry_safe(packet, tmp, &file->recv_list, list) | 627 | list_for_each_entry_safe(packet, tmp, &file->recv_list, list) |
634 | kfree(packet); | 628 | kfree(packet); |
635 | 629 | ||
636 | list_del(&file->port_list); | 630 | list_del(&file->port_list); |
637 | up_write(&file->port->mutex); | ||
638 | 631 | ||
639 | kfree(file); | 632 | downgrade_write(&file->port->mutex); |
633 | |||
634 | if (!already_dead) | ||
635 | for (i = 0; i < IB_UMAD_MAX_AGENTS; ++i) | ||
636 | if (file->agent[i]) | ||
637 | ib_unregister_mad_agent(file->agent[i]); | ||
638 | |||
639 | up_read(&file->port->mutex); | ||
640 | 640 | ||
641 | kfree(file); | ||
641 | kref_put(&dev->ref, ib_umad_release_dev); | 642 | kref_put(&dev->ref, ib_umad_release_dev); |
642 | 643 | ||
643 | return 0; | 644 | return 0; |
@@ -801,7 +802,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
801 | goto err_class; | 802 | goto err_class; |
802 | port->sm_dev->owner = THIS_MODULE; | 803 | port->sm_dev->owner = THIS_MODULE; |
803 | port->sm_dev->ops = &umad_sm_fops; | 804 | port->sm_dev->ops = &umad_sm_fops; |
804 | kobject_set_name(&port->dev->kobj, "issm%d", port->dev_num); | 805 | kobject_set_name(&port->sm_dev->kobj, "issm%d", port->dev_num); |
805 | if (cdev_add(port->sm_dev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) | 806 | if (cdev_add(port->sm_dev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) |
806 | goto err_sm_cdev; | 807 | goto err_sm_cdev; |
807 | 808 | ||
@@ -863,14 +864,36 @@ static void ib_umad_kill_port(struct ib_umad_port *port) | |||
863 | 864 | ||
864 | port->ib_dev = NULL; | 865 | port->ib_dev = NULL; |
865 | 866 | ||
866 | list_for_each_entry(file, &port->file_list, port_list) | 867 | /* |
867 | for (id = 0; id < IB_UMAD_MAX_AGENTS; ++id) { | 868 | * Now go through the list of files attached to this port and |
868 | if (!file->agent[id]) | 869 | * unregister all of their MAD agents. We need to hold |
869 | continue; | 870 | * port->mutex while doing this to avoid racing with |
870 | ib_dereg_mr(file->mr[id]); | 871 | * ib_umad_close(), but we can't hold the mutex for writing |
871 | ib_unregister_mad_agent(file->agent[id]); | 872 | * while calling ib_unregister_mad_agent(), since that might |
872 | file->agent[id] = NULL; | 873 | * deadlock by calling back into queue_packet(). So we |
873 | } | 874 | * downgrade our lock to a read lock, and then drop and |
875 | * reacquire the write lock for the next iteration. | ||
876 | * | ||
877 | * We do list_del_init() on the file's list_head so that the | ||
878 | * list_del in ib_umad_close() is still OK, even after the | ||
879 | * file is removed from the list. | ||
880 | */ | ||
881 | while (!list_empty(&port->file_list)) { | ||
882 | file = list_entry(port->file_list.next, struct ib_umad_file, | ||
883 | port_list); | ||
884 | |||
885 | file->agents_dead = 1; | ||
886 | list_del_init(&file->port_list); | ||
887 | |||
888 | downgrade_write(&port->mutex); | ||
889 | |||
890 | for (id = 0; id < IB_UMAD_MAX_AGENTS; ++id) | ||
891 | if (file->agent[id]) | ||
892 | ib_unregister_mad_agent(file->agent[id]); | ||
893 | |||
894 | up_read(&port->mutex); | ||
895 | down_write(&port->mutex); | ||
896 | } | ||
874 | 897 | ||
875 | up_write(&port->mutex); | 898 | up_write(&port->mutex); |
876 | 899 | ||
@@ -913,7 +936,7 @@ static void ib_umad_add_one(struct ib_device *device) | |||
913 | 936 | ||
914 | err: | 937 | err: |
915 | while (--i >= s) | 938 | while (--i >= s) |
916 | ib_umad_kill_port(&umad_dev->port[i]); | 939 | ib_umad_kill_port(&umad_dev->port[i - s]); |
917 | 940 | ||
918 | kref_put(&umad_dev->ref, ib_umad_release_dev); | 941 | kref_put(&umad_dev->ref, ib_umad_release_dev); |
919 | } | 942 | } |
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 63a74151c60b..ed45da892b1c 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
@@ -708,7 +708,7 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file, | |||
708 | resp->wc[i].opcode = wc[i].opcode; | 708 | resp->wc[i].opcode = wc[i].opcode; |
709 | resp->wc[i].vendor_err = wc[i].vendor_err; | 709 | resp->wc[i].vendor_err = wc[i].vendor_err; |
710 | resp->wc[i].byte_len = wc[i].byte_len; | 710 | resp->wc[i].byte_len = wc[i].byte_len; |
711 | resp->wc[i].imm_data = wc[i].imm_data; | 711 | resp->wc[i].imm_data = (__u32 __force) wc[i].imm_data; |
712 | resp->wc[i].qp_num = wc[i].qp_num; | 712 | resp->wc[i].qp_num = wc[i].qp_num; |
713 | resp->wc[i].src_qp = wc[i].src_qp; | 713 | resp->wc[i].src_qp = wc[i].src_qp; |
714 | resp->wc[i].wc_flags = wc[i].wc_flags; | 714 | resp->wc[i].wc_flags = wc[i].wc_flags; |
@@ -908,7 +908,12 @@ retry: | |||
908 | if (ret) | 908 | if (ret) |
909 | goto err_destroy; | 909 | goto err_destroy; |
910 | 910 | ||
911 | resp.qp_handle = uobj->uobject.id; | 911 | resp.qp_handle = uobj->uobject.id; |
912 | resp.max_recv_sge = attr.cap.max_recv_sge; | ||
913 | resp.max_send_sge = attr.cap.max_send_sge; | ||
914 | resp.max_recv_wr = attr.cap.max_recv_wr; | ||
915 | resp.max_send_wr = attr.cap.max_send_wr; | ||
916 | resp.max_inline_data = attr.cap.max_inline_data; | ||
912 | 917 | ||
913 | if (copy_to_user((void __user *) (unsigned long) cmd.response, | 918 | if (copy_to_user((void __user *) (unsigned long) cmd.response, |
914 | &resp, sizeof resp)) { | 919 | &resp, sizeof resp)) { |
@@ -1135,7 +1140,7 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, | |||
1135 | next->num_sge = user_wr->num_sge; | 1140 | next->num_sge = user_wr->num_sge; |
1136 | next->opcode = user_wr->opcode; | 1141 | next->opcode = user_wr->opcode; |
1137 | next->send_flags = user_wr->send_flags; | 1142 | next->send_flags = user_wr->send_flags; |
1138 | next->imm_data = user_wr->imm_data; | 1143 | next->imm_data = (__be32 __force) user_wr->imm_data; |
1139 | 1144 | ||
1140 | if (qp->qp_type == IB_QPT_UD) { | 1145 | if (qp->qp_type == IB_QPT_UD) { |
1141 | next->wr.ud.ah = idr_find(&ib_uverbs_ah_idr, | 1146 | next->wr.ud.ah = idr_find(&ib_uverbs_ah_idr, |
@@ -1701,7 +1706,6 @@ ssize_t ib_uverbs_modify_srq(struct ib_uverbs_file *file, | |||
1701 | } | 1706 | } |
1702 | 1707 | ||
1703 | attr.max_wr = cmd.max_wr; | 1708 | attr.max_wr = cmd.max_wr; |
1704 | attr.max_sge = cmd.max_sge; | ||
1705 | attr.srq_limit = cmd.srq_limit; | 1709 | attr.srq_limit = cmd.srq_limit; |
1706 | 1710 | ||
1707 | ret = ib_modify_srq(srq, &attr, cmd.attr_mask); | 1711 | ret = ib_modify_srq(srq, &attr, cmd.attr_mask); |
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 4186cc888ea5..4c15e112736c 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c | |||
@@ -325,16 +325,8 @@ EXPORT_SYMBOL(ib_destroy_cq); | |||
325 | int ib_resize_cq(struct ib_cq *cq, | 325 | int ib_resize_cq(struct ib_cq *cq, |
326 | int cqe) | 326 | int cqe) |
327 | { | 327 | { |
328 | int ret; | 328 | return cq->device->resize_cq ? |
329 | 329 | cq->device->resize_cq(cq, cqe) : -ENOSYS; | |
330 | if (!cq->device->resize_cq) | ||
331 | return -ENOSYS; | ||
332 | |||
333 | ret = cq->device->resize_cq(cq, &cqe); | ||
334 | if (!ret) | ||
335 | cq->cqe = cqe; | ||
336 | |||
337 | return ret; | ||
338 | } | 330 | } |
339 | EXPORT_SYMBOL(ib_resize_cq); | 331 | EXPORT_SYMBOL(ib_resize_cq); |
340 | 332 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_catas.c b/drivers/infiniband/hw/mthca/mthca_catas.c index 25ebab64bc42..c3bec7490f52 100644 --- a/drivers/infiniband/hw/mthca/mthca_catas.c +++ b/drivers/infiniband/hw/mthca/mthca_catas.c | |||
@@ -97,7 +97,7 @@ static void poll_catas(unsigned long dev_ptr) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | spin_lock_irqsave(&catas_lock, flags); | 99 | spin_lock_irqsave(&catas_lock, flags); |
100 | if (dev->catas_err.stop) | 100 | if (!dev->catas_err.stop) |
101 | mod_timer(&dev->catas_err.timer, | 101 | mod_timer(&dev->catas_err.timer, |
102 | jiffies + MTHCA_CATAS_POLL_INTERVAL); | 102 | jiffies + MTHCA_CATAS_POLL_INTERVAL); |
103 | spin_unlock_irqrestore(&catas_lock, flags); | 103 | spin_unlock_irqrestore(&catas_lock, flags); |
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c index 49f211d55df7..9ed34587fc5c 100644 --- a/drivers/infiniband/hw/mthca/mthca_cmd.c +++ b/drivers/infiniband/hw/mthca/mthca_cmd.c | |||
@@ -1060,6 +1060,8 @@ int mthca_QUERY_DEV_LIM(struct mthca_dev *dev, | |||
1060 | dev_lim->hca.arbel.resize_srq = field & 1; | 1060 | dev_lim->hca.arbel.resize_srq = field & 1; |
1061 | MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_SG_RQ_OFFSET); | 1061 | MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_SG_RQ_OFFSET); |
1062 | dev_lim->max_sg = min_t(int, field, dev_lim->max_sg); | 1062 | dev_lim->max_sg = min_t(int, field, dev_lim->max_sg); |
1063 | MTHCA_GET(size, outbox, QUERY_DEV_LIM_MAX_DESC_SZ_RQ_OFFSET); | ||
1064 | dev_lim->max_desc_sz = min_t(int, size, dev_lim->max_desc_sz); | ||
1063 | MTHCA_GET(size, outbox, QUERY_DEV_LIM_MPT_ENTRY_SZ_OFFSET); | 1065 | MTHCA_GET(size, outbox, QUERY_DEV_LIM_MPT_ENTRY_SZ_OFFSET); |
1064 | dev_lim->mpt_entry_sz = size; | 1066 | dev_lim->mpt_entry_sz = size; |
1065 | MTHCA_GET(field, outbox, QUERY_DEV_LIM_PBL_SZ_OFFSET); | 1067 | MTHCA_GET(field, outbox, QUERY_DEV_LIM_PBL_SZ_OFFSET); |
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c index f98e23555826..4a8adcef2079 100644 --- a/drivers/infiniband/hw/mthca/mthca_cq.c +++ b/drivers/infiniband/hw/mthca/mthca_cq.c | |||
@@ -258,7 +258,7 @@ void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn, | |||
258 | { | 258 | { |
259 | struct mthca_cq *cq; | 259 | struct mthca_cq *cq; |
260 | struct mthca_cqe *cqe; | 260 | struct mthca_cqe *cqe; |
261 | int prod_index; | 261 | u32 prod_index; |
262 | int nfreed = 0; | 262 | int nfreed = 0; |
263 | 263 | ||
264 | spin_lock_irq(&dev->cq_table.lock); | 264 | spin_lock_irq(&dev->cq_table.lock); |
@@ -293,19 +293,15 @@ void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn, | |||
293 | * Now sweep backwards through the CQ, removing CQ entries | 293 | * Now sweep backwards through the CQ, removing CQ entries |
294 | * that match our QP by copying older entries on top of them. | 294 | * that match our QP by copying older entries on top of them. |
295 | */ | 295 | */ |
296 | while (prod_index > cq->cons_index) { | 296 | while ((int) --prod_index - (int) cq->cons_index >= 0) { |
297 | cqe = get_cqe(cq, (prod_index - 1) & cq->ibcq.cqe); | 297 | cqe = get_cqe(cq, prod_index & cq->ibcq.cqe); |
298 | if (cqe->my_qpn == cpu_to_be32(qpn)) { | 298 | if (cqe->my_qpn == cpu_to_be32(qpn)) { |
299 | if (srq) | 299 | if (srq) |
300 | mthca_free_srq_wqe(srq, be32_to_cpu(cqe->wqe)); | 300 | mthca_free_srq_wqe(srq, be32_to_cpu(cqe->wqe)); |
301 | ++nfreed; | 301 | ++nfreed; |
302 | } | 302 | } else if (nfreed) |
303 | else if (nfreed) | 303 | memcpy(get_cqe(cq, (prod_index + nfreed) & cq->ibcq.cqe), |
304 | memcpy(get_cqe(cq, (prod_index - 1 + nfreed) & | 304 | cqe, MTHCA_CQ_ENTRY_SIZE); |
305 | cq->ibcq.cqe), | ||
306 | cqe, | ||
307 | MTHCA_CQ_ENTRY_SIZE); | ||
308 | --prod_index; | ||
309 | } | 305 | } |
310 | 306 | ||
311 | if (nfreed) { | 307 | if (nfreed) { |
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h index e7e5d3b4f004..497ff794ef6a 100644 --- a/drivers/infiniband/hw/mthca/mthca_dev.h +++ b/drivers/infiniband/hw/mthca/mthca_dev.h | |||
@@ -131,6 +131,7 @@ struct mthca_limits { | |||
131 | int max_sg; | 131 | int max_sg; |
132 | int num_qps; | 132 | int num_qps; |
133 | int max_wqes; | 133 | int max_wqes; |
134 | int max_desc_sz; | ||
134 | int max_qp_init_rdma; | 135 | int max_qp_init_rdma; |
135 | int reserved_qps; | 136 | int reserved_qps; |
136 | int num_srqs; | 137 | int num_srqs; |
@@ -154,6 +155,7 @@ struct mthca_limits { | |||
154 | int reserved_mcgs; | 155 | int reserved_mcgs; |
155 | int num_pds; | 156 | int num_pds; |
156 | int reserved_pds; | 157 | int reserved_pds; |
158 | u32 page_size_cap; | ||
157 | u32 flags; | 159 | u32 flags; |
158 | u8 port_width_cap; | 160 | u8 port_width_cap; |
159 | }; | 161 | }; |
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c index 45c6328e780c..6f94b25f3acd 100644 --- a/drivers/infiniband/hw/mthca/mthca_main.c +++ b/drivers/infiniband/hw/mthca/mthca_main.c | |||
@@ -168,6 +168,7 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim | |||
168 | mdev->limits.max_srq_wqes = dev_lim->max_srq_sz; | 168 | mdev->limits.max_srq_wqes = dev_lim->max_srq_sz; |
169 | mdev->limits.reserved_srqs = dev_lim->reserved_srqs; | 169 | mdev->limits.reserved_srqs = dev_lim->reserved_srqs; |
170 | mdev->limits.reserved_eecs = dev_lim->reserved_eecs; | 170 | mdev->limits.reserved_eecs = dev_lim->reserved_eecs; |
171 | mdev->limits.max_desc_sz = dev_lim->max_desc_sz; | ||
171 | /* | 172 | /* |
172 | * Subtract 1 from the limit because we need to allocate a | 173 | * Subtract 1 from the limit because we need to allocate a |
173 | * spare CQE so the HCA HW can tell the difference between an | 174 | * spare CQE so the HCA HW can tell the difference between an |
@@ -181,6 +182,7 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim | |||
181 | mdev->limits.reserved_uars = dev_lim->reserved_uars; | 182 | mdev->limits.reserved_uars = dev_lim->reserved_uars; |
182 | mdev->limits.reserved_pds = dev_lim->reserved_pds; | 183 | mdev->limits.reserved_pds = dev_lim->reserved_pds; |
183 | mdev->limits.port_width_cap = dev_lim->max_port_width; | 184 | mdev->limits.port_width_cap = dev_lim->max_port_width; |
185 | mdev->limits.page_size_cap = ~(u32) (dev_lim->min_page_sz - 1); | ||
184 | mdev->limits.flags = dev_lim->flags; | 186 | mdev->limits.flags = dev_lim->flags; |
185 | 187 | ||
186 | /* IB_DEVICE_RESIZE_MAX_WR not supported by driver. | 188 | /* IB_DEVICE_RESIZE_MAX_WR not supported by driver. |
@@ -1196,7 +1198,6 @@ MODULE_DEVICE_TABLE(pci, mthca_pci_table); | |||
1196 | 1198 | ||
1197 | static struct pci_driver mthca_driver = { | 1199 | static struct pci_driver mthca_driver = { |
1198 | .name = DRV_NAME, | 1200 | .name = DRV_NAME, |
1199 | .owner = THIS_MODULE, | ||
1200 | .id_table = mthca_pci_table, | 1201 | .id_table = mthca_pci_table, |
1201 | .probe = mthca_init_one, | 1202 | .probe = mthca_init_one, |
1202 | .remove = __devexit_p(mthca_remove_one) | 1203 | .remove = __devexit_p(mthca_remove_one) |
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 6b0166668269..4cc7e2846df1 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c | |||
@@ -90,6 +90,7 @@ static int mthca_query_device(struct ib_device *ibdev, | |||
90 | memcpy(&props->node_guid, out_mad->data + 12, 8); | 90 | memcpy(&props->node_guid, out_mad->data + 12, 8); |
91 | 91 | ||
92 | props->max_mr_size = ~0ull; | 92 | props->max_mr_size = ~0ull; |
93 | props->page_size_cap = mdev->limits.page_size_cap; | ||
93 | props->max_qp = mdev->limits.num_qps - mdev->limits.reserved_qps; | 94 | props->max_qp = mdev->limits.num_qps - mdev->limits.reserved_qps; |
94 | props->max_qp_wr = mdev->limits.max_wqes; | 95 | props->max_qp_wr = mdev->limits.max_wqes; |
95 | props->max_sge = mdev->limits.max_sg; | 96 | props->max_sge = mdev->limits.max_sg; |
@@ -615,11 +616,11 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd, | |||
615 | return ERR_PTR(err); | 616 | return ERR_PTR(err); |
616 | } | 617 | } |
617 | 618 | ||
618 | init_attr->cap.max_inline_data = 0; | ||
619 | init_attr->cap.max_send_wr = qp->sq.max; | 619 | init_attr->cap.max_send_wr = qp->sq.max; |
620 | init_attr->cap.max_recv_wr = qp->rq.max; | 620 | init_attr->cap.max_recv_wr = qp->rq.max; |
621 | init_attr->cap.max_send_sge = qp->sq.max_gs; | 621 | init_attr->cap.max_send_sge = qp->sq.max_gs; |
622 | init_attr->cap.max_recv_sge = qp->rq.max_gs; | 622 | init_attr->cap.max_recv_sge = qp->rq.max_gs; |
623 | init_attr->cap.max_inline_data = qp->max_inline_data; | ||
623 | 624 | ||
624 | return &qp->ibqp; | 625 | return &qp->ibqp; |
625 | } | 626 | } |
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.h b/drivers/infiniband/hw/mthca/mthca_provider.h index bcd4b01a339c..1e73947b4702 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.h +++ b/drivers/infiniband/hw/mthca/mthca_provider.h | |||
@@ -251,6 +251,7 @@ struct mthca_qp { | |||
251 | struct mthca_wq sq; | 251 | struct mthca_wq sq; |
252 | enum ib_sig_type sq_policy; | 252 | enum ib_sig_type sq_policy; |
253 | int send_wqe_offset; | 253 | int send_wqe_offset; |
254 | int max_inline_data; | ||
254 | 255 | ||
255 | u64 *wrid; | 256 | u64 *wrid; |
256 | union mthca_buf queue; | 257 | union mthca_buf queue; |
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 8852ea477c21..760c418d5bc9 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -885,6 +885,48 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) | |||
885 | return err; | 885 | return err; |
886 | } | 886 | } |
887 | 887 | ||
888 | static void mthca_adjust_qp_caps(struct mthca_dev *dev, | ||
889 | struct mthca_pd *pd, | ||
890 | struct mthca_qp *qp) | ||
891 | { | ||
892 | int max_data_size; | ||
893 | |||
894 | /* | ||
895 | * Calculate the maximum size of WQE s/g segments, excluding | ||
896 | * the next segment and other non-data segments. | ||
897 | */ | ||
898 | max_data_size = min(dev->limits.max_desc_sz, 1 << qp->sq.wqe_shift) - | ||
899 | sizeof (struct mthca_next_seg); | ||
900 | |||
901 | switch (qp->transport) { | ||
902 | case MLX: | ||
903 | max_data_size -= 2 * sizeof (struct mthca_data_seg); | ||
904 | break; | ||
905 | |||
906 | case UD: | ||
907 | if (mthca_is_memfree(dev)) | ||
908 | max_data_size -= sizeof (struct mthca_arbel_ud_seg); | ||
909 | else | ||
910 | max_data_size -= sizeof (struct mthca_tavor_ud_seg); | ||
911 | break; | ||
912 | |||
913 | default: | ||
914 | max_data_size -= sizeof (struct mthca_raddr_seg); | ||
915 | break; | ||
916 | } | ||
917 | |||
918 | /* We don't support inline data for kernel QPs (yet). */ | ||
919 | if (!pd->ibpd.uobject) | ||
920 | qp->max_inline_data = 0; | ||
921 | else | ||
922 | qp->max_inline_data = max_data_size - MTHCA_INLINE_HEADER_SIZE; | ||
923 | |||
924 | qp->sq.max_gs = max_data_size / sizeof (struct mthca_data_seg); | ||
925 | qp->rq.max_gs = (min(dev->limits.max_desc_sz, 1 << qp->rq.wqe_shift) - | ||
926 | sizeof (struct mthca_next_seg)) / | ||
927 | sizeof (struct mthca_data_seg); | ||
928 | } | ||
929 | |||
888 | /* | 930 | /* |
889 | * Allocate and register buffer for WQEs. qp->rq.max, sq.max, | 931 | * Allocate and register buffer for WQEs. qp->rq.max, sq.max, |
890 | * rq.max_gs and sq.max_gs must all be assigned. | 932 | * rq.max_gs and sq.max_gs must all be assigned. |
@@ -902,27 +944,53 @@ static int mthca_alloc_wqe_buf(struct mthca_dev *dev, | |||
902 | size = sizeof (struct mthca_next_seg) + | 944 | size = sizeof (struct mthca_next_seg) + |
903 | qp->rq.max_gs * sizeof (struct mthca_data_seg); | 945 | qp->rq.max_gs * sizeof (struct mthca_data_seg); |
904 | 946 | ||
947 | if (size > dev->limits.max_desc_sz) | ||
948 | return -EINVAL; | ||
949 | |||
905 | for (qp->rq.wqe_shift = 6; 1 << qp->rq.wqe_shift < size; | 950 | for (qp->rq.wqe_shift = 6; 1 << qp->rq.wqe_shift < size; |
906 | qp->rq.wqe_shift++) | 951 | qp->rq.wqe_shift++) |
907 | ; /* nothing */ | 952 | ; /* nothing */ |
908 | 953 | ||
909 | size = sizeof (struct mthca_next_seg) + | 954 | size = qp->sq.max_gs * sizeof (struct mthca_data_seg); |
910 | qp->sq.max_gs * sizeof (struct mthca_data_seg); | ||
911 | switch (qp->transport) { | 955 | switch (qp->transport) { |
912 | case MLX: | 956 | case MLX: |
913 | size += 2 * sizeof (struct mthca_data_seg); | 957 | size += 2 * sizeof (struct mthca_data_seg); |
914 | break; | 958 | break; |
959 | |||
915 | case UD: | 960 | case UD: |
916 | if (mthca_is_memfree(dev)) | 961 | size += mthca_is_memfree(dev) ? |
917 | size += sizeof (struct mthca_arbel_ud_seg); | 962 | sizeof (struct mthca_arbel_ud_seg) : |
918 | else | 963 | sizeof (struct mthca_tavor_ud_seg); |
919 | size += sizeof (struct mthca_tavor_ud_seg); | ||
920 | break; | 964 | break; |
965 | |||
966 | case UC: | ||
967 | size += sizeof (struct mthca_raddr_seg); | ||
968 | break; | ||
969 | |||
970 | case RC: | ||
971 | size += sizeof (struct mthca_raddr_seg); | ||
972 | /* | ||
973 | * An atomic op will require an atomic segment, a | ||
974 | * remote address segment and one scatter entry. | ||
975 | */ | ||
976 | size = max_t(int, size, | ||
977 | sizeof (struct mthca_atomic_seg) + | ||
978 | sizeof (struct mthca_raddr_seg) + | ||
979 | sizeof (struct mthca_data_seg)); | ||
980 | break; | ||
981 | |||
921 | default: | 982 | default: |
922 | /* bind seg is as big as atomic + raddr segs */ | 983 | break; |
923 | size += sizeof (struct mthca_bind_seg); | ||
924 | } | 984 | } |
925 | 985 | ||
986 | /* Make sure that we have enough space for a bind request */ | ||
987 | size = max_t(int, size, sizeof (struct mthca_bind_seg)); | ||
988 | |||
989 | size += sizeof (struct mthca_next_seg); | ||
990 | |||
991 | if (size > dev->limits.max_desc_sz) | ||
992 | return -EINVAL; | ||
993 | |||
926 | for (qp->sq.wqe_shift = 6; 1 << qp->sq.wqe_shift < size; | 994 | for (qp->sq.wqe_shift = 6; 1 << qp->sq.wqe_shift < size; |
927 | qp->sq.wqe_shift++) | 995 | qp->sq.wqe_shift++) |
928 | ; /* nothing */ | 996 | ; /* nothing */ |
@@ -1066,6 +1134,8 @@ static int mthca_alloc_qp_common(struct mthca_dev *dev, | |||
1066 | return ret; | 1134 | return ret; |
1067 | } | 1135 | } |
1068 | 1136 | ||
1137 | mthca_adjust_qp_caps(dev, pd, qp); | ||
1138 | |||
1069 | /* | 1139 | /* |
1070 | * If this is a userspace QP, we're done now. The doorbells | 1140 | * If this is a userspace QP, we're done now. The doorbells |
1071 | * will be allocated and buffers will be initialized in | 1141 | * will be allocated and buffers will be initialized in |
@@ -1486,8 +1556,8 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
1486 | } | 1556 | } |
1487 | 1557 | ||
1488 | wqe += sizeof (struct mthca_atomic_seg); | 1558 | wqe += sizeof (struct mthca_atomic_seg); |
1489 | size += sizeof (struct mthca_raddr_seg) / 16 + | 1559 | size += (sizeof (struct mthca_raddr_seg) + |
1490 | sizeof (struct mthca_atomic_seg); | 1560 | sizeof (struct mthca_atomic_seg)) / 16; |
1491 | break; | 1561 | break; |
1492 | 1562 | ||
1493 | case IB_WR_RDMA_WRITE: | 1563 | case IB_WR_RDMA_WRITE: |
@@ -1637,6 +1707,7 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
1637 | { | 1707 | { |
1638 | struct mthca_dev *dev = to_mdev(ibqp->device); | 1708 | struct mthca_dev *dev = to_mdev(ibqp->device); |
1639 | struct mthca_qp *qp = to_mqp(ibqp); | 1709 | struct mthca_qp *qp = to_mqp(ibqp); |
1710 | __be32 doorbell[2]; | ||
1640 | unsigned long flags; | 1711 | unsigned long flags; |
1641 | int err = 0; | 1712 | int err = 0; |
1642 | int nreq; | 1713 | int nreq; |
@@ -1654,6 +1725,22 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
1654 | ind = qp->rq.next_ind; | 1725 | ind = qp->rq.next_ind; |
1655 | 1726 | ||
1656 | for (nreq = 0; wr; ++nreq, wr = wr->next) { | 1727 | for (nreq = 0; wr; ++nreq, wr = wr->next) { |
1728 | if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) { | ||
1729 | nreq = 0; | ||
1730 | |||
1731 | doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0); | ||
1732 | doorbell[1] = cpu_to_be32(qp->qpn << 8); | ||
1733 | |||
1734 | wmb(); | ||
1735 | |||
1736 | mthca_write64(doorbell, | ||
1737 | dev->kar + MTHCA_RECEIVE_DOORBELL, | ||
1738 | MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); | ||
1739 | |||
1740 | qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB; | ||
1741 | size0 = 0; | ||
1742 | } | ||
1743 | |||
1657 | if (mthca_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) { | 1744 | if (mthca_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) { |
1658 | mthca_err(dev, "RQ %06x full (%u head, %u tail," | 1745 | mthca_err(dev, "RQ %06x full (%u head, %u tail," |
1659 | " %d max, %d nreq)\n", qp->qpn, | 1746 | " %d max, %d nreq)\n", qp->qpn, |
@@ -1711,8 +1798,6 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
1711 | 1798 | ||
1712 | out: | 1799 | out: |
1713 | if (likely(nreq)) { | 1800 | if (likely(nreq)) { |
1714 | __be32 doorbell[2]; | ||
1715 | |||
1716 | doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0); | 1801 | doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0); |
1717 | doorbell[1] = cpu_to_be32((qp->qpn << 8) | nreq); | 1802 | doorbell[1] = cpu_to_be32((qp->qpn << 8) | nreq); |
1718 | 1803 | ||
@@ -1806,8 +1891,8 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
1806 | } | 1891 | } |
1807 | 1892 | ||
1808 | wqe += sizeof (struct mthca_atomic_seg); | 1893 | wqe += sizeof (struct mthca_atomic_seg); |
1809 | size += sizeof (struct mthca_raddr_seg) / 16 + | 1894 | size += (sizeof (struct mthca_raddr_seg) + |
1810 | sizeof (struct mthca_atomic_seg); | 1895 | sizeof (struct mthca_atomic_seg)) / 16; |
1811 | break; | 1896 | break; |
1812 | 1897 | ||
1813 | case IB_WR_RDMA_READ: | 1898 | case IB_WR_RDMA_READ: |
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c index 26d5161fde07..f7d234295efe 100644 --- a/drivers/infiniband/hw/mthca/mthca_srq.c +++ b/drivers/infiniband/hw/mthca/mthca_srq.c | |||
@@ -417,6 +417,7 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
417 | { | 417 | { |
418 | struct mthca_dev *dev = to_mdev(ibsrq->device); | 418 | struct mthca_dev *dev = to_mdev(ibsrq->device); |
419 | struct mthca_srq *srq = to_msrq(ibsrq); | 419 | struct mthca_srq *srq = to_msrq(ibsrq); |
420 | __be32 doorbell[2]; | ||
420 | unsigned long flags; | 421 | unsigned long flags; |
421 | int err = 0; | 422 | int err = 0; |
422 | int first_ind; | 423 | int first_ind; |
@@ -432,6 +433,25 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
432 | first_ind = srq->first_free; | 433 | first_ind = srq->first_free; |
433 | 434 | ||
434 | for (nreq = 0; wr; ++nreq, wr = wr->next) { | 435 | for (nreq = 0; wr; ++nreq, wr = wr->next) { |
436 | if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) { | ||
437 | nreq = 0; | ||
438 | |||
439 | doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift); | ||
440 | doorbell[1] = cpu_to_be32(srq->srqn << 8); | ||
441 | |||
442 | /* | ||
443 | * Make sure that descriptors are written | ||
444 | * before doorbell is rung. | ||
445 | */ | ||
446 | wmb(); | ||
447 | |||
448 | mthca_write64(doorbell, | ||
449 | dev->kar + MTHCA_RECEIVE_DOORBELL, | ||
450 | MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); | ||
451 | |||
452 | first_ind = srq->first_free; | ||
453 | } | ||
454 | |||
435 | ind = srq->first_free; | 455 | ind = srq->first_free; |
436 | 456 | ||
437 | if (ind < 0) { | 457 | if (ind < 0) { |
@@ -494,8 +514,6 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
494 | } | 514 | } |
495 | 515 | ||
496 | if (likely(nreq)) { | 516 | if (likely(nreq)) { |
497 | __be32 doorbell[2]; | ||
498 | |||
499 | doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift); | 517 | doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift); |
500 | doorbell[1] = cpu_to_be32((srq->srqn << 8) | nreq); | 518 | doorbell[1] = cpu_to_be32((srq->srqn << 8) | nreq); |
501 | 519 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_wqe.h b/drivers/infiniband/hw/mthca/mthca_wqe.h index 1f4c0ff28f79..73f1c0b9021e 100644 --- a/drivers/infiniband/hw/mthca/mthca_wqe.h +++ b/drivers/infiniband/hw/mthca/mthca_wqe.h | |||
@@ -49,7 +49,8 @@ enum { | |||
49 | }; | 49 | }; |
50 | 50 | ||
51 | enum { | 51 | enum { |
52 | MTHCA_INVAL_LKEY = 0x100 | 52 | MTHCA_INVAL_LKEY = 0x100, |
53 | MTHCA_TAVOR_MAX_WQES_PER_RECV_DB = 256 | ||
53 | }; | 54 | }; |
54 | 55 | ||
55 | struct mthca_next_seg { | 56 | struct mthca_next_seg { |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 0095acc0fbbe..9923a15a9996 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -179,6 +179,7 @@ struct ipoib_dev_priv { | |||
179 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG | 179 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG |
180 | struct list_head fs_list; | 180 | struct list_head fs_list; |
181 | struct dentry *mcg_dentry; | 181 | struct dentry *mcg_dentry; |
182 | struct dentry *path_dentry; | ||
182 | #endif | 183 | #endif |
183 | }; | 184 | }; |
184 | 185 | ||
@@ -270,7 +271,6 @@ void ipoib_mcast_dev_flush(struct net_device *dev); | |||
270 | 271 | ||
271 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG | 272 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG |
272 | struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct net_device *dev); | 273 | struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct net_device *dev); |
273 | void ipoib_mcast_iter_free(struct ipoib_mcast_iter *iter); | ||
274 | int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter); | 274 | int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter); |
275 | void ipoib_mcast_iter_read(struct ipoib_mcast_iter *iter, | 275 | void ipoib_mcast_iter_read(struct ipoib_mcast_iter *iter, |
276 | union ib_gid *gid, | 276 | union ib_gid *gid, |
@@ -278,6 +278,11 @@ void ipoib_mcast_iter_read(struct ipoib_mcast_iter *iter, | |||
278 | unsigned int *queuelen, | 278 | unsigned int *queuelen, |
279 | unsigned int *complete, | 279 | unsigned int *complete, |
280 | unsigned int *send_only); | 280 | unsigned int *send_only); |
281 | |||
282 | struct ipoib_path_iter *ipoib_path_iter_init(struct net_device *dev); | ||
283 | int ipoib_path_iter_next(struct ipoib_path_iter *iter); | ||
284 | void ipoib_path_iter_read(struct ipoib_path_iter *iter, | ||
285 | struct ipoib_path *path); | ||
281 | #endif | 286 | #endif |
282 | 287 | ||
283 | int ipoib_mcast_attach(struct net_device *dev, u16 mlid, | 288 | int ipoib_mcast_attach(struct net_device *dev, u16 mlid, |
@@ -299,13 +304,13 @@ void ipoib_pkey_poll(void *dev); | |||
299 | int ipoib_pkey_dev_delay_open(struct net_device *dev); | 304 | int ipoib_pkey_dev_delay_open(struct net_device *dev); |
300 | 305 | ||
301 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG | 306 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG |
302 | int ipoib_create_debug_file(struct net_device *dev); | 307 | void ipoib_create_debug_files(struct net_device *dev); |
303 | void ipoib_delete_debug_file(struct net_device *dev); | 308 | void ipoib_delete_debug_files(struct net_device *dev); |
304 | int ipoib_register_debugfs(void); | 309 | int ipoib_register_debugfs(void); |
305 | void ipoib_unregister_debugfs(void); | 310 | void ipoib_unregister_debugfs(void); |
306 | #else | 311 | #else |
307 | static inline int ipoib_create_debug_file(struct net_device *dev) { return 0; } | 312 | static inline void ipoib_create_debug_files(struct net_device *dev) { } |
308 | static inline void ipoib_delete_debug_file(struct net_device *dev) { } | 313 | static inline void ipoib_delete_debug_files(struct net_device *dev) { } |
309 | static inline int ipoib_register_debugfs(void) { return 0; } | 314 | static inline int ipoib_register_debugfs(void) { return 0; } |
310 | static inline void ipoib_unregister_debugfs(void) { } | 315 | static inline void ipoib_unregister_debugfs(void) { } |
311 | #endif | 316 | #endif |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_fs.c b/drivers/infiniband/ulp/ipoib/ipoib_fs.c index 38b150f775e7..685258e34034 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_fs.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_fs.c | |||
@@ -43,6 +43,18 @@ struct file_operations; | |||
43 | 43 | ||
44 | static struct dentry *ipoib_root; | 44 | static struct dentry *ipoib_root; |
45 | 45 | ||
46 | static void format_gid(union ib_gid *gid, char *buf) | ||
47 | { | ||
48 | int i, n; | ||
49 | |||
50 | for (n = 0, i = 0; i < 8; ++i) { | ||
51 | n += sprintf(buf + n, "%x", | ||
52 | be16_to_cpu(((__be16 *) gid->raw)[i])); | ||
53 | if (i < 7) | ||
54 | buf[n++] = ':'; | ||
55 | } | ||
56 | } | ||
57 | |||
46 | static void *ipoib_mcg_seq_start(struct seq_file *file, loff_t *pos) | 58 | static void *ipoib_mcg_seq_start(struct seq_file *file, loff_t *pos) |
47 | { | 59 | { |
48 | struct ipoib_mcast_iter *iter; | 60 | struct ipoib_mcast_iter *iter; |
@@ -54,7 +66,7 @@ static void *ipoib_mcg_seq_start(struct seq_file *file, loff_t *pos) | |||
54 | 66 | ||
55 | while (n--) { | 67 | while (n--) { |
56 | if (ipoib_mcast_iter_next(iter)) { | 68 | if (ipoib_mcast_iter_next(iter)) { |
57 | ipoib_mcast_iter_free(iter); | 69 | kfree(iter); |
58 | return NULL; | 70 | return NULL; |
59 | } | 71 | } |
60 | } | 72 | } |
@@ -70,7 +82,7 @@ static void *ipoib_mcg_seq_next(struct seq_file *file, void *iter_ptr, | |||
70 | (*pos)++; | 82 | (*pos)++; |
71 | 83 | ||
72 | if (ipoib_mcast_iter_next(iter)) { | 84 | if (ipoib_mcast_iter_next(iter)) { |
73 | ipoib_mcast_iter_free(iter); | 85 | kfree(iter); |
74 | return NULL; | 86 | return NULL; |
75 | } | 87 | } |
76 | 88 | ||
@@ -87,32 +99,32 @@ static int ipoib_mcg_seq_show(struct seq_file *file, void *iter_ptr) | |||
87 | struct ipoib_mcast_iter *iter = iter_ptr; | 99 | struct ipoib_mcast_iter *iter = iter_ptr; |
88 | char gid_buf[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"]; | 100 | char gid_buf[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"]; |
89 | union ib_gid mgid; | 101 | union ib_gid mgid; |
90 | int i, n; | ||
91 | unsigned long created; | 102 | unsigned long created; |
92 | unsigned int queuelen, complete, send_only; | 103 | unsigned int queuelen, complete, send_only; |
93 | 104 | ||
94 | if (iter) { | 105 | if (!iter) |
95 | ipoib_mcast_iter_read(iter, &mgid, &created, &queuelen, | 106 | return 0; |
96 | &complete, &send_only); | ||
97 | 107 | ||
98 | for (n = 0, i = 0; i < sizeof mgid / 2; ++i) { | 108 | ipoib_mcast_iter_read(iter, &mgid, &created, &queuelen, |
99 | n += sprintf(gid_buf + n, "%x", | 109 | &complete, &send_only); |
100 | be16_to_cpu(((__be16 *) mgid.raw)[i])); | ||
101 | if (i < sizeof mgid / 2 - 1) | ||
102 | gid_buf[n++] = ':'; | ||
103 | } | ||
104 | } | ||
105 | 110 | ||
106 | seq_printf(file, "GID: %*s", -(1 + (int) sizeof gid_buf), gid_buf); | 111 | format_gid(&mgid, gid_buf); |
107 | 112 | ||
108 | seq_printf(file, | 113 | seq_printf(file, |
109 | " created: %10ld queuelen: %4d complete: %d send_only: %d\n", | 114 | "GID: %s\n" |
110 | created, queuelen, complete, send_only); | 115 | " created: %10ld\n" |
116 | " queuelen: %9d\n" | ||
117 | " complete: %9s\n" | ||
118 | " send_only: %8s\n" | ||
119 | "\n", | ||
120 | gid_buf, created, queuelen, | ||
121 | complete ? "yes" : "no", | ||
122 | send_only ? "yes" : "no"); | ||
111 | 123 | ||
112 | return 0; | 124 | return 0; |
113 | } | 125 | } |
114 | 126 | ||
115 | static struct seq_operations ipoib_seq_ops = { | 127 | static struct seq_operations ipoib_mcg_seq_ops = { |
116 | .start = ipoib_mcg_seq_start, | 128 | .start = ipoib_mcg_seq_start, |
117 | .next = ipoib_mcg_seq_next, | 129 | .next = ipoib_mcg_seq_next, |
118 | .stop = ipoib_mcg_seq_stop, | 130 | .stop = ipoib_mcg_seq_stop, |
@@ -124,7 +136,7 @@ static int ipoib_mcg_open(struct inode *inode, struct file *file) | |||
124 | struct seq_file *seq; | 136 | struct seq_file *seq; |
125 | int ret; | 137 | int ret; |
126 | 138 | ||
127 | ret = seq_open(file, &ipoib_seq_ops); | 139 | ret = seq_open(file, &ipoib_mcg_seq_ops); |
128 | if (ret) | 140 | if (ret) |
129 | return ret; | 141 | return ret; |
130 | 142 | ||
@@ -134,7 +146,7 @@ static int ipoib_mcg_open(struct inode *inode, struct file *file) | |||
134 | return 0; | 146 | return 0; |
135 | } | 147 | } |
136 | 148 | ||
137 | static struct file_operations ipoib_fops = { | 149 | static struct file_operations ipoib_mcg_fops = { |
138 | .owner = THIS_MODULE, | 150 | .owner = THIS_MODULE, |
139 | .open = ipoib_mcg_open, | 151 | .open = ipoib_mcg_open, |
140 | .read = seq_read, | 152 | .read = seq_read, |
@@ -142,25 +154,138 @@ static struct file_operations ipoib_fops = { | |||
142 | .release = seq_release | 154 | .release = seq_release |
143 | }; | 155 | }; |
144 | 156 | ||
145 | int ipoib_create_debug_file(struct net_device *dev) | 157 | static void *ipoib_path_seq_start(struct seq_file *file, loff_t *pos) |
158 | { | ||
159 | struct ipoib_path_iter *iter; | ||
160 | loff_t n = *pos; | ||
161 | |||
162 | iter = ipoib_path_iter_init(file->private); | ||
163 | if (!iter) | ||
164 | return NULL; | ||
165 | |||
166 | while (n--) { | ||
167 | if (ipoib_path_iter_next(iter)) { | ||
168 | kfree(iter); | ||
169 | return NULL; | ||
170 | } | ||
171 | } | ||
172 | |||
173 | return iter; | ||
174 | } | ||
175 | |||
176 | static void *ipoib_path_seq_next(struct seq_file *file, void *iter_ptr, | ||
177 | loff_t *pos) | ||
178 | { | ||
179 | struct ipoib_path_iter *iter = iter_ptr; | ||
180 | |||
181 | (*pos)++; | ||
182 | |||
183 | if (ipoib_path_iter_next(iter)) { | ||
184 | kfree(iter); | ||
185 | return NULL; | ||
186 | } | ||
187 | |||
188 | return iter; | ||
189 | } | ||
190 | |||
191 | static void ipoib_path_seq_stop(struct seq_file *file, void *iter_ptr) | ||
192 | { | ||
193 | /* nothing for now */ | ||
194 | } | ||
195 | |||
196 | static int ipoib_path_seq_show(struct seq_file *file, void *iter_ptr) | ||
197 | { | ||
198 | struct ipoib_path_iter *iter = iter_ptr; | ||
199 | char gid_buf[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"]; | ||
200 | struct ipoib_path path; | ||
201 | int rate; | ||
202 | |||
203 | if (!iter) | ||
204 | return 0; | ||
205 | |||
206 | ipoib_path_iter_read(iter, &path); | ||
207 | |||
208 | format_gid(&path.pathrec.dgid, gid_buf); | ||
209 | |||
210 | seq_printf(file, | ||
211 | "GID: %s\n" | ||
212 | " complete: %6s\n", | ||
213 | gid_buf, path.pathrec.dlid ? "yes" : "no"); | ||
214 | |||
215 | if (path.pathrec.dlid) { | ||
216 | rate = ib_sa_rate_enum_to_int(path.pathrec.rate) * 25; | ||
217 | |||
218 | seq_printf(file, | ||
219 | " DLID: 0x%04x\n" | ||
220 | " SL: %12d\n" | ||
221 | " rate: %*d%s Gb/sec\n", | ||
222 | be16_to_cpu(path.pathrec.dlid), | ||
223 | path.pathrec.sl, | ||
224 | 10 - ((rate % 10) ? 2 : 0), | ||
225 | rate / 10, rate % 10 ? ".5" : ""); | ||
226 | } | ||
227 | |||
228 | seq_putc(file, '\n'); | ||
229 | |||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | static struct seq_operations ipoib_path_seq_ops = { | ||
234 | .start = ipoib_path_seq_start, | ||
235 | .next = ipoib_path_seq_next, | ||
236 | .stop = ipoib_path_seq_stop, | ||
237 | .show = ipoib_path_seq_show, | ||
238 | }; | ||
239 | |||
240 | static int ipoib_path_open(struct inode *inode, struct file *file) | ||
241 | { | ||
242 | struct seq_file *seq; | ||
243 | int ret; | ||
244 | |||
245 | ret = seq_open(file, &ipoib_path_seq_ops); | ||
246 | if (ret) | ||
247 | return ret; | ||
248 | |||
249 | seq = file->private_data; | ||
250 | seq->private = inode->u.generic_ip; | ||
251 | |||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | static struct file_operations ipoib_path_fops = { | ||
256 | .owner = THIS_MODULE, | ||
257 | .open = ipoib_path_open, | ||
258 | .read = seq_read, | ||
259 | .llseek = seq_lseek, | ||
260 | .release = seq_release | ||
261 | }; | ||
262 | |||
263 | void ipoib_create_debug_files(struct net_device *dev) | ||
146 | { | 264 | { |
147 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 265 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
148 | char name[IFNAMSIZ + sizeof "_mcg"]; | 266 | char name[IFNAMSIZ + sizeof "_path"]; |
149 | 267 | ||
150 | snprintf(name, sizeof name, "%s_mcg", dev->name); | 268 | snprintf(name, sizeof name, "%s_mcg", dev->name); |
151 | |||
152 | priv->mcg_dentry = debugfs_create_file(name, S_IFREG | S_IRUGO, | 269 | priv->mcg_dentry = debugfs_create_file(name, S_IFREG | S_IRUGO, |
153 | ipoib_root, dev, &ipoib_fops); | 270 | ipoib_root, dev, &ipoib_mcg_fops); |
154 | 271 | if (!priv->mcg_dentry) | |
155 | return priv->mcg_dentry ? 0 : -ENOMEM; | 272 | ipoib_warn(priv, "failed to create mcg debug file\n"); |
273 | |||
274 | snprintf(name, sizeof name, "%s_path", dev->name); | ||
275 | priv->path_dentry = debugfs_create_file(name, S_IFREG | S_IRUGO, | ||
276 | ipoib_root, dev, &ipoib_path_fops); | ||
277 | if (!priv->path_dentry) | ||
278 | ipoib_warn(priv, "failed to create path debug file\n"); | ||
156 | } | 279 | } |
157 | 280 | ||
158 | void ipoib_delete_debug_file(struct net_device *dev) | 281 | void ipoib_delete_debug_files(struct net_device *dev) |
159 | { | 282 | { |
160 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 283 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
161 | 284 | ||
162 | if (priv->mcg_dentry) | 285 | if (priv->mcg_dentry) |
163 | debugfs_remove(priv->mcg_dentry); | 286 | debugfs_remove(priv->mcg_dentry); |
287 | if (priv->path_dentry) | ||
288 | debugfs_remove(priv->path_dentry); | ||
164 | } | 289 | } |
165 | 290 | ||
166 | int ipoib_register_debugfs(void) | 291 | int ipoib_register_debugfs(void) |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index ce0296273e76..2fa30751f362 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -58,6 +58,11 @@ module_param_named(debug_level, ipoib_debug_level, int, 0644); | |||
58 | MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0"); | 58 | MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0"); |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | struct ipoib_path_iter { | ||
62 | struct net_device *dev; | ||
63 | struct ipoib_path path; | ||
64 | }; | ||
65 | |||
61 | static const u8 ipv4_bcast_addr[] = { | 66 | static const u8 ipv4_bcast_addr[] = { |
62 | 0x00, 0xff, 0xff, 0xff, | 67 | 0x00, 0xff, 0xff, 0xff, |
63 | 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00, | 68 | 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00, |
@@ -250,6 +255,64 @@ static void path_free(struct net_device *dev, struct ipoib_path *path) | |||
250 | kfree(path); | 255 | kfree(path); |
251 | } | 256 | } |
252 | 257 | ||
258 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG | ||
259 | |||
260 | struct ipoib_path_iter *ipoib_path_iter_init(struct net_device *dev) | ||
261 | { | ||
262 | struct ipoib_path_iter *iter; | ||
263 | |||
264 | iter = kmalloc(sizeof *iter, GFP_KERNEL); | ||
265 | if (!iter) | ||
266 | return NULL; | ||
267 | |||
268 | iter->dev = dev; | ||
269 | memset(iter->path.pathrec.dgid.raw, 0, 16); | ||
270 | |||
271 | if (ipoib_path_iter_next(iter)) { | ||
272 | kfree(iter); | ||
273 | return NULL; | ||
274 | } | ||
275 | |||
276 | return iter; | ||
277 | } | ||
278 | |||
279 | int ipoib_path_iter_next(struct ipoib_path_iter *iter) | ||
280 | { | ||
281 | struct ipoib_dev_priv *priv = netdev_priv(iter->dev); | ||
282 | struct rb_node *n; | ||
283 | struct ipoib_path *path; | ||
284 | int ret = 1; | ||
285 | |||
286 | spin_lock_irq(&priv->lock); | ||
287 | |||
288 | n = rb_first(&priv->path_tree); | ||
289 | |||
290 | while (n) { | ||
291 | path = rb_entry(n, struct ipoib_path, rb_node); | ||
292 | |||
293 | if (memcmp(iter->path.pathrec.dgid.raw, path->pathrec.dgid.raw, | ||
294 | sizeof (union ib_gid)) < 0) { | ||
295 | iter->path = *path; | ||
296 | ret = 0; | ||
297 | break; | ||
298 | } | ||
299 | |||
300 | n = rb_next(n); | ||
301 | } | ||
302 | |||
303 | spin_unlock_irq(&priv->lock); | ||
304 | |||
305 | return ret; | ||
306 | } | ||
307 | |||
308 | void ipoib_path_iter_read(struct ipoib_path_iter *iter, | ||
309 | struct ipoib_path *path) | ||
310 | { | ||
311 | *path = iter->path; | ||
312 | } | ||
313 | |||
314 | #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG */ | ||
315 | |||
253 | void ipoib_flush_paths(struct net_device *dev) | 316 | void ipoib_flush_paths(struct net_device *dev) |
254 | { | 317 | { |
255 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 318 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
@@ -763,7 +826,7 @@ void ipoib_dev_cleanup(struct net_device *dev) | |||
763 | { | 826 | { |
764 | struct ipoib_dev_priv *priv = netdev_priv(dev), *cpriv, *tcpriv; | 827 | struct ipoib_dev_priv *priv = netdev_priv(dev), *cpriv, *tcpriv; |
765 | 828 | ||
766 | ipoib_delete_debug_file(dev); | 829 | ipoib_delete_debug_files(dev); |
767 | 830 | ||
768 | /* Delete any child interfaces first */ | 831 | /* Delete any child interfaces first */ |
769 | list_for_each_entry_safe(cpriv, tcpriv, &priv->child_intfs, list) { | 832 | list_for_each_entry_safe(cpriv, tcpriv, &priv->child_intfs, list) { |
@@ -972,8 +1035,7 @@ static struct net_device *ipoib_add_port(const char *format, | |||
972 | goto register_failed; | 1035 | goto register_failed; |
973 | } | 1036 | } |
974 | 1037 | ||
975 | if (ipoib_create_debug_file(priv->dev)) | 1038 | ipoib_create_debug_files(priv->dev); |
976 | goto debug_failed; | ||
977 | 1039 | ||
978 | if (ipoib_add_pkey_attr(priv->dev)) | 1040 | if (ipoib_add_pkey_attr(priv->dev)) |
979 | goto sysfs_failed; | 1041 | goto sysfs_failed; |
@@ -987,9 +1049,7 @@ static struct net_device *ipoib_add_port(const char *format, | |||
987 | return priv->dev; | 1049 | return priv->dev; |
988 | 1050 | ||
989 | sysfs_failed: | 1051 | sysfs_failed: |
990 | ipoib_delete_debug_file(priv->dev); | 1052 | ipoib_delete_debug_files(priv->dev); |
991 | |||
992 | debug_failed: | ||
993 | unregister_netdev(priv->dev); | 1053 | unregister_netdev(priv->dev); |
994 | 1054 | ||
995 | register_failed: | 1055 | register_failed: |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 3ecf78a9493a..c33ed87f9dff 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -120,12 +120,8 @@ static void ipoib_mcast_free(struct ipoib_mcast *mcast) | |||
120 | if (mcast->ah) | 120 | if (mcast->ah) |
121 | ipoib_put_ah(mcast->ah); | 121 | ipoib_put_ah(mcast->ah); |
122 | 122 | ||
123 | while (!skb_queue_empty(&mcast->pkt_queue)) { | 123 | while (!skb_queue_empty(&mcast->pkt_queue)) |
124 | struct sk_buff *skb = skb_dequeue(&mcast->pkt_queue); | 124 | dev_kfree_skb_any(skb_dequeue(&mcast->pkt_queue)); |
125 | |||
126 | skb->dev = dev; | ||
127 | dev_kfree_skb_any(skb); | ||
128 | } | ||
129 | 125 | ||
130 | kfree(mcast); | 126 | kfree(mcast); |
131 | } | 127 | } |
@@ -317,13 +313,8 @@ ipoib_mcast_sendonly_join_complete(int status, | |||
317 | IPOIB_GID_ARG(mcast->mcmember.mgid), status); | 313 | IPOIB_GID_ARG(mcast->mcmember.mgid), status); |
318 | 314 | ||
319 | /* Flush out any queued packets */ | 315 | /* Flush out any queued packets */ |
320 | while (!skb_queue_empty(&mcast->pkt_queue)) { | 316 | while (!skb_queue_empty(&mcast->pkt_queue)) |
321 | struct sk_buff *skb = skb_dequeue(&mcast->pkt_queue); | 317 | dev_kfree_skb_any(skb_dequeue(&mcast->pkt_queue)); |
322 | |||
323 | skb->dev = dev; | ||
324 | |||
325 | dev_kfree_skb_any(skb); | ||
326 | } | ||
327 | 318 | ||
328 | /* Clear the busy flag so we try again */ | 319 | /* Clear the busy flag so we try again */ |
329 | clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); | 320 | clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); |
@@ -928,21 +919,16 @@ struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct net_device *dev) | |||
928 | return NULL; | 919 | return NULL; |
929 | 920 | ||
930 | iter->dev = dev; | 921 | iter->dev = dev; |
931 | memset(iter->mgid.raw, 0, sizeof iter->mgid); | 922 | memset(iter->mgid.raw, 0, 16); |
932 | 923 | ||
933 | if (ipoib_mcast_iter_next(iter)) { | 924 | if (ipoib_mcast_iter_next(iter)) { |
934 | ipoib_mcast_iter_free(iter); | 925 | kfree(iter); |
935 | return NULL; | 926 | return NULL; |
936 | } | 927 | } |
937 | 928 | ||
938 | return iter; | 929 | return iter; |
939 | } | 930 | } |
940 | 931 | ||
941 | void ipoib_mcast_iter_free(struct ipoib_mcast_iter *iter) | ||
942 | { | ||
943 | kfree(iter); | ||
944 | } | ||
945 | |||
946 | int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter) | 932 | int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter) |
947 | { | 933 | { |
948 | struct ipoib_dev_priv *priv = netdev_priv(iter->dev); | 934 | struct ipoib_dev_priv *priv = netdev_priv(iter->dev); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c index 332d730e60c2..d280b341a37f 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c | |||
@@ -113,8 +113,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) | |||
113 | 113 | ||
114 | priv->parent = ppriv->dev; | 114 | priv->parent = ppriv->dev; |
115 | 115 | ||
116 | if (ipoib_create_debug_file(priv->dev)) | 116 | ipoib_create_debug_files(priv->dev); |
117 | goto debug_failed; | ||
118 | 117 | ||
119 | if (ipoib_add_pkey_attr(priv->dev)) | 118 | if (ipoib_add_pkey_attr(priv->dev)) |
120 | goto sysfs_failed; | 119 | goto sysfs_failed; |
@@ -130,9 +129,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) | |||
130 | return 0; | 129 | return 0; |
131 | 130 | ||
132 | sysfs_failed: | 131 | sysfs_failed: |
133 | ipoib_delete_debug_file(priv->dev); | 132 | ipoib_delete_debug_files(priv->dev); |
134 | |||
135 | debug_failed: | ||
136 | unregister_netdev(priv->dev); | 133 | unregister_netdev(priv->dev); |
137 | 134 | ||
138 | register_failed: | 135 | register_failed: |
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c index d00d14bb637a..64672d491222 100644 --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c | |||
@@ -259,17 +259,17 @@ static void corgikbd_hinge_timer(unsigned long data) | |||
259 | } | 259 | } |
260 | 260 | ||
261 | #ifdef CONFIG_PM | 261 | #ifdef CONFIG_PM |
262 | static int corgikbd_suspend(struct device *dev, pm_message_t state) | 262 | static int corgikbd_suspend(struct platform_device *dev, pm_message_t state) |
263 | { | 263 | { |
264 | struct corgikbd *corgikbd = dev_get_drvdata(dev); | 264 | struct corgikbd *corgikbd = platform_get_drvdata(dev); |
265 | corgikbd->suspended = 1; | 265 | corgikbd->suspended = 1; |
266 | 266 | ||
267 | return 0; | 267 | return 0; |
268 | } | 268 | } |
269 | 269 | ||
270 | static int corgikbd_resume(struct device *dev) | 270 | static int corgikbd_resume(struct platform_device *dev) |
271 | { | 271 | { |
272 | struct corgikbd *corgikbd = dev_get_drvdata(dev); | 272 | struct corgikbd *corgikbd = platform_get_drvdata(dev); |
273 | 273 | ||
274 | /* Upon resume, ignore the suspend key for a short while */ | 274 | /* Upon resume, ignore the suspend key for a short while */ |
275 | corgikbd->suspend_jiffies=jiffies; | 275 | corgikbd->suspend_jiffies=jiffies; |
@@ -282,7 +282,7 @@ static int corgikbd_resume(struct device *dev) | |||
282 | #define corgikbd_resume NULL | 282 | #define corgikbd_resume NULL |
283 | #endif | 283 | #endif |
284 | 284 | ||
285 | static int __init corgikbd_probe(struct device *dev) | 285 | static int __init corgikbd_probe(struct platform_device *pdev) |
286 | { | 286 | { |
287 | struct corgikbd *corgikbd; | 287 | struct corgikbd *corgikbd; |
288 | struct input_dev *input_dev; | 288 | struct input_dev *input_dev; |
@@ -296,7 +296,7 @@ static int __init corgikbd_probe(struct device *dev) | |||
296 | return -ENOMEM; | 296 | return -ENOMEM; |
297 | } | 297 | } |
298 | 298 | ||
299 | dev_set_drvdata(dev, corgikbd); | 299 | platform_set_drvdata(pdev, corgikbd); |
300 | 300 | ||
301 | corgikbd->input = input_dev; | 301 | corgikbd->input = input_dev; |
302 | spin_lock_init(&corgikbd->lock); | 302 | spin_lock_init(&corgikbd->lock); |
@@ -321,7 +321,7 @@ static int __init corgikbd_probe(struct device *dev) | |||
321 | input_dev->id.vendor = 0x0001; | 321 | input_dev->id.vendor = 0x0001; |
322 | input_dev->id.product = 0x0001; | 322 | input_dev->id.product = 0x0001; |
323 | input_dev->id.version = 0x0100; | 323 | input_dev->id.version = 0x0100; |
324 | input_dev->cdev.dev = dev; | 324 | input_dev->cdev.dev = &pdev->dev; |
325 | input_dev->private = corgikbd; | 325 | input_dev->private = corgikbd; |
326 | 326 | ||
327 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); | 327 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); |
@@ -356,10 +356,10 @@ static int __init corgikbd_probe(struct device *dev) | |||
356 | return 0; | 356 | return 0; |
357 | } | 357 | } |
358 | 358 | ||
359 | static int corgikbd_remove(struct device *dev) | 359 | static int corgikbd_remove(struct platform_device *pdev) |
360 | { | 360 | { |
361 | int i; | 361 | int i; |
362 | struct corgikbd *corgikbd = dev_get_drvdata(dev); | 362 | struct corgikbd *corgikbd = platform_get_drvdata(pdev); |
363 | 363 | ||
364 | for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) | 364 | for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) |
365 | free_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd); | 365 | free_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd); |
@@ -374,23 +374,24 @@ static int corgikbd_remove(struct device *dev) | |||
374 | return 0; | 374 | return 0; |
375 | } | 375 | } |
376 | 376 | ||
377 | static struct device_driver corgikbd_driver = { | 377 | static struct platform_driver corgikbd_driver = { |
378 | .name = "corgi-keyboard", | ||
379 | .bus = &platform_bus_type, | ||
380 | .probe = corgikbd_probe, | 378 | .probe = corgikbd_probe, |
381 | .remove = corgikbd_remove, | 379 | .remove = corgikbd_remove, |
382 | .suspend = corgikbd_suspend, | 380 | .suspend = corgikbd_suspend, |
383 | .resume = corgikbd_resume, | 381 | .resume = corgikbd_resume, |
382 | .driver = { | ||
383 | .name = "corgi-keyboard", | ||
384 | }, | ||
384 | }; | 385 | }; |
385 | 386 | ||
386 | static int __devinit corgikbd_init(void) | 387 | static int __devinit corgikbd_init(void) |
387 | { | 388 | { |
388 | return driver_register(&corgikbd_driver); | 389 | return platform_driver_register(&corgikbd_driver); |
389 | } | 390 | } |
390 | 391 | ||
391 | static void __exit corgikbd_exit(void) | 392 | static void __exit corgikbd_exit(void) |
392 | { | 393 | { |
393 | driver_unregister(&corgikbd_driver); | 394 | platform_driver_unregister(&corgikbd_driver); |
394 | } | 395 | } |
395 | 396 | ||
396 | module_init(corgikbd_init); | 397 | module_init(corgikbd_init); |
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c index 0fa38a559cdf..6a15fe3bc527 100644 --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c | |||
@@ -309,10 +309,10 @@ static void spitzkbd_hinge_timer(unsigned long data) | |||
309 | } | 309 | } |
310 | 310 | ||
311 | #ifdef CONFIG_PM | 311 | #ifdef CONFIG_PM |
312 | static int spitzkbd_suspend(struct device *dev, pm_message_t state) | 312 | static int spitzkbd_suspend(struct platform_device *dev, pm_message_t state) |
313 | { | 313 | { |
314 | int i; | 314 | int i; |
315 | struct spitzkbd *spitzkbd = dev_get_drvdata(dev); | 315 | struct spitzkbd *spitzkbd = platform_get_drvdata(dev); |
316 | spitzkbd->suspended = 1; | 316 | spitzkbd->suspended = 1; |
317 | 317 | ||
318 | /* Set Strobe lines as inputs - *except* strobe line 0 leave this | 318 | /* Set Strobe lines as inputs - *except* strobe line 0 leave this |
@@ -323,10 +323,10 @@ static int spitzkbd_suspend(struct device *dev, pm_message_t state) | |||
323 | return 0; | 323 | return 0; |
324 | } | 324 | } |
325 | 325 | ||
326 | static int spitzkbd_resume(struct device *dev) | 326 | static int spitzkbd_resume(struct platform_device *dev) |
327 | { | 327 | { |
328 | int i; | 328 | int i; |
329 | struct spitzkbd *spitzkbd = dev_get_drvdata(dev); | 329 | struct spitzkbd *spitzkbd = platform_get_drvdata(dev); |
330 | 330 | ||
331 | for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++) | 331 | for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++) |
332 | pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH); | 332 | pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH); |
@@ -342,7 +342,7 @@ static int spitzkbd_resume(struct device *dev) | |||
342 | #define spitzkbd_resume NULL | 342 | #define spitzkbd_resume NULL |
343 | #endif | 343 | #endif |
344 | 344 | ||
345 | static int __init spitzkbd_probe(struct device *dev) | 345 | static int __init spitzkbd_probe(struct platform_device *dev) |
346 | { | 346 | { |
347 | struct spitzkbd *spitzkbd; | 347 | struct spitzkbd *spitzkbd; |
348 | struct input_dev *input_dev; | 348 | struct input_dev *input_dev; |
@@ -358,7 +358,7 @@ static int __init spitzkbd_probe(struct device *dev) | |||
358 | return -ENOMEM; | 358 | return -ENOMEM; |
359 | } | 359 | } |
360 | 360 | ||
361 | dev_set_drvdata(dev, spitzkbd); | 361 | platform_set_drvdata(dev, spitzkbd); |
362 | strcpy(spitzkbd->phys, "spitzkbd/input0"); | 362 | strcpy(spitzkbd->phys, "spitzkbd/input0"); |
363 | 363 | ||
364 | spin_lock_init(&spitzkbd->lock); | 364 | spin_lock_init(&spitzkbd->lock); |
@@ -380,7 +380,7 @@ static int __init spitzkbd_probe(struct device *dev) | |||
380 | input_dev->private = spitzkbd; | 380 | input_dev->private = spitzkbd; |
381 | input_dev->name = "Spitz Keyboard"; | 381 | input_dev->name = "Spitz Keyboard"; |
382 | input_dev->phys = spitzkbd->phys; | 382 | input_dev->phys = spitzkbd->phys; |
383 | input_dev->cdev.dev = dev; | 383 | input_dev->cdev.dev = &dev->dev; |
384 | 384 | ||
385 | input_dev->id.bustype = BUS_HOST; | 385 | input_dev->id.bustype = BUS_HOST; |
386 | input_dev->id.vendor = 0x0001; | 386 | input_dev->id.vendor = 0x0001; |
@@ -437,10 +437,10 @@ static int __init spitzkbd_probe(struct device *dev) | |||
437 | return 0; | 437 | return 0; |
438 | } | 438 | } |
439 | 439 | ||
440 | static int spitzkbd_remove(struct device *dev) | 440 | static int spitzkbd_remove(struct platform_device *dev) |
441 | { | 441 | { |
442 | int i; | 442 | int i; |
443 | struct spitzkbd *spitzkbd = dev_get_drvdata(dev); | 443 | struct spitzkbd *spitzkbd = platform_get_drvdata(dev); |
444 | 444 | ||
445 | for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) | 445 | for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) |
446 | free_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd); | 446 | free_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd); |
@@ -460,23 +460,24 @@ static int spitzkbd_remove(struct device *dev) | |||
460 | return 0; | 460 | return 0; |
461 | } | 461 | } |
462 | 462 | ||
463 | static struct device_driver spitzkbd_driver = { | 463 | static struct platform_driver spitzkbd_driver = { |
464 | .name = "spitz-keyboard", | ||
465 | .bus = &platform_bus_type, | ||
466 | .probe = spitzkbd_probe, | 464 | .probe = spitzkbd_probe, |
467 | .remove = spitzkbd_remove, | 465 | .remove = spitzkbd_remove, |
468 | .suspend = spitzkbd_suspend, | 466 | .suspend = spitzkbd_suspend, |
469 | .resume = spitzkbd_resume, | 467 | .resume = spitzkbd_resume, |
468 | .driver = { | ||
469 | .name = "spitz-keyboard", | ||
470 | }, | ||
470 | }; | 471 | }; |
471 | 472 | ||
472 | static int __devinit spitzkbd_init(void) | 473 | static int __devinit spitzkbd_init(void) |
473 | { | 474 | { |
474 | return driver_register(&spitzkbd_driver); | 475 | return platform_driver_register(&spitzkbd_driver); |
475 | } | 476 | } |
476 | 477 | ||
477 | static void __exit spitzkbd_exit(void) | 478 | static void __exit spitzkbd_exit(void) |
478 | { | 479 | { |
479 | driver_unregister(&spitzkbd_driver); | 480 | platform_driver_unregister(&spitzkbd_driver); |
480 | } | 481 | } |
481 | 482 | ||
482 | module_init(spitzkbd_init); | 483 | module_init(spitzkbd_init); |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 01e186422021..ac86c1d1d83e 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -912,7 +912,7 @@ static long i8042_panic_blink(long count) | |||
912 | * Here we try to restore the original BIOS settings | 912 | * Here we try to restore the original BIOS settings |
913 | */ | 913 | */ |
914 | 914 | ||
915 | static int i8042_suspend(struct device *dev, pm_message_t state) | 915 | static int i8042_suspend(struct platform_device *dev, pm_message_t state) |
916 | { | 916 | { |
917 | del_timer_sync(&i8042_timer); | 917 | del_timer_sync(&i8042_timer); |
918 | i8042_controller_reset(); | 918 | i8042_controller_reset(); |
@@ -925,7 +925,7 @@ static int i8042_suspend(struct device *dev, pm_message_t state) | |||
925 | * Here we try to reset everything back to a state in which suspended | 925 | * Here we try to reset everything back to a state in which suspended |
926 | */ | 926 | */ |
927 | 927 | ||
928 | static int i8042_resume(struct device *dev) | 928 | static int i8042_resume(struct platform_device *dev) |
929 | { | 929 | { |
930 | int i; | 930 | int i; |
931 | 931 | ||
@@ -964,17 +964,18 @@ static int i8042_resume(struct device *dev) | |||
964 | * because otherwise BIOSes will be confused. | 964 | * because otherwise BIOSes will be confused. |
965 | */ | 965 | */ |
966 | 966 | ||
967 | static void i8042_shutdown(struct device *dev) | 967 | static void i8042_shutdown(struct platform_device *dev) |
968 | { | 968 | { |
969 | i8042_controller_cleanup(); | 969 | i8042_controller_cleanup(); |
970 | } | 970 | } |
971 | 971 | ||
972 | static struct device_driver i8042_driver = { | 972 | static struct platform_driver i8042_driver = { |
973 | .name = "i8042", | ||
974 | .bus = &platform_bus_type, | ||
975 | .suspend = i8042_suspend, | 973 | .suspend = i8042_suspend, |
976 | .resume = i8042_resume, | 974 | .resume = i8042_resume, |
977 | .shutdown = i8042_shutdown, | 975 | .shutdown = i8042_shutdown, |
976 | .driver = { | ||
977 | .name = "i8042", | ||
978 | }, | ||
978 | }; | 979 | }; |
979 | 980 | ||
980 | static int __init i8042_create_kbd_port(void) | 981 | static int __init i8042_create_kbd_port(void) |
@@ -1078,7 +1079,7 @@ static int __init i8042_init(void) | |||
1078 | goto err_platform_exit; | 1079 | goto err_platform_exit; |
1079 | } | 1080 | } |
1080 | 1081 | ||
1081 | err = driver_register(&i8042_driver); | 1082 | err = platform_driver_register(&i8042_driver); |
1082 | if (err) | 1083 | if (err) |
1083 | goto err_controller_cleanup; | 1084 | goto err_controller_cleanup; |
1084 | 1085 | ||
@@ -1126,7 +1127,7 @@ static int __init i8042_init(void) | |||
1126 | err_unregister_device: | 1127 | err_unregister_device: |
1127 | platform_device_unregister(i8042_platform_device); | 1128 | platform_device_unregister(i8042_platform_device); |
1128 | err_unregister_driver: | 1129 | err_unregister_driver: |
1129 | driver_unregister(&i8042_driver); | 1130 | platform_driver_unregister(&i8042_driver); |
1130 | err_controller_cleanup: | 1131 | err_controller_cleanup: |
1131 | i8042_controller_cleanup(); | 1132 | i8042_controller_cleanup(); |
1132 | err_platform_exit: | 1133 | err_platform_exit: |
@@ -1148,7 +1149,7 @@ static void __exit i8042_exit(void) | |||
1148 | del_timer_sync(&i8042_timer); | 1149 | del_timer_sync(&i8042_timer); |
1149 | 1150 | ||
1150 | platform_device_unregister(i8042_platform_device); | 1151 | platform_device_unregister(i8042_platform_device); |
1151 | driver_unregister(&i8042_driver); | 1152 | platform_driver_unregister(&i8042_driver); |
1152 | 1153 | ||
1153 | i8042_platform_exit(); | 1154 | i8042_platform_exit(); |
1154 | 1155 | ||
diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c index 52c49258f8a4..a3bd11589bc3 100644 --- a/drivers/input/serio/rpckbd.c +++ b/drivers/input/serio/rpckbd.c | |||
@@ -107,7 +107,7 @@ static void rpckbd_close(struct serio *port) | |||
107 | * Allocate and initialize serio structure for subsequent registration | 107 | * Allocate and initialize serio structure for subsequent registration |
108 | * with serio core. | 108 | * with serio core. |
109 | */ | 109 | */ |
110 | static int __devinit rpckbd_probe(struct device *dev) | 110 | static int __devinit rpckbd_probe(struct platform_device *dev) |
111 | { | 111 | { |
112 | struct serio *serio; | 112 | struct serio *serio; |
113 | 113 | ||
@@ -120,37 +120,38 @@ static int __devinit rpckbd_probe(struct device *dev) | |||
120 | serio->write = rpckbd_write; | 120 | serio->write = rpckbd_write; |
121 | serio->open = rpckbd_open; | 121 | serio->open = rpckbd_open; |
122 | serio->close = rpckbd_close; | 122 | serio->close = rpckbd_close; |
123 | serio->dev.parent = dev; | 123 | serio->dev.parent = &dev->dev; |
124 | strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name)); | 124 | strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name)); |
125 | strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys)); | 125 | strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys)); |
126 | 126 | ||
127 | dev_set_drvdata(dev, serio); | 127 | platform_set_drvdata(dev, serio); |
128 | serio_register_port(serio); | 128 | serio_register_port(serio); |
129 | return 0; | 129 | return 0; |
130 | } | 130 | } |
131 | 131 | ||
132 | static int __devexit rpckbd_remove(struct device *dev) | 132 | static int __devexit rpckbd_remove(struct platform_device *dev) |
133 | { | 133 | { |
134 | struct serio *serio = dev_get_drvdata(dev); | 134 | struct serio *serio = platform_get_drvdata(dev); |
135 | serio_unregister_port(serio); | 135 | serio_unregister_port(serio); |
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
139 | static struct device_driver rpckbd_driver = { | 139 | static struct platform_driver rpckbd_driver = { |
140 | .name = "kart", | ||
141 | .bus = &platform_bus_type, | ||
142 | .probe = rpckbd_probe, | 140 | .probe = rpckbd_probe, |
143 | .remove = __devexit_p(rpckbd_remove), | 141 | .remove = __devexit_p(rpckbd_remove), |
142 | .driver = { | ||
143 | .name = "kart", | ||
144 | }, | ||
144 | }; | 145 | }; |
145 | 146 | ||
146 | static int __init rpckbd_init(void) | 147 | static int __init rpckbd_init(void) |
147 | { | 148 | { |
148 | return driver_register(&rpckbd_driver); | 149 | return platform_driver_register(&rpckbd_driver); |
149 | } | 150 | } |
150 | 151 | ||
151 | static void __exit rpckbd_exit(void) | 152 | static void __exit rpckbd_exit(void) |
152 | { | 153 | { |
153 | driver_unregister(&rpckbd_driver); | 154 | platform_driver_unregister(&rpckbd_driver); |
154 | } | 155 | } |
155 | 156 | ||
156 | module_init(rpckbd_init); | 157 | module_init(rpckbd_init); |
diff --git a/drivers/input/touchscreen/corgi_ts.c b/drivers/input/touchscreen/corgi_ts.c index 15e88eeae8d6..1042987856f7 100644 --- a/drivers/input/touchscreen/corgi_ts.c +++ b/drivers/input/touchscreen/corgi_ts.c | |||
@@ -231,9 +231,9 @@ static irqreturn_t ts_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | #ifdef CONFIG_PM | 233 | #ifdef CONFIG_PM |
234 | static int corgits_suspend(struct device *dev, pm_message_t state) | 234 | static int corgits_suspend(struct platform_device *dev, pm_message_t state) |
235 | { | 235 | { |
236 | struct corgi_ts *corgi_ts = dev_get_drvdata(dev); | 236 | struct corgi_ts *corgi_ts = platform_get_drvdata(dev); |
237 | 237 | ||
238 | if (corgi_ts->pendown) { | 238 | if (corgi_ts->pendown) { |
239 | del_timer_sync(&corgi_ts->timer); | 239 | del_timer_sync(&corgi_ts->timer); |
@@ -248,9 +248,9 @@ static int corgits_suspend(struct device *dev, pm_message_t state) | |||
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | 250 | ||
251 | static int corgits_resume(struct device *dev) | 251 | static int corgits_resume(struct platform_device *dev) |
252 | { | 252 | { |
253 | struct corgi_ts *corgi_ts = dev_get_drvdata(dev); | 253 | struct corgi_ts *corgi_ts = platform_get_drvdata(dev); |
254 | 254 | ||
255 | corgi_ssp_ads7846_putget((4u << ADSCTRL_ADR_SH) | ADSCTRL_STS); | 255 | corgi_ssp_ads7846_putget((4u << ADSCTRL_ADR_SH) | ADSCTRL_STS); |
256 | /* Enable Falling Edge */ | 256 | /* Enable Falling Edge */ |
@@ -264,10 +264,9 @@ static int corgits_resume(struct device *dev) | |||
264 | #define corgits_resume NULL | 264 | #define corgits_resume NULL |
265 | #endif | 265 | #endif |
266 | 266 | ||
267 | static int __init corgits_probe(struct device *dev) | 267 | static int __init corgits_probe(struct platform_device *pdev) |
268 | { | 268 | { |
269 | struct corgi_ts *corgi_ts; | 269 | struct corgi_ts *corgi_ts; |
270 | struct platform_device *pdev = to_platform_device(dev); | ||
271 | struct input_dev *input_dev; | 270 | struct input_dev *input_dev; |
272 | int err = -ENOMEM; | 271 | int err = -ENOMEM; |
273 | 272 | ||
@@ -276,9 +275,9 @@ static int __init corgits_probe(struct device *dev) | |||
276 | if (!corgi_ts || !input_dev) | 275 | if (!corgi_ts || !input_dev) |
277 | goto fail; | 276 | goto fail; |
278 | 277 | ||
279 | dev_set_drvdata(dev, corgi_ts); | 278 | platform_set_drvdata(pdev, corgi_ts); |
280 | 279 | ||
281 | corgi_ts->machinfo = dev->platform_data; | 280 | corgi_ts->machinfo = pdev->dev.platform_data; |
282 | corgi_ts->irq_gpio = platform_get_irq(pdev, 0); | 281 | corgi_ts->irq_gpio = platform_get_irq(pdev, 0); |
283 | 282 | ||
284 | if (corgi_ts->irq_gpio < 0) { | 283 | if (corgi_ts->irq_gpio < 0) { |
@@ -298,7 +297,7 @@ static int __init corgits_probe(struct device *dev) | |||
298 | input_dev->id.vendor = 0x0001; | 297 | input_dev->id.vendor = 0x0001; |
299 | input_dev->id.product = 0x0002; | 298 | input_dev->id.product = 0x0002; |
300 | input_dev->id.version = 0x0100; | 299 | input_dev->id.version = 0x0100; |
301 | input_dev->cdev.dev = dev; | 300 | input_dev->cdev.dev = &pdev->dev; |
302 | input_dev->private = corgi_ts; | 301 | input_dev->private = corgi_ts; |
303 | 302 | ||
304 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | 303 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); |
@@ -339,9 +338,9 @@ static int __init corgits_probe(struct device *dev) | |||
339 | 338 | ||
340 | } | 339 | } |
341 | 340 | ||
342 | static int corgits_remove(struct device *dev) | 341 | static int corgits_remove(struct platform_device *pdev) |
343 | { | 342 | { |
344 | struct corgi_ts *corgi_ts = dev_get_drvdata(dev); | 343 | struct corgi_ts *corgi_ts = platform_get_drvdata(pdev); |
345 | 344 | ||
346 | free_irq(corgi_ts->irq_gpio, NULL); | 345 | free_irq(corgi_ts->irq_gpio, NULL); |
347 | del_timer_sync(&corgi_ts->timer); | 346 | del_timer_sync(&corgi_ts->timer); |
@@ -351,23 +350,24 @@ static int corgits_remove(struct device *dev) | |||
351 | return 0; | 350 | return 0; |
352 | } | 351 | } |
353 | 352 | ||
354 | static struct device_driver corgits_driver = { | 353 | static struct platform_driver corgits_driver = { |
355 | .name = "corgi-ts", | ||
356 | .bus = &platform_bus_type, | ||
357 | .probe = corgits_probe, | 354 | .probe = corgits_probe, |
358 | .remove = corgits_remove, | 355 | .remove = corgits_remove, |
359 | .suspend = corgits_suspend, | 356 | .suspend = corgits_suspend, |
360 | .resume = corgits_resume, | 357 | .resume = corgits_resume, |
358 | .driver = { | ||
359 | .name = "corgi-ts", | ||
360 | }, | ||
361 | }; | 361 | }; |
362 | 362 | ||
363 | static int __devinit corgits_init(void) | 363 | static int __devinit corgits_init(void) |
364 | { | 364 | { |
365 | return driver_register(&corgits_driver); | 365 | return platform_driver_register(&corgits_driver); |
366 | } | 366 | } |
367 | 367 | ||
368 | static void __exit corgits_exit(void) | 368 | static void __exit corgits_exit(void) |
369 | { | 369 | { |
370 | driver_unregister(&corgits_driver); | 370 | platform_driver_unregister(&corgits_driver); |
371 | } | 371 | } |
372 | 372 | ||
373 | module_init(corgits_init); | 373 | module_init(corgits_init); |
diff --git a/drivers/mfd/mcp-sa11x0.c b/drivers/mfd/mcp-sa11x0.c index 7daa0ed7331c..1eab7cffceaa 100644 --- a/drivers/mfd/mcp-sa11x0.c +++ b/drivers/mfd/mcp-sa11x0.c | |||
@@ -138,9 +138,8 @@ static struct mcp_ops mcp_sa11x0 = { | |||
138 | .disable = mcp_sa11x0_disable, | 138 | .disable = mcp_sa11x0_disable, |
139 | }; | 139 | }; |
140 | 140 | ||
141 | static int mcp_sa11x0_probe(struct device *dev) | 141 | static int mcp_sa11x0_probe(struct platform_device *pdev) |
142 | { | 142 | { |
143 | struct platform_device *pdev = to_platform_device(dev); | ||
144 | struct mcp_plat_data *data = pdev->dev.platform_data; | 143 | struct mcp_plat_data *data = pdev->dev.platform_data; |
145 | struct mcp *mcp; | 144 | struct mcp *mcp; |
146 | int ret; | 145 | int ret; |
@@ -165,7 +164,7 @@ static int mcp_sa11x0_probe(struct device *dev) | |||
165 | mcp->dma_telco_rd = DMA_Ser4MCP1Rd; | 164 | mcp->dma_telco_rd = DMA_Ser4MCP1Rd; |
166 | mcp->dma_telco_wr = DMA_Ser4MCP1Wr; | 165 | mcp->dma_telco_wr = DMA_Ser4MCP1Wr; |
167 | 166 | ||
168 | dev_set_drvdata(dev, mcp); | 167 | platform_set_drvdata(pdev, mcp); |
169 | 168 | ||
170 | if (machine_is_assabet()) { | 169 | if (machine_is_assabet()) { |
171 | ASSABET_BCR_set(ASSABET_BCR_CODEC_RST); | 170 | ASSABET_BCR_set(ASSABET_BCR_CODEC_RST); |
@@ -202,26 +201,26 @@ static int mcp_sa11x0_probe(struct device *dev) | |||
202 | 201 | ||
203 | release: | 202 | release: |
204 | release_mem_region(0x80060000, 0x60); | 203 | release_mem_region(0x80060000, 0x60); |
205 | dev_set_drvdata(dev, NULL); | 204 | platform_set_drvdata(pdev, NULL); |
206 | 205 | ||
207 | out: | 206 | out: |
208 | return ret; | 207 | return ret; |
209 | } | 208 | } |
210 | 209 | ||
211 | static int mcp_sa11x0_remove(struct device *dev) | 210 | static int mcp_sa11x0_remove(struct platform_device *dev) |
212 | { | 211 | { |
213 | struct mcp *mcp = dev_get_drvdata(dev); | 212 | struct mcp *mcp = platform_get_drvdata(dev); |
214 | 213 | ||
215 | dev_set_drvdata(dev, NULL); | 214 | platform_set_drvdata(dev, NULL); |
216 | mcp_host_unregister(mcp); | 215 | mcp_host_unregister(mcp); |
217 | release_mem_region(0x80060000, 0x60); | 216 | release_mem_region(0x80060000, 0x60); |
218 | 217 | ||
219 | return 0; | 218 | return 0; |
220 | } | 219 | } |
221 | 220 | ||
222 | static int mcp_sa11x0_suspend(struct device *dev, pm_message_t state) | 221 | static int mcp_sa11x0_suspend(struct platform_device *dev, pm_message_t state) |
223 | { | 222 | { |
224 | struct mcp *mcp = dev_get_drvdata(dev); | 223 | struct mcp *mcp = platform_get_drvdata(dev); |
225 | 224 | ||
226 | priv(mcp)->mccr0 = Ser4MCCR0; | 225 | priv(mcp)->mccr0 = Ser4MCCR0; |
227 | priv(mcp)->mccr1 = Ser4MCCR1; | 226 | priv(mcp)->mccr1 = Ser4MCCR1; |
@@ -230,9 +229,9 @@ static int mcp_sa11x0_suspend(struct device *dev, pm_message_t state) | |||
230 | return 0; | 229 | return 0; |
231 | } | 230 | } |
232 | 231 | ||
233 | static int mcp_sa11x0_resume(struct device *dev) | 232 | static int mcp_sa11x0_resume(struct platform_device *dev) |
234 | { | 233 | { |
235 | struct mcp *mcp = dev_get_drvdata(dev); | 234 | struct mcp *mcp = platform_get_drvdata(dev); |
236 | 235 | ||
237 | Ser4MCCR1 = priv(mcp)->mccr1; | 236 | Ser4MCCR1 = priv(mcp)->mccr1; |
238 | Ser4MCCR0 = priv(mcp)->mccr0; | 237 | Ser4MCCR0 = priv(mcp)->mccr0; |
@@ -243,13 +242,14 @@ static int mcp_sa11x0_resume(struct device *dev) | |||
243 | /* | 242 | /* |
244 | * The driver for the SA11x0 MCP port. | 243 | * The driver for the SA11x0 MCP port. |
245 | */ | 244 | */ |
246 | static struct device_driver mcp_sa11x0_driver = { | 245 | static struct platform_driver mcp_sa11x0_driver = { |
247 | .name = "sa11x0-mcp", | ||
248 | .bus = &platform_bus_type, | ||
249 | .probe = mcp_sa11x0_probe, | 246 | .probe = mcp_sa11x0_probe, |
250 | .remove = mcp_sa11x0_remove, | 247 | .remove = mcp_sa11x0_remove, |
251 | .suspend = mcp_sa11x0_suspend, | 248 | .suspend = mcp_sa11x0_suspend, |
252 | .resume = mcp_sa11x0_resume, | 249 | .resume = mcp_sa11x0_resume, |
250 | .driver = { | ||
251 | .name = "sa11x0-mcp", | ||
252 | }, | ||
253 | }; | 253 | }; |
254 | 254 | ||
255 | /* | 255 | /* |
@@ -257,12 +257,12 @@ static struct device_driver mcp_sa11x0_driver = { | |||
257 | */ | 257 | */ |
258 | static int __init mcp_sa11x0_init(void) | 258 | static int __init mcp_sa11x0_init(void) |
259 | { | 259 | { |
260 | return driver_register(&mcp_sa11x0_driver); | 260 | return platform_driver_register(&mcp_sa11x0_driver); |
261 | } | 261 | } |
262 | 262 | ||
263 | static void __exit mcp_sa11x0_exit(void) | 263 | static void __exit mcp_sa11x0_exit(void) |
264 | { | 264 | { |
265 | driver_unregister(&mcp_sa11x0_driver); | 265 | platform_driver_unregister(&mcp_sa11x0_driver); |
266 | } | 266 | } |
267 | 267 | ||
268 | module_init(mcp_sa11x0_init); | 268 | module_init(mcp_sa11x0_init); |
diff --git a/drivers/misc/hdpuftrs/hdpu_cpustate.c b/drivers/misc/hdpuftrs/hdpu_cpustate.c index bc2b72b32905..11a801be71c8 100644 --- a/drivers/misc/hdpuftrs/hdpu_cpustate.c +++ b/drivers/misc/hdpuftrs/hdpu_cpustate.c | |||
@@ -26,8 +26,8 @@ | |||
26 | 26 | ||
27 | #define SKY_CPUSTATE_VERSION "1.1" | 27 | #define SKY_CPUSTATE_VERSION "1.1" |
28 | 28 | ||
29 | static int hdpu_cpustate_probe(struct device *ddev); | 29 | static int hdpu_cpustate_probe(struct platform_device *pdev); |
30 | static int hdpu_cpustate_remove(struct device *ddev); | 30 | static int hdpu_cpustate_remove(struct platform_device *pdev); |
31 | 31 | ||
32 | struct cpustate_t cpustate; | 32 | struct cpustate_t cpustate; |
33 | 33 | ||
@@ -158,11 +158,12 @@ static int cpustate_read_proc(char *page, char **start, off_t off, | |||
158 | return len; | 158 | return len; |
159 | } | 159 | } |
160 | 160 | ||
161 | static struct device_driver hdpu_cpustate_driver = { | 161 | static struct platform_driver hdpu_cpustate_driver = { |
162 | .name = HDPU_CPUSTATE_NAME, | ||
163 | .bus = &platform_bus_type, | ||
164 | .probe = hdpu_cpustate_probe, | 162 | .probe = hdpu_cpustate_probe, |
165 | .remove = hdpu_cpustate_remove, | 163 | .remove = hdpu_cpustate_remove, |
164 | .driver = { | ||
165 | .name = HDPU_CPUSTATE_NAME, | ||
166 | }, | ||
166 | }; | 167 | }; |
167 | 168 | ||
168 | /* | 169 | /* |
@@ -187,9 +188,8 @@ static struct miscdevice cpustate_dev = { | |||
187 | &cpustate_fops | 188 | &cpustate_fops |
188 | }; | 189 | }; |
189 | 190 | ||
190 | static int hdpu_cpustate_probe(struct device *ddev) | 191 | static int hdpu_cpustate_probe(struct platform_device *pdev) |
191 | { | 192 | { |
192 | struct platform_device *pdev = to_platform_device(ddev); | ||
193 | struct resource *res; | 193 | struct resource *res; |
194 | struct proc_dir_entry *proc_de; | 194 | struct proc_dir_entry *proc_de; |
195 | int ret; | 195 | int ret; |
@@ -217,7 +217,7 @@ static int hdpu_cpustate_probe(struct device *ddev) | |||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
219 | 219 | ||
220 | static int hdpu_cpustate_remove(struct device *ddev) | 220 | static int hdpu_cpustate_remove(struct platform_device *pdev) |
221 | { | 221 | { |
222 | 222 | ||
223 | cpustate.set_addr = NULL; | 223 | cpustate.set_addr = NULL; |
@@ -232,13 +232,13 @@ static int hdpu_cpustate_remove(struct device *ddev) | |||
232 | static int __init cpustate_init(void) | 232 | static int __init cpustate_init(void) |
233 | { | 233 | { |
234 | int rc; | 234 | int rc; |
235 | rc = driver_register(&hdpu_cpustate_driver); | 235 | rc = platform_driver_register(&hdpu_cpustate_driver); |
236 | return rc; | 236 | return rc; |
237 | } | 237 | } |
238 | 238 | ||
239 | static void __exit cpustate_exit(void) | 239 | static void __exit cpustate_exit(void) |
240 | { | 240 | { |
241 | driver_unregister(&hdpu_cpustate_driver); | 241 | platform_driver_unregister(&hdpu_cpustate_driver); |
242 | } | 242 | } |
243 | 243 | ||
244 | module_init(cpustate_init); | 244 | module_init(cpustate_init); |
diff --git a/drivers/misc/hdpuftrs/hdpu_nexus.c b/drivers/misc/hdpuftrs/hdpu_nexus.c index 4bb461793851..ea9d5f233c83 100644 --- a/drivers/misc/hdpuftrs/hdpu_nexus.c +++ b/drivers/misc/hdpuftrs/hdpu_nexus.c | |||
@@ -22,19 +22,20 @@ | |||
22 | 22 | ||
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | 24 | ||
25 | static int hdpu_nexus_probe(struct device *ddev); | 25 | static int hdpu_nexus_probe(struct platform_device *pdev); |
26 | static int hdpu_nexus_remove(struct device *ddev); | 26 | static int hdpu_nexus_remove(struct platform_device *pdev); |
27 | 27 | ||
28 | static struct proc_dir_entry *hdpu_slot_id; | 28 | static struct proc_dir_entry *hdpu_slot_id; |
29 | static struct proc_dir_entry *hdpu_chassis_id; | 29 | static struct proc_dir_entry *hdpu_chassis_id; |
30 | static int slot_id = -1; | 30 | static int slot_id = -1; |
31 | static int chassis_id = -1; | 31 | static int chassis_id = -1; |
32 | 32 | ||
33 | static struct device_driver hdpu_nexus_driver = { | 33 | static struct platform_driver hdpu_nexus_driver = { |
34 | .name = HDPU_NEXUS_NAME, | ||
35 | .bus = &platform_bus_type, | ||
36 | .probe = hdpu_nexus_probe, | 34 | .probe = hdpu_nexus_probe, |
37 | .remove = hdpu_nexus_remove, | 35 | .remove = hdpu_nexus_remove, |
36 | .driver = { | ||
37 | .name = HDPU_NEXUS_NAME, | ||
38 | }, | ||
38 | }; | 39 | }; |
39 | 40 | ||
40 | int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset, | 41 | int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset, |
@@ -55,9 +56,8 @@ int hdpu_chassis_id_read(char *buffer, char **buffer_location, off_t offset, | |||
55 | return sprintf(buffer, "%d\n", chassis_id); | 56 | return sprintf(buffer, "%d\n", chassis_id); |
56 | } | 57 | } |
57 | 58 | ||
58 | static int hdpu_nexus_probe(struct device *ddev) | 59 | static int hdpu_nexus_probe(struct platform_device *pdev) |
59 | { | 60 | { |
60 | struct platform_device *pdev = to_platform_device(ddev); | ||
61 | struct resource *res; | 61 | struct resource *res; |
62 | 62 | ||
63 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 63 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -80,7 +80,7 @@ static int hdpu_nexus_probe(struct device *ddev) | |||
80 | return 0; | 80 | return 0; |
81 | } | 81 | } |
82 | 82 | ||
83 | static int hdpu_nexus_remove(struct device *ddev) | 83 | static int hdpu_nexus_remove(struct platform_device *pdev) |
84 | { | 84 | { |
85 | slot_id = -1; | 85 | slot_id = -1; |
86 | chassis_id = -1; | 86 | chassis_id = -1; |
@@ -94,13 +94,13 @@ static int hdpu_nexus_remove(struct device *ddev) | |||
94 | static int __init nexus_init(void) | 94 | static int __init nexus_init(void) |
95 | { | 95 | { |
96 | int rc; | 96 | int rc; |
97 | rc = driver_register(&hdpu_nexus_driver); | 97 | rc = platform_driver_register(&hdpu_nexus_driver); |
98 | return rc; | 98 | return rc; |
99 | } | 99 | } |
100 | 100 | ||
101 | static void __exit nexus_exit(void) | 101 | static void __exit nexus_exit(void) |
102 | { | 102 | { |
103 | driver_unregister(&hdpu_nexus_driver); | 103 | platform_driver_unregister(&hdpu_nexus_driver); |
104 | } | 104 | } |
105 | 105 | ||
106 | module_init(nexus_init); | 106 | module_init(nexus_init); |
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c index f31e247b2cbe..ee8f8a0420d1 100644 --- a/drivers/mmc/pxamci.c +++ b/drivers/mmc/pxamci.c | |||
@@ -428,9 +428,8 @@ static irqreturn_t pxamci_detect_irq(int irq, void *devid, struct pt_regs *regs) | |||
428 | return IRQ_HANDLED; | 428 | return IRQ_HANDLED; |
429 | } | 429 | } |
430 | 430 | ||
431 | static int pxamci_probe(struct device *dev) | 431 | static int pxamci_probe(struct platform_device *pdev) |
432 | { | 432 | { |
433 | struct platform_device *pdev = to_platform_device(dev); | ||
434 | struct mmc_host *mmc; | 433 | struct mmc_host *mmc; |
435 | struct pxamci_host *host = NULL; | 434 | struct pxamci_host *host = NULL; |
436 | struct resource *r; | 435 | struct resource *r; |
@@ -445,7 +444,7 @@ static int pxamci_probe(struct device *dev) | |||
445 | if (!r) | 444 | if (!r) |
446 | return -EBUSY; | 445 | return -EBUSY; |
447 | 446 | ||
448 | mmc = mmc_alloc_host(sizeof(struct pxamci_host), dev); | 447 | mmc = mmc_alloc_host(sizeof(struct pxamci_host), &pdev->dev); |
449 | if (!mmc) { | 448 | if (!mmc) { |
450 | ret = -ENOMEM; | 449 | ret = -ENOMEM; |
451 | goto out; | 450 | goto out; |
@@ -474,7 +473,7 @@ static int pxamci_probe(struct device *dev) | |||
474 | host->pdata->ocr_mask : | 473 | host->pdata->ocr_mask : |
475 | MMC_VDD_32_33|MMC_VDD_33_34; | 474 | MMC_VDD_32_33|MMC_VDD_33_34; |
476 | 475 | ||
477 | host->sg_cpu = dma_alloc_coherent(dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL); | 476 | host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL); |
478 | if (!host->sg_cpu) { | 477 | if (!host->sg_cpu) { |
479 | ret = -ENOMEM; | 478 | ret = -ENOMEM; |
480 | goto out; | 479 | goto out; |
@@ -511,10 +510,10 @@ static int pxamci_probe(struct device *dev) | |||
511 | if (ret) | 510 | if (ret) |
512 | goto out; | 511 | goto out; |
513 | 512 | ||
514 | dev_set_drvdata(dev, mmc); | 513 | platform_set_drvdata(pdev, mmc); |
515 | 514 | ||
516 | if (host->pdata && host->pdata->init) | 515 | if (host->pdata && host->pdata->init) |
517 | host->pdata->init(dev, pxamci_detect_irq, mmc); | 516 | host->pdata->init(&pdev->dev, pxamci_detect_irq, mmc); |
518 | 517 | ||
519 | mmc_add_host(mmc); | 518 | mmc_add_host(mmc); |
520 | 519 | ||
@@ -527,7 +526,7 @@ static int pxamci_probe(struct device *dev) | |||
527 | if (host->base) | 526 | if (host->base) |
528 | iounmap(host->base); | 527 | iounmap(host->base); |
529 | if (host->sg_cpu) | 528 | if (host->sg_cpu) |
530 | dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); | 529 | dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); |
531 | } | 530 | } |
532 | if (mmc) | 531 | if (mmc) |
533 | mmc_free_host(mmc); | 532 | mmc_free_host(mmc); |
@@ -535,17 +534,17 @@ static int pxamci_probe(struct device *dev) | |||
535 | return ret; | 534 | return ret; |
536 | } | 535 | } |
537 | 536 | ||
538 | static int pxamci_remove(struct device *dev) | 537 | static int pxamci_remove(struct platform_device *pdev) |
539 | { | 538 | { |
540 | struct mmc_host *mmc = dev_get_drvdata(dev); | 539 | struct mmc_host *mmc = platform_get_drvdata(pdev); |
541 | 540 | ||
542 | dev_set_drvdata(dev, NULL); | 541 | platform_set_drvdata(pdev, NULL); |
543 | 542 | ||
544 | if (mmc) { | 543 | if (mmc) { |
545 | struct pxamci_host *host = mmc_priv(mmc); | 544 | struct pxamci_host *host = mmc_priv(mmc); |
546 | 545 | ||
547 | if (host->pdata && host->pdata->exit) | 546 | if (host->pdata && host->pdata->exit) |
548 | host->pdata->exit(dev, mmc); | 547 | host->pdata->exit(&pdev->dev, mmc); |
549 | 548 | ||
550 | mmc_remove_host(mmc); | 549 | mmc_remove_host(mmc); |
551 | 550 | ||
@@ -560,7 +559,7 @@ static int pxamci_remove(struct device *dev) | |||
560 | free_irq(host->irq, host); | 559 | free_irq(host->irq, host); |
561 | pxa_free_dma(host->dma); | 560 | pxa_free_dma(host->dma); |
562 | iounmap(host->base); | 561 | iounmap(host->base); |
563 | dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); | 562 | dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); |
564 | 563 | ||
565 | release_resource(host->res); | 564 | release_resource(host->res); |
566 | 565 | ||
@@ -570,9 +569,9 @@ static int pxamci_remove(struct device *dev) | |||
570 | } | 569 | } |
571 | 570 | ||
572 | #ifdef CONFIG_PM | 571 | #ifdef CONFIG_PM |
573 | static int pxamci_suspend(struct device *dev, pm_message_t state) | 572 | static int pxamci_suspend(struct platform_device *dev, pm_message_t state) |
574 | { | 573 | { |
575 | struct mmc_host *mmc = dev_get_drvdata(dev); | 574 | struct mmc_host *mmc = platform_get_drvdata(dev); |
576 | int ret = 0; | 575 | int ret = 0; |
577 | 576 | ||
578 | if (mmc) | 577 | if (mmc) |
@@ -581,9 +580,9 @@ static int pxamci_suspend(struct device *dev, pm_message_t state) | |||
581 | return ret; | 580 | return ret; |
582 | } | 581 | } |
583 | 582 | ||
584 | static int pxamci_resume(struct device *dev) | 583 | static int pxamci_resume(struct platform_device *dev) |
585 | { | 584 | { |
586 | struct mmc_host *mmc = dev_get_drvdata(dev); | 585 | struct mmc_host *mmc = platform_get_drvdata(dev); |
587 | int ret = 0; | 586 | int ret = 0; |
588 | 587 | ||
589 | if (mmc) | 588 | if (mmc) |
@@ -596,23 +595,24 @@ static int pxamci_resume(struct device *dev) | |||
596 | #define pxamci_resume NULL | 595 | #define pxamci_resume NULL |
597 | #endif | 596 | #endif |
598 | 597 | ||
599 | static struct device_driver pxamci_driver = { | 598 | static struct platform_driver pxamci_driver = { |
600 | .name = DRIVER_NAME, | ||
601 | .bus = &platform_bus_type, | ||
602 | .probe = pxamci_probe, | 599 | .probe = pxamci_probe, |
603 | .remove = pxamci_remove, | 600 | .remove = pxamci_remove, |
604 | .suspend = pxamci_suspend, | 601 | .suspend = pxamci_suspend, |
605 | .resume = pxamci_resume, | 602 | .resume = pxamci_resume, |
603 | .driver = { | ||
604 | .name = DRIVER_NAME, | ||
605 | }, | ||
606 | }; | 606 | }; |
607 | 607 | ||
608 | static int __init pxamci_init(void) | 608 | static int __init pxamci_init(void) |
609 | { | 609 | { |
610 | return driver_register(&pxamci_driver); | 610 | return platform_driver_register(&pxamci_driver); |
611 | } | 611 | } |
612 | 612 | ||
613 | static void __exit pxamci_exit(void) | 613 | static void __exit pxamci_exit(void) |
614 | { | 614 | { |
615 | driver_unregister(&pxamci_driver); | 615 | platform_driver_unregister(&pxamci_driver); |
616 | } | 616 | } |
617 | 617 | ||
618 | module_init(pxamci_init); | 618 | module_init(pxamci_init); |
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index e954b8354fef..c7eb7c269081 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include "wbsd.h" | 42 | #include "wbsd.h" |
43 | 43 | ||
44 | #define DRIVER_NAME "wbsd" | 44 | #define DRIVER_NAME "wbsd" |
45 | #define DRIVER_VERSION "1.4" | 45 | #define DRIVER_VERSION "1.5" |
46 | 46 | ||
47 | #ifdef CONFIG_MMC_DEBUG | 47 | #ifdef CONFIG_MMC_DEBUG |
48 | #define DBG(x...) \ | 48 | #define DBG(x...) \ |
@@ -1932,14 +1932,14 @@ static void __devexit wbsd_shutdown(struct device* dev, int pnp) | |||
1932 | * Non-PnP | 1932 | * Non-PnP |
1933 | */ | 1933 | */ |
1934 | 1934 | ||
1935 | static int __devinit wbsd_probe(struct device* dev) | 1935 | static int __devinit wbsd_probe(struct platform_device* dev) |
1936 | { | 1936 | { |
1937 | return wbsd_init(dev, io, irq, dma, 0); | 1937 | return wbsd_init(&dev->dev, io, irq, dma, 0); |
1938 | } | 1938 | } |
1939 | 1939 | ||
1940 | static int __devexit wbsd_remove(struct device* dev) | 1940 | static int __devexit wbsd_remove(struct platform_device* dev) |
1941 | { | 1941 | { |
1942 | wbsd_shutdown(dev, 0); | 1942 | wbsd_shutdown(&dev->dev, 0); |
1943 | 1943 | ||
1944 | return 0; | 1944 | return 0; |
1945 | } | 1945 | } |
@@ -1983,9 +1983,9 @@ static void __devexit wbsd_pnp_remove(struct pnp_dev * dev) | |||
1983 | 1983 | ||
1984 | #ifdef CONFIG_PM | 1984 | #ifdef CONFIG_PM |
1985 | 1985 | ||
1986 | static int wbsd_suspend(struct device *dev, pm_message_t state) | 1986 | static int wbsd_suspend(struct platform_device *dev, pm_message_t state) |
1987 | { | 1987 | { |
1988 | struct mmc_host *mmc = dev_get_drvdata(dev); | 1988 | struct mmc_host *mmc = platform_get_drvdata(dev); |
1989 | struct wbsd_host *host; | 1989 | struct wbsd_host *host; |
1990 | int ret; | 1990 | int ret; |
1991 | 1991 | ||
@@ -2005,9 +2005,9 @@ static int wbsd_suspend(struct device *dev, pm_message_t state) | |||
2005 | return 0; | 2005 | return 0; |
2006 | } | 2006 | } |
2007 | 2007 | ||
2008 | static int wbsd_resume(struct device *dev) | 2008 | static int wbsd_resume(struct platform_device *dev) |
2009 | { | 2009 | { |
2010 | struct mmc_host *mmc = dev_get_drvdata(dev); | 2010 | struct mmc_host *mmc = platform_get_drvdata(dev); |
2011 | struct wbsd_host *host; | 2011 | struct wbsd_host *host; |
2012 | 2012 | ||
2013 | if (!mmc) | 2013 | if (!mmc) |
@@ -2038,14 +2038,15 @@ static int wbsd_resume(struct device *dev) | |||
2038 | 2038 | ||
2039 | static struct platform_device *wbsd_device; | 2039 | static struct platform_device *wbsd_device; |
2040 | 2040 | ||
2041 | static struct device_driver wbsd_driver = { | 2041 | static struct platform_driver wbsd_driver = { |
2042 | .name = DRIVER_NAME, | ||
2043 | .bus = &platform_bus_type, | ||
2044 | .probe = wbsd_probe, | 2042 | .probe = wbsd_probe, |
2045 | .remove = wbsd_remove, | 2043 | .remove = __devexit_p(wbsd_remove), |
2046 | 2044 | ||
2047 | .suspend = wbsd_suspend, | 2045 | .suspend = wbsd_suspend, |
2048 | .resume = wbsd_resume, | 2046 | .resume = wbsd_resume, |
2047 | .driver = { | ||
2048 | .name = DRIVER_NAME, | ||
2049 | }, | ||
2049 | }; | 2050 | }; |
2050 | 2051 | ||
2051 | #ifdef CONFIG_PNP | 2052 | #ifdef CONFIG_PNP |
@@ -2054,7 +2055,7 @@ static struct pnp_driver wbsd_pnp_driver = { | |||
2054 | .name = DRIVER_NAME, | 2055 | .name = DRIVER_NAME, |
2055 | .id_table = pnp_dev_table, | 2056 | .id_table = pnp_dev_table, |
2056 | .probe = wbsd_pnp_probe, | 2057 | .probe = wbsd_pnp_probe, |
2057 | .remove = wbsd_pnp_remove, | 2058 | .remove = __devexit_p(wbsd_pnp_remove), |
2058 | }; | 2059 | }; |
2059 | 2060 | ||
2060 | #endif /* CONFIG_PNP */ | 2061 | #endif /* CONFIG_PNP */ |
@@ -2085,7 +2086,7 @@ static int __init wbsd_drv_init(void) | |||
2085 | 2086 | ||
2086 | if (nopnp) | 2087 | if (nopnp) |
2087 | { | 2088 | { |
2088 | result = driver_register(&wbsd_driver); | 2089 | result = platform_driver_register(&wbsd_driver); |
2089 | if (result < 0) | 2090 | if (result < 0) |
2090 | return result; | 2091 | return result; |
2091 | 2092 | ||
@@ -2111,7 +2112,7 @@ static void __exit wbsd_drv_exit(void) | |||
2111 | { | 2112 | { |
2112 | platform_device_unregister(wbsd_device); | 2113 | platform_device_unregister(wbsd_device); |
2113 | 2114 | ||
2114 | driver_unregister(&wbsd_driver); | 2115 | platform_driver_unregister(&wbsd_driver); |
2115 | } | 2116 | } |
2116 | 2117 | ||
2117 | DBG("unloaded\n"); | 2118 | DBG("unloaded\n"); |
@@ -2127,6 +2128,7 @@ module_param(irq, uint, 0444); | |||
2127 | module_param(dma, int, 0444); | 2128 | module_param(dma, int, 0444); |
2128 | 2129 | ||
2129 | MODULE_LICENSE("GPL"); | 2130 | MODULE_LICENSE("GPL"); |
2131 | MODULE_AUTHOR("Pierre Ossman <drzeus@drzeus.cx>"); | ||
2130 | MODULE_DESCRIPTION("Winbond W83L51xD SD/MMC card interface driver"); | 2132 | MODULE_DESCRIPTION("Winbond W83L51xD SD/MMC card interface driver"); |
2131 | MODULE_VERSION(DRIVER_VERSION); | 2133 | MODULE_VERSION(DRIVER_VERSION); |
2132 | 2134 | ||
diff --git a/drivers/mtd/maps/bast-flash.c b/drivers/mtd/maps/bast-flash.c index b7858eb93534..51f962dd7e31 100644 --- a/drivers/mtd/maps/bast-flash.c +++ b/drivers/mtd/maps/bast-flash.c | |||
@@ -63,11 +63,6 @@ struct bast_flash_info { | |||
63 | 63 | ||
64 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 64 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
65 | 65 | ||
66 | static struct bast_flash_info *to_bast_info(struct device *dev) | ||
67 | { | ||
68 | return (struct bast_flash_info *)dev_get_drvdata(dev); | ||
69 | } | ||
70 | |||
71 | static void bast_flash_setrw(int to) | 66 | static void bast_flash_setrw(int to) |
72 | { | 67 | { |
73 | unsigned int val; | 68 | unsigned int val; |
@@ -87,11 +82,11 @@ static void bast_flash_setrw(int to) | |||
87 | local_irq_restore(flags); | 82 | local_irq_restore(flags); |
88 | } | 83 | } |
89 | 84 | ||
90 | static int bast_flash_remove(struct device *dev) | 85 | static int bast_flash_remove(struct platform_device *pdev) |
91 | { | 86 | { |
92 | struct bast_flash_info *info = to_bast_info(dev); | 87 | struct bast_flash_info *info = platform_get_drvdata(pdev); |
93 | 88 | ||
94 | dev_set_drvdata(dev, NULL); | 89 | platform_set_drvdata(pdev, NULL); |
95 | 90 | ||
96 | if (info == NULL) | 91 | if (info == NULL) |
97 | return 0; | 92 | return 0; |
@@ -116,9 +111,8 @@ static int bast_flash_remove(struct device *dev) | |||
116 | return 0; | 111 | return 0; |
117 | } | 112 | } |
118 | 113 | ||
119 | static int bast_flash_probe(struct device *dev) | 114 | static int bast_flash_probe(struct platform_device *pdev) |
120 | { | 115 | { |
121 | struct platform_device *pdev = to_platform_device(dev); | ||
122 | struct bast_flash_info *info; | 116 | struct bast_flash_info *info; |
123 | struct resource *res; | 117 | struct resource *res; |
124 | int err = 0; | 118 | int err = 0; |
@@ -131,13 +125,13 @@ static int bast_flash_probe(struct device *dev) | |||
131 | } | 125 | } |
132 | 126 | ||
133 | memzero(info, sizeof(*info)); | 127 | memzero(info, sizeof(*info)); |
134 | dev_set_drvdata(dev, info); | 128 | platform_set_drvdata(pdev, info); |
135 | 129 | ||
136 | res = pdev->resource; /* assume that the flash has one resource */ | 130 | res = pdev->resource; /* assume that the flash has one resource */ |
137 | 131 | ||
138 | info->map.phys = res->start; | 132 | info->map.phys = res->start; |
139 | info->map.size = res->end - res->start + 1; | 133 | info->map.size = res->end - res->start + 1; |
140 | info->map.name = dev->bus_id; | 134 | info->map.name = pdev->dev.bus_id; |
141 | info->map.bankwidth = 2; | 135 | info->map.bankwidth = 2; |
142 | 136 | ||
143 | if (info->map.size > AREA_MAXSIZE) | 137 | if (info->map.size > AREA_MAXSIZE) |
@@ -199,27 +193,28 @@ static int bast_flash_probe(struct device *dev) | |||
199 | /* fall through to exit error */ | 193 | /* fall through to exit error */ |
200 | 194 | ||
201 | exit_error: | 195 | exit_error: |
202 | bast_flash_remove(dev); | 196 | bast_flash_remove(pdev); |
203 | return err; | 197 | return err; |
204 | } | 198 | } |
205 | 199 | ||
206 | static struct device_driver bast_flash_driver = { | 200 | static struct platform_driver bast_flash_driver = { |
207 | .name = "bast-nor", | ||
208 | .owner = THIS_MODULE, | ||
209 | .bus = &platform_bus_type, | ||
210 | .probe = bast_flash_probe, | 201 | .probe = bast_flash_probe, |
211 | .remove = bast_flash_remove, | 202 | .remove = bast_flash_remove, |
203 | .driver = { | ||
204 | .name = "bast-nor", | ||
205 | .owner = THIS_MODULE, | ||
206 | }, | ||
212 | }; | 207 | }; |
213 | 208 | ||
214 | static int __init bast_flash_init(void) | 209 | static int __init bast_flash_init(void) |
215 | { | 210 | { |
216 | printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n"); | 211 | printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n"); |
217 | return driver_register(&bast_flash_driver); | 212 | return platform_driver_register(&bast_flash_driver); |
218 | } | 213 | } |
219 | 214 | ||
220 | static void __exit bast_flash_exit(void) | 215 | static void __exit bast_flash_exit(void) |
221 | { | 216 | { |
222 | driver_unregister(&bast_flash_driver); | 217 | platform_driver_unregister(&bast_flash_driver); |
223 | } | 218 | } |
224 | 219 | ||
225 | module_init(bast_flash_init); | 220 | module_init(bast_flash_init); |
diff --git a/drivers/mtd/maps/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c index fe738fd8d6f8..a3ba52fbd868 100644 --- a/drivers/mtd/maps/integrator-flash.c +++ b/drivers/mtd/maps/integrator-flash.c | |||
@@ -67,9 +67,8 @@ static void armflash_set_vpp(struct map_info *map, int on) | |||
67 | 67 | ||
68 | static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL }; | 68 | static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL }; |
69 | 69 | ||
70 | static int armflash_probe(struct device *_dev) | 70 | static int armflash_probe(struct platform_device *dev) |
71 | { | 71 | { |
72 | struct platform_device *dev = to_platform_device(_dev); | ||
73 | struct flash_platform_data *plat = dev->dev.platform_data; | 72 | struct flash_platform_data *plat = dev->dev.platform_data; |
74 | struct resource *res = dev->resource; | 73 | struct resource *res = dev->resource; |
75 | unsigned int size = res->end - res->start + 1; | 74 | unsigned int size = res->end - res->start + 1; |
@@ -138,7 +137,7 @@ static int armflash_probe(struct device *_dev) | |||
138 | } | 137 | } |
139 | 138 | ||
140 | if (err == 0) | 139 | if (err == 0) |
141 | dev_set_drvdata(&dev->dev, info); | 140 | platform_set_drvdata(dev, info); |
142 | 141 | ||
143 | /* | 142 | /* |
144 | * If we got an error, free all resources. | 143 | * If we got an error, free all resources. |
@@ -163,12 +162,11 @@ static int armflash_probe(struct device *_dev) | |||
163 | return err; | 162 | return err; |
164 | } | 163 | } |
165 | 164 | ||
166 | static int armflash_remove(struct device *_dev) | 165 | static int armflash_remove(struct platform_device *dev) |
167 | { | 166 | { |
168 | struct platform_device *dev = to_platform_device(_dev); | 167 | struct armflash_info *info = platform_get_drvdata(dev); |
169 | struct armflash_info *info = dev_get_drvdata(&dev->dev); | ||
170 | 168 | ||
171 | dev_set_drvdata(&dev->dev, NULL); | 169 | platform_set_drvdata(dev, NULL); |
172 | 170 | ||
173 | if (info) { | 171 | if (info) { |
174 | if (info->mtd) { | 172 | if (info->mtd) { |
@@ -190,21 +188,22 @@ static int armflash_remove(struct device *_dev) | |||
190 | return 0; | 188 | return 0; |
191 | } | 189 | } |
192 | 190 | ||
193 | static struct device_driver armflash_driver = { | 191 | static struct platform_driver armflash_driver = { |
194 | .name = "armflash", | ||
195 | .bus = &platform_bus_type, | ||
196 | .probe = armflash_probe, | 192 | .probe = armflash_probe, |
197 | .remove = armflash_remove, | 193 | .remove = armflash_remove, |
194 | .driver = { | ||
195 | .name = "armflash", | ||
196 | }, | ||
198 | }; | 197 | }; |
199 | 198 | ||
200 | static int __init armflash_init(void) | 199 | static int __init armflash_init(void) |
201 | { | 200 | { |
202 | return driver_register(&armflash_driver); | 201 | return platform_driver_register(&armflash_driver); |
203 | } | 202 | } |
204 | 203 | ||
205 | static void __exit armflash_exit(void) | 204 | static void __exit armflash_exit(void) |
206 | { | 205 | { |
207 | driver_unregister(&armflash_driver); | 206 | platform_driver_unregister(&armflash_driver); |
208 | } | 207 | } |
209 | 208 | ||
210 | module_init(armflash_init); | 209 | module_init(armflash_init); |
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c index 641eb2b55e9f..fc7a78e31735 100644 --- a/drivers/mtd/maps/ixp2000.c +++ b/drivers/mtd/maps/ixp2000.c | |||
@@ -111,13 +111,12 @@ static void ixp2000_flash_copy_to(struct map_info *map, unsigned long to, | |||
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | static int ixp2000_flash_remove(struct device *_dev) | 114 | static int ixp2000_flash_remove(struct platform_device *dev) |
115 | { | 115 | { |
116 | struct platform_device *dev = to_platform_device(_dev); | ||
117 | struct flash_platform_data *plat = dev->dev.platform_data; | 116 | struct flash_platform_data *plat = dev->dev.platform_data; |
118 | struct ixp2000_flash_info *info = dev_get_drvdata(&dev->dev); | 117 | struct ixp2000_flash_info *info = platform_get_drvdata(dev); |
119 | 118 | ||
120 | dev_set_drvdata(&dev->dev, NULL); | 119 | platform_set_drvdata(dev, NULL); |
121 | 120 | ||
122 | if(!info) | 121 | if(!info) |
123 | return 0; | 122 | return 0; |
@@ -143,10 +142,9 @@ static int ixp2000_flash_remove(struct device *_dev) | |||
143 | } | 142 | } |
144 | 143 | ||
145 | 144 | ||
146 | static int ixp2000_flash_probe(struct device *_dev) | 145 | static int ixp2000_flash_probe(struct platform_device *dev) |
147 | { | 146 | { |
148 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 147 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
149 | struct platform_device *dev = to_platform_device(_dev); | ||
150 | struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; | 148 | struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; |
151 | struct flash_platform_data *plat; | 149 | struct flash_platform_data *plat; |
152 | struct ixp2000_flash_info *info; | 150 | struct ixp2000_flash_info *info; |
@@ -177,7 +175,7 @@ static int ixp2000_flash_probe(struct device *_dev) | |||
177 | } | 175 | } |
178 | memzero(info, sizeof(struct ixp2000_flash_info)); | 176 | memzero(info, sizeof(struct ixp2000_flash_info)); |
179 | 177 | ||
180 | dev_set_drvdata(&dev->dev, info); | 178 | platform_set_drvdata(dev, info); |
181 | 179 | ||
182 | /* | 180 | /* |
183 | * Tell the MTD layer we're not 1:1 mapped so that it does | 181 | * Tell the MTD layer we're not 1:1 mapped so that it does |
@@ -248,25 +246,26 @@ static int ixp2000_flash_probe(struct device *_dev) | |||
248 | return 0; | 246 | return 0; |
249 | 247 | ||
250 | Error: | 248 | Error: |
251 | ixp2000_flash_remove(_dev); | 249 | ixp2000_flash_remove(dev); |
252 | return err; | 250 | return err; |
253 | } | 251 | } |
254 | 252 | ||
255 | static struct device_driver ixp2000_flash_driver = { | 253 | static struct platform_driver ixp2000_flash_driver = { |
256 | .name = "IXP2000-Flash", | ||
257 | .bus = &platform_bus_type, | ||
258 | .probe = &ixp2000_flash_probe, | 254 | .probe = &ixp2000_flash_probe, |
259 | .remove = &ixp2000_flash_remove | 255 | .remove = &ixp2000_flash_remove |
256 | .driver = { | ||
257 | .name = "IXP2000-Flash", | ||
258 | }, | ||
260 | }; | 259 | }; |
261 | 260 | ||
262 | static int __init ixp2000_flash_init(void) | 261 | static int __init ixp2000_flash_init(void) |
263 | { | 262 | { |
264 | return driver_register(&ixp2000_flash_driver); | 263 | return platform_driver_register(&ixp2000_flash_driver); |
265 | } | 264 | } |
266 | 265 | ||
267 | static void __exit ixp2000_flash_exit(void) | 266 | static void __exit ixp2000_flash_exit(void) |
268 | { | 267 | { |
269 | driver_unregister(&ixp2000_flash_driver); | 268 | platform_driver_unregister(&ixp2000_flash_driver); |
270 | } | 269 | } |
271 | 270 | ||
272 | module_init(ixp2000_flash_init); | 271 | module_init(ixp2000_flash_init); |
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index 56b3a355bf7b..a59f8027903c 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
@@ -99,13 +99,12 @@ struct ixp4xx_flash_info { | |||
99 | 99 | ||
100 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 100 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
101 | 101 | ||
102 | static int ixp4xx_flash_remove(struct device *_dev) | 102 | static int ixp4xx_flash_remove(struct platform_device *dev) |
103 | { | 103 | { |
104 | struct platform_device *dev = to_platform_device(_dev); | ||
105 | struct flash_platform_data *plat = dev->dev.platform_data; | 104 | struct flash_platform_data *plat = dev->dev.platform_data; |
106 | struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev); | 105 | struct ixp4xx_flash_info *info = platform_get_drvdata(dev); |
107 | 106 | ||
108 | dev_set_drvdata(&dev->dev, NULL); | 107 | platform_set_drvdata(dev, NULL); |
109 | 108 | ||
110 | if(!info) | 109 | if(!info) |
111 | return 0; | 110 | return 0; |
@@ -130,9 +129,8 @@ static int ixp4xx_flash_remove(struct device *_dev) | |||
130 | return 0; | 129 | return 0; |
131 | } | 130 | } |
132 | 131 | ||
133 | static int ixp4xx_flash_probe(struct device *_dev) | 132 | static int ixp4xx_flash_probe(struct platform_device *dev) |
134 | { | 133 | { |
135 | struct platform_device *dev = to_platform_device(_dev); | ||
136 | struct flash_platform_data *plat = dev->dev.platform_data; | 134 | struct flash_platform_data *plat = dev->dev.platform_data; |
137 | struct ixp4xx_flash_info *info; | 135 | struct ixp4xx_flash_info *info; |
138 | int err = -1; | 136 | int err = -1; |
@@ -153,7 +151,7 @@ static int ixp4xx_flash_probe(struct device *_dev) | |||
153 | } | 151 | } |
154 | memzero(info, sizeof(struct ixp4xx_flash_info)); | 152 | memzero(info, sizeof(struct ixp4xx_flash_info)); |
155 | 153 | ||
156 | dev_set_drvdata(&dev->dev, info); | 154 | platform_set_drvdata(dev, info); |
157 | 155 | ||
158 | /* | 156 | /* |
159 | * Tell the MTD layer we're not 1:1 mapped so that it does | 157 | * Tell the MTD layer we're not 1:1 mapped so that it does |
@@ -214,25 +212,26 @@ static int ixp4xx_flash_probe(struct device *_dev) | |||
214 | return 0; | 212 | return 0; |
215 | 213 | ||
216 | Error: | 214 | Error: |
217 | ixp4xx_flash_remove(_dev); | 215 | ixp4xx_flash_remove(dev); |
218 | return err; | 216 | return err; |
219 | } | 217 | } |
220 | 218 | ||
221 | static struct device_driver ixp4xx_flash_driver = { | 219 | static struct platform_driver ixp4xx_flash_driver = { |
222 | .name = "IXP4XX-Flash", | ||
223 | .bus = &platform_bus_type, | ||
224 | .probe = ixp4xx_flash_probe, | 220 | .probe = ixp4xx_flash_probe, |
225 | .remove = ixp4xx_flash_remove, | 221 | .remove = ixp4xx_flash_remove, |
222 | .driver = { | ||
223 | .name = "IXP4XX-Flash", | ||
224 | }, | ||
226 | }; | 225 | }; |
227 | 226 | ||
228 | static int __init ixp4xx_flash_init(void) | 227 | static int __init ixp4xx_flash_init(void) |
229 | { | 228 | { |
230 | return driver_register(&ixp4xx_flash_driver); | 229 | return platform_driver_register(&ixp4xx_flash_driver); |
231 | } | 230 | } |
232 | 231 | ||
233 | static void __exit ixp4xx_flash_exit(void) | 232 | static void __exit ixp4xx_flash_exit(void) |
234 | { | 233 | { |
235 | driver_unregister(&ixp4xx_flash_driver); | 234 | platform_driver_unregister(&ixp4xx_flash_driver); |
236 | } | 235 | } |
237 | 236 | ||
238 | 237 | ||
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c index fd3b4a5fc207..418afffb2d80 100644 --- a/drivers/mtd/maps/omap_nor.c +++ b/drivers/mtd/maps/omap_nor.c | |||
@@ -70,11 +70,10 @@ static void omap_set_vpp(struct map_info *map, int enable) | |||
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | static int __devinit omapflash_probe(struct device *dev) | 73 | static int __devinit omapflash_probe(struct platform_device *pdev) |
74 | { | 74 | { |
75 | int err; | 75 | int err; |
76 | struct omapflash_info *info; | 76 | struct omapflash_info *info; |
77 | struct platform_device *pdev = to_platform_device(dev); | ||
78 | struct flash_platform_data *pdata = pdev->dev.platform_data; | 77 | struct flash_platform_data *pdata = pdev->dev.platform_data; |
79 | struct resource *res = pdev->resource; | 78 | struct resource *res = pdev->resource; |
80 | unsigned long size = res->end - res->start + 1; | 79 | unsigned long size = res->end - res->start + 1; |
@@ -119,7 +118,7 @@ static int __devinit omapflash_probe(struct device *dev) | |||
119 | #endif | 118 | #endif |
120 | add_mtd_device(info->mtd); | 119 | add_mtd_device(info->mtd); |
121 | 120 | ||
122 | dev_set_drvdata(&pdev->dev, info); | 121 | platform_set_drvdata(pdev, info); |
123 | 122 | ||
124 | return 0; | 123 | return 0; |
125 | 124 | ||
@@ -133,12 +132,11 @@ out_free_info: | |||
133 | return err; | 132 | return err; |
134 | } | 133 | } |
135 | 134 | ||
136 | static int __devexit omapflash_remove(struct device *dev) | 135 | static int __devexit omapflash_remove(struct platform_device *pdev) |
137 | { | 136 | { |
138 | struct platform_device *pdev = to_platform_device(dev); | 137 | struct omapflash_info *info = platform_get_drvdata(pdev); |
139 | struct omapflash_info *info = dev_get_drvdata(&pdev->dev); | ||
140 | 138 | ||
141 | dev_set_drvdata(&pdev->dev, NULL); | 139 | platform_set_drvdata(pdev, NULL); |
142 | 140 | ||
143 | if (info) { | 141 | if (info) { |
144 | if (info->parts) { | 142 | if (info->parts) { |
@@ -155,21 +153,22 @@ static int __devexit omapflash_remove(struct device *dev) | |||
155 | return 0; | 153 | return 0; |
156 | } | 154 | } |
157 | 155 | ||
158 | static struct device_driver omapflash_driver = { | 156 | static struct platform_driver omapflash_driver = { |
159 | .name = "omapflash", | ||
160 | .bus = &platform_bus_type, | ||
161 | .probe = omapflash_probe, | 157 | .probe = omapflash_probe, |
162 | .remove = __devexit_p(omapflash_remove), | 158 | .remove = __devexit_p(omapflash_remove), |
159 | .driver = { | ||
160 | .name = "omapflash", | ||
161 | }, | ||
163 | }; | 162 | }; |
164 | 163 | ||
165 | static int __init omapflash_init(void) | 164 | static int __init omapflash_init(void) |
166 | { | 165 | { |
167 | return driver_register(&omapflash_driver); | 166 | return platform_driver_register(&omapflash_driver); |
168 | } | 167 | } |
169 | 168 | ||
170 | static void __exit omapflash_exit(void) | 169 | static void __exit omapflash_exit(void) |
171 | { | 170 | { |
172 | driver_unregister(&omapflash_driver); | 171 | platform_driver_unregister(&omapflash_driver); |
173 | } | 172 | } |
174 | 173 | ||
175 | module_init(omapflash_init); | 174 | module_init(omapflash_init); |
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c index a02eed94a231..5d3c75451ca2 100644 --- a/drivers/mtd/maps/plat-ram.c +++ b/drivers/mtd/maps/plat-ram.c | |||
@@ -56,9 +56,9 @@ struct platram_info { | |||
56 | * device private data to struct platram_info conversion | 56 | * device private data to struct platram_info conversion |
57 | */ | 57 | */ |
58 | 58 | ||
59 | static inline struct platram_info *to_platram_info(struct device *dev) | 59 | static inline struct platram_info *to_platram_info(struct platform_device *dev) |
60 | { | 60 | { |
61 | return (struct platram_info *)dev_get_drvdata(dev); | 61 | return (struct platram_info *)platform_get_drvdata(dev); |
62 | } | 62 | } |
63 | 63 | ||
64 | /* platram_setrw | 64 | /* platram_setrw |
@@ -83,13 +83,13 @@ static inline void platram_setrw(struct platram_info *info, int to) | |||
83 | * called to remove the device from the driver's control | 83 | * called to remove the device from the driver's control |
84 | */ | 84 | */ |
85 | 85 | ||
86 | static int platram_remove(struct device *dev) | 86 | static int platram_remove(struct platform_device *pdev) |
87 | { | 87 | { |
88 | struct platram_info *info = to_platram_info(dev); | 88 | struct platram_info *info = to_platram_info(pdev); |
89 | 89 | ||
90 | dev_set_drvdata(dev, NULL); | 90 | platform_set_drvdata(pdev, NULL); |
91 | 91 | ||
92 | dev_dbg(dev, "removing device\n"); | 92 | dev_dbg(&pdev->dev, "removing device\n"); |
93 | 93 | ||
94 | if (info == NULL) | 94 | if (info == NULL) |
95 | return 0; | 95 | return 0; |
@@ -130,61 +130,60 @@ static int platram_remove(struct device *dev) | |||
130 | * driver is found. | 130 | * driver is found. |
131 | */ | 131 | */ |
132 | 132 | ||
133 | static int platram_probe(struct device *dev) | 133 | static int platram_probe(struct platform_device *pdev) |
134 | { | 134 | { |
135 | struct platform_device *pd = to_platform_device(dev); | ||
136 | struct platdata_mtd_ram *pdata; | 135 | struct platdata_mtd_ram *pdata; |
137 | struct platram_info *info; | 136 | struct platram_info *info; |
138 | struct resource *res; | 137 | struct resource *res; |
139 | int err = 0; | 138 | int err = 0; |
140 | 139 | ||
141 | dev_dbg(dev, "probe entered\n"); | 140 | dev_dbg(&pdev->dev, "probe entered\n"); |
142 | 141 | ||
143 | if (dev->platform_data == NULL) { | 142 | if (pdev->dev.platform_data == NULL) { |
144 | dev_err(dev, "no platform data supplied\n"); | 143 | dev_err(&pdev->dev, "no platform data supplied\n"); |
145 | err = -ENOENT; | 144 | err = -ENOENT; |
146 | goto exit_error; | 145 | goto exit_error; |
147 | } | 146 | } |
148 | 147 | ||
149 | pdata = dev->platform_data; | 148 | pdata = pdev->dev.platform_data; |
150 | 149 | ||
151 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 150 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
152 | if (info == NULL) { | 151 | if (info == NULL) { |
153 | dev_err(dev, "no memory for flash info\n"); | 152 | dev_err(&pdev->dev, "no memory for flash info\n"); |
154 | err = -ENOMEM; | 153 | err = -ENOMEM; |
155 | goto exit_error; | 154 | goto exit_error; |
156 | } | 155 | } |
157 | 156 | ||
158 | memset(info, 0, sizeof(*info)); | 157 | memset(info, 0, sizeof(*info)); |
159 | dev_set_drvdata(dev, info); | 158 | platform_set_drvdata(pdev, info); |
160 | 159 | ||
161 | info->dev = dev; | 160 | info->dev = &pdev->dev; |
162 | info->pdata = pdata; | 161 | info->pdata = pdata; |
163 | 162 | ||
164 | /* get the resource for the memory mapping */ | 163 | /* get the resource for the memory mapping */ |
165 | 164 | ||
166 | res = platform_get_resource(pd, IORESOURCE_MEM, 0); | 165 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
167 | 166 | ||
168 | if (res == NULL) { | 167 | if (res == NULL) { |
169 | dev_err(dev, "no memory resource specified\n"); | 168 | dev_err(&pdev->dev, "no memory resource specified\n"); |
170 | err = -ENOENT; | 169 | err = -ENOENT; |
171 | goto exit_free; | 170 | goto exit_free; |
172 | } | 171 | } |
173 | 172 | ||
174 | dev_dbg(dev, "got platform resource %p (0x%lx)\n", res, res->start); | 173 | dev_dbg(&pdev->dev, "got platform resource %p (0x%lx)\n", res, res->start); |
175 | 174 | ||
176 | /* setup map parameters */ | 175 | /* setup map parameters */ |
177 | 176 | ||
178 | info->map.phys = res->start; | 177 | info->map.phys = res->start; |
179 | info->map.size = (res->end - res->start) + 1; | 178 | info->map.size = (res->end - res->start) + 1; |
180 | info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pd->name; | 179 | info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pdev->name; |
181 | info->map.bankwidth = pdata->bankwidth; | 180 | info->map.bankwidth = pdata->bankwidth; |
182 | 181 | ||
183 | /* register our usage of the memory area */ | 182 | /* register our usage of the memory area */ |
184 | 183 | ||
185 | info->area = request_mem_region(res->start, info->map.size, pd->name); | 184 | info->area = request_mem_region(res->start, info->map.size, pdev->name); |
186 | if (info->area == NULL) { | 185 | if (info->area == NULL) { |
187 | dev_err(dev, "failed to request memory region\n"); | 186 | dev_err(&pdev->dev, "failed to request memory region\n"); |
188 | err = -EIO; | 187 | err = -EIO; |
189 | goto exit_free; | 188 | goto exit_free; |
190 | } | 189 | } |
@@ -192,23 +191,23 @@ static int platram_probe(struct device *dev) | |||
192 | /* remap the memory area */ | 191 | /* remap the memory area */ |
193 | 192 | ||
194 | info->map.virt = ioremap(res->start, info->map.size); | 193 | info->map.virt = ioremap(res->start, info->map.size); |
195 | dev_dbg(dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size); | 194 | dev_dbg(&pdev->dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size); |
196 | 195 | ||
197 | if (info->map.virt == NULL) { | 196 | if (info->map.virt == NULL) { |
198 | dev_err(dev, "failed to ioremap() region\n"); | 197 | dev_err(&pdev->dev, "failed to ioremap() region\n"); |
199 | err = -EIO; | 198 | err = -EIO; |
200 | goto exit_free; | 199 | goto exit_free; |
201 | } | 200 | } |
202 | 201 | ||
203 | simple_map_init(&info->map); | 202 | simple_map_init(&info->map); |
204 | 203 | ||
205 | dev_dbg(dev, "initialised map, probing for mtd\n"); | 204 | dev_dbg(&pdev->dev, "initialised map, probing for mtd\n"); |
206 | 205 | ||
207 | /* probe for the right mtd map driver */ | 206 | /* probe for the right mtd map driver */ |
208 | 207 | ||
209 | info->mtd = do_map_probe("map_ram" , &info->map); | 208 | info->mtd = do_map_probe("map_ram" , &info->map); |
210 | if (info->mtd == NULL) { | 209 | if (info->mtd == NULL) { |
211 | dev_err(dev, "failed to probe for map_ram\n"); | 210 | dev_err(&pdev->dev, "failed to probe for map_ram\n"); |
212 | err = -ENOMEM; | 211 | err = -ENOMEM; |
213 | goto exit_free; | 212 | goto exit_free; |
214 | } | 213 | } |
@@ -237,27 +236,28 @@ static int platram_probe(struct device *dev) | |||
237 | #endif /* CONFIG_MTD_PARTITIONS */ | 236 | #endif /* CONFIG_MTD_PARTITIONS */ |
238 | 237 | ||
239 | if (add_mtd_device(info->mtd)) { | 238 | if (add_mtd_device(info->mtd)) { |
240 | dev_err(dev, "add_mtd_device() failed\n"); | 239 | dev_err(&pdev->dev, "add_mtd_device() failed\n"); |
241 | err = -ENOMEM; | 240 | err = -ENOMEM; |
242 | } | 241 | } |
243 | 242 | ||
244 | dev_info(dev, "registered mtd device\n"); | 243 | dev_info(&pdev->dev, "registered mtd device\n"); |
245 | return err; | 244 | return err; |
246 | 245 | ||
247 | exit_free: | 246 | exit_free: |
248 | platram_remove(dev); | 247 | platram_remove(pdev); |
249 | exit_error: | 248 | exit_error: |
250 | return err; | 249 | return err; |
251 | } | 250 | } |
252 | 251 | ||
253 | /* device driver info */ | 252 | /* device driver info */ |
254 | 253 | ||
255 | static struct device_driver platram_driver = { | 254 | static struct platform_driver platram_driver = { |
256 | .name = "mtd-ram", | ||
257 | .owner = THIS_MODULE, | ||
258 | .bus = &platform_bus_type, | ||
259 | .probe = platram_probe, | 255 | .probe = platram_probe, |
260 | .remove = platram_remove, | 256 | .remove = platram_remove, |
257 | .driver = { | ||
258 | .name = "mtd-ram", | ||
259 | .owner = THIS_MODULE, | ||
260 | }, | ||
261 | }; | 261 | }; |
262 | 262 | ||
263 | /* module init/exit */ | 263 | /* module init/exit */ |
@@ -265,12 +265,12 @@ static struct device_driver platram_driver = { | |||
265 | static int __init platram_init(void) | 265 | static int __init platram_init(void) |
266 | { | 266 | { |
267 | printk("Generic platform RAM MTD, (c) 2004 Simtec Electronics\n"); | 267 | printk("Generic platform RAM MTD, (c) 2004 Simtec Electronics\n"); |
268 | return driver_register(&platram_driver); | 268 | return platform_driver_register(&platram_driver); |
269 | } | 269 | } |
270 | 270 | ||
271 | static void __exit platram_exit(void) | 271 | static void __exit platram_exit(void) |
272 | { | 272 | { |
273 | driver_unregister(&platram_driver); | 273 | platform_driver_unregister(&platram_driver); |
274 | } | 274 | } |
275 | 275 | ||
276 | module_init(platram_init); | 276 | module_init(platram_init); |
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index 9e8bb1782be0..5cefb015633c 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c | |||
@@ -356,9 +356,8 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat) | |||
356 | 356 | ||
357 | static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; | 357 | static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; |
358 | 358 | ||
359 | static int __init sa1100_mtd_probe(struct device *dev) | 359 | static int __init sa1100_mtd_probe(struct platform_device *pdev) |
360 | { | 360 | { |
361 | struct platform_device *pdev = to_platform_device(dev); | ||
362 | struct flash_platform_data *plat = pdev->dev.platform_data; | 361 | struct flash_platform_data *plat = pdev->dev.platform_data; |
363 | struct mtd_partition *parts; | 362 | struct mtd_partition *parts; |
364 | const char *part_type = NULL; | 363 | const char *part_type = NULL; |
@@ -402,28 +401,28 @@ static int __init sa1100_mtd_probe(struct device *dev) | |||
402 | 401 | ||
403 | info->nr_parts = nr_parts; | 402 | info->nr_parts = nr_parts; |
404 | 403 | ||
405 | dev_set_drvdata(dev, info); | 404 | platform_set_drvdata(pdev, info); |
406 | err = 0; | 405 | err = 0; |
407 | 406 | ||
408 | out: | 407 | out: |
409 | return err; | 408 | return err; |
410 | } | 409 | } |
411 | 410 | ||
412 | static int __exit sa1100_mtd_remove(struct device *dev) | 411 | static int __exit sa1100_mtd_remove(struct platform_device *pdev) |
413 | { | 412 | { |
414 | struct sa_info *info = dev_get_drvdata(dev); | 413 | struct sa_info *info = platform_get_drvdata(pdev); |
415 | struct flash_platform_data *plat = dev->platform_data; | 414 | struct flash_platform_data *plat = pdev->dev.platform_data; |
416 | 415 | ||
417 | dev_set_drvdata(dev, NULL); | 416 | platform_set_drvdata(pdev, NULL); |
418 | sa1100_destroy(info, plat); | 417 | sa1100_destroy(info, plat); |
419 | 418 | ||
420 | return 0; | 419 | return 0; |
421 | } | 420 | } |
422 | 421 | ||
423 | #ifdef CONFIG_PM | 422 | #ifdef CONFIG_PM |
424 | static int sa1100_mtd_suspend(struct device *dev, pm_message_t state) | 423 | static int sa1100_mtd_suspend(struct platform_device *dev, pm_message_t state) |
425 | { | 424 | { |
426 | struct sa_info *info = dev_get_drvdata(dev); | 425 | struct sa_info *info = platform_get_drvdata(dev); |
427 | int ret = 0; | 426 | int ret = 0; |
428 | 427 | ||
429 | if (info) | 428 | if (info) |
@@ -432,17 +431,17 @@ static int sa1100_mtd_suspend(struct device *dev, pm_message_t state) | |||
432 | return ret; | 431 | return ret; |
433 | } | 432 | } |
434 | 433 | ||
435 | static int sa1100_mtd_resume(struct device *dev) | 434 | static int sa1100_mtd_resume(struct platform_device *dev) |
436 | { | 435 | { |
437 | struct sa_info *info = dev_get_drvdata(dev); | 436 | struct sa_info *info = platform_get_drvdata(dev); |
438 | if (info) | 437 | if (info) |
439 | info->mtd->resume(info->mtd); | 438 | info->mtd->resume(info->mtd); |
440 | return 0; | 439 | return 0; |
441 | } | 440 | } |
442 | 441 | ||
443 | static void sa1100_mtd_shutdown(struct device *dev) | 442 | static void sa1100_mtd_shutdown(struct platform_device *dev) |
444 | { | 443 | { |
445 | struct sa_info *info = dev_get_drvdata(dev); | 444 | struct sa_info *info = platform_get_drvdata(dev); |
446 | if (info && info->mtd->suspend(info->mtd) == 0) | 445 | if (info && info->mtd->suspend(info->mtd) == 0) |
447 | info->mtd->resume(info->mtd); | 446 | info->mtd->resume(info->mtd); |
448 | } | 447 | } |
@@ -452,24 +451,25 @@ static void sa1100_mtd_shutdown(struct device *dev) | |||
452 | #define sa1100_mtd_shutdown NULL | 451 | #define sa1100_mtd_shutdown NULL |
453 | #endif | 452 | #endif |
454 | 453 | ||
455 | static struct device_driver sa1100_mtd_driver = { | 454 | static struct platform_driver sa1100_mtd_driver = { |
456 | .name = "flash", | ||
457 | .bus = &platform_bus_type, | ||
458 | .probe = sa1100_mtd_probe, | 455 | .probe = sa1100_mtd_probe, |
459 | .remove = __exit_p(sa1100_mtd_remove), | 456 | .remove = __exit_p(sa1100_mtd_remove), |
460 | .suspend = sa1100_mtd_suspend, | 457 | .suspend = sa1100_mtd_suspend, |
461 | .resume = sa1100_mtd_resume, | 458 | .resume = sa1100_mtd_resume, |
462 | .shutdown = sa1100_mtd_shutdown, | 459 | .shutdown = sa1100_mtd_shutdown, |
460 | .driver = { | ||
461 | .name = "flash", | ||
462 | }, | ||
463 | }; | 463 | }; |
464 | 464 | ||
465 | static int __init sa1100_mtd_init(void) | 465 | static int __init sa1100_mtd_init(void) |
466 | { | 466 | { |
467 | return driver_register(&sa1100_mtd_driver); | 467 | return platform_driver_register(&sa1100_mtd_driver); |
468 | } | 468 | } |
469 | 469 | ||
470 | static void __exit sa1100_mtd_exit(void) | 470 | static void __exit sa1100_mtd_exit(void) |
471 | { | 471 | { |
472 | driver_unregister(&sa1100_mtd_driver); | 472 | platform_driver_unregister(&sa1100_mtd_driver); |
473 | } | 473 | } |
474 | 474 | ||
475 | module_init(sa1100_mtd_init); | 475 | module_init(sa1100_mtd_init); |
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index 97e9b7892d29..d209214b1318 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c | |||
@@ -125,14 +125,14 @@ static struct s3c2410_nand_info *s3c2410_nand_mtd_toinfo(struct mtd_info *mtd) | |||
125 | return s3c2410_nand_mtd_toours(mtd)->info; | 125 | return s3c2410_nand_mtd_toours(mtd)->info; |
126 | } | 126 | } |
127 | 127 | ||
128 | static struct s3c2410_nand_info *to_nand_info(struct device *dev) | 128 | static struct s3c2410_nand_info *to_nand_info(struct platform_device *dev) |
129 | { | 129 | { |
130 | return dev_get_drvdata(dev); | 130 | return platform_get_drvdata(dev); |
131 | } | 131 | } |
132 | 132 | ||
133 | static struct s3c2410_platform_nand *to_nand_plat(struct device *dev) | 133 | static struct s3c2410_platform_nand *to_nand_plat(struct platform_device *dev) |
134 | { | 134 | { |
135 | return dev->platform_data; | 135 | return dev->dev.platform_data; |
136 | } | 136 | } |
137 | 137 | ||
138 | /* timing calculations */ | 138 | /* timing calculations */ |
@@ -165,9 +165,9 @@ static int s3c2410_nand_calc_rate(int wanted, unsigned long clk, int max) | |||
165 | /* controller setup */ | 165 | /* controller setup */ |
166 | 166 | ||
167 | static int s3c2410_nand_inithw(struct s3c2410_nand_info *info, | 167 | static int s3c2410_nand_inithw(struct s3c2410_nand_info *info, |
168 | struct device *dev) | 168 | struct platform_device *pdev) |
169 | { | 169 | { |
170 | struct s3c2410_platform_nand *plat = to_nand_plat(dev); | 170 | struct s3c2410_platform_nand *plat = to_nand_plat(pdev); |
171 | unsigned long clkrate = clk_get_rate(info->clk); | 171 | unsigned long clkrate = clk_get_rate(info->clk); |
172 | int tacls, twrph0, twrph1; | 172 | int tacls, twrph0, twrph1; |
173 | unsigned long cfg; | 173 | unsigned long cfg; |
@@ -430,11 +430,11 @@ static void s3c2410_nand_write_buf(struct mtd_info *mtd, | |||
430 | 430 | ||
431 | /* device management functions */ | 431 | /* device management functions */ |
432 | 432 | ||
433 | static int s3c2410_nand_remove(struct device *dev) | 433 | static int s3c2410_nand_remove(struct platform_device *pdev) |
434 | { | 434 | { |
435 | struct s3c2410_nand_info *info = to_nand_info(dev); | 435 | struct s3c2410_nand_info *info = to_nand_info(pdev); |
436 | 436 | ||
437 | dev_set_drvdata(dev, NULL); | 437 | platform_set_drvdata(pdev, NULL); |
438 | 438 | ||
439 | if (info == NULL) | 439 | if (info == NULL) |
440 | return 0; | 440 | return 0; |
@@ -562,10 +562,9 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info, | |||
562 | * nand layer to look for devices | 562 | * nand layer to look for devices |
563 | */ | 563 | */ |
564 | 564 | ||
565 | static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440) | 565 | static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440) |
566 | { | 566 | { |
567 | struct platform_device *pdev = to_platform_device(dev); | 567 | struct s3c2410_platform_nand *plat = to_nand_plat(pdev); |
568 | struct s3c2410_platform_nand *plat = to_nand_plat(dev); | ||
569 | struct s3c2410_nand_info *info; | 568 | struct s3c2410_nand_info *info; |
570 | struct s3c2410_nand_mtd *nmtd; | 569 | struct s3c2410_nand_mtd *nmtd; |
571 | struct s3c2410_nand_set *sets; | 570 | struct s3c2410_nand_set *sets; |
@@ -575,26 +574,26 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440) | |||
575 | int nr_sets; | 574 | int nr_sets; |
576 | int setno; | 575 | int setno; |
577 | 576 | ||
578 | pr_debug("s3c2410_nand_probe(%p)\n", dev); | 577 | pr_debug("s3c2410_nand_probe(%p)\n", pdev); |
579 | 578 | ||
580 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 579 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
581 | if (info == NULL) { | 580 | if (info == NULL) { |
582 | dev_err(dev, "no memory for flash info\n"); | 581 | dev_err(&pdev->dev, "no memory for flash info\n"); |
583 | err = -ENOMEM; | 582 | err = -ENOMEM; |
584 | goto exit_error; | 583 | goto exit_error; |
585 | } | 584 | } |
586 | 585 | ||
587 | memzero(info, sizeof(*info)); | 586 | memzero(info, sizeof(*info)); |
588 | dev_set_drvdata(dev, info); | 587 | platform_set_drvdata(pdev, info); |
589 | 588 | ||
590 | spin_lock_init(&info->controller.lock); | 589 | spin_lock_init(&info->controller.lock); |
591 | init_waitqueue_head(&info->controller.wq); | 590 | init_waitqueue_head(&info->controller.wq); |
592 | 591 | ||
593 | /* get the clock source and enable it */ | 592 | /* get the clock source and enable it */ |
594 | 593 | ||
595 | info->clk = clk_get(dev, "nand"); | 594 | info->clk = clk_get(&pdev->dev, "nand"); |
596 | if (IS_ERR(info->clk)) { | 595 | if (IS_ERR(info->clk)) { |
597 | dev_err(dev, "failed to get clock"); | 596 | dev_err(&pdev->dev, "failed to get clock"); |
598 | err = -ENOENT; | 597 | err = -ENOENT; |
599 | goto exit_error; | 598 | goto exit_error; |
600 | } | 599 | } |
@@ -611,27 +610,27 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440) | |||
611 | info->area = request_mem_region(res->start, size, pdev->name); | 610 | info->area = request_mem_region(res->start, size, pdev->name); |
612 | 611 | ||
613 | if (info->area == NULL) { | 612 | if (info->area == NULL) { |
614 | dev_err(dev, "cannot reserve register region\n"); | 613 | dev_err(&pdev->dev, "cannot reserve register region\n"); |
615 | err = -ENOENT; | 614 | err = -ENOENT; |
616 | goto exit_error; | 615 | goto exit_error; |
617 | } | 616 | } |
618 | 617 | ||
619 | info->device = dev; | 618 | info->device = &pdev->dev; |
620 | info->platform = plat; | 619 | info->platform = plat; |
621 | info->regs = ioremap(res->start, size); | 620 | info->regs = ioremap(res->start, size); |
622 | info->is_s3c2440 = is_s3c2440; | 621 | info->is_s3c2440 = is_s3c2440; |
623 | 622 | ||
624 | if (info->regs == NULL) { | 623 | if (info->regs == NULL) { |
625 | dev_err(dev, "cannot reserve register region\n"); | 624 | dev_err(&pdev->dev, "cannot reserve register region\n"); |
626 | err = -EIO; | 625 | err = -EIO; |
627 | goto exit_error; | 626 | goto exit_error; |
628 | } | 627 | } |
629 | 628 | ||
630 | dev_dbg(dev, "mapped registers at %p\n", info->regs); | 629 | dev_dbg(&pdev->dev, "mapped registers at %p\n", info->regs); |
631 | 630 | ||
632 | /* initialise the hardware */ | 631 | /* initialise the hardware */ |
633 | 632 | ||
634 | err = s3c2410_nand_inithw(info, dev); | 633 | err = s3c2410_nand_inithw(info, pdev); |
635 | if (err != 0) | 634 | if (err != 0) |
636 | goto exit_error; | 635 | goto exit_error; |
637 | 636 | ||
@@ -645,7 +644,7 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440) | |||
645 | size = nr_sets * sizeof(*info->mtds); | 644 | size = nr_sets * sizeof(*info->mtds); |
646 | info->mtds = kmalloc(size, GFP_KERNEL); | 645 | info->mtds = kmalloc(size, GFP_KERNEL); |
647 | if (info->mtds == NULL) { | 646 | if (info->mtds == NULL) { |
648 | dev_err(dev, "failed to allocate mtd storage\n"); | 647 | dev_err(&pdev->dev, "failed to allocate mtd storage\n"); |
649 | err = -ENOMEM; | 648 | err = -ENOMEM; |
650 | goto exit_error; | 649 | goto exit_error; |
651 | } | 650 | } |
@@ -677,7 +676,7 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440) | |||
677 | return 0; | 676 | return 0; |
678 | 677 | ||
679 | exit_error: | 678 | exit_error: |
680 | s3c2410_nand_remove(dev); | 679 | s3c2410_nand_remove(pdev); |
681 | 680 | ||
682 | if (err == 0) | 681 | if (err == 0) |
683 | err = -EINVAL; | 682 | err = -EINVAL; |
@@ -686,44 +685,46 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440) | |||
686 | 685 | ||
687 | /* driver device registration */ | 686 | /* driver device registration */ |
688 | 687 | ||
689 | static int s3c2410_nand_probe(struct device *dev) | 688 | static int s3c2410_nand_probe(struct platform_device *dev) |
690 | { | 689 | { |
691 | return s3c24xx_nand_probe(dev, 0); | 690 | return s3c24xx_nand_probe(dev, 0); |
692 | } | 691 | } |
693 | 692 | ||
694 | static int s3c2440_nand_probe(struct device *dev) | 693 | static int s3c2440_nand_probe(struct platform_device *dev) |
695 | { | 694 | { |
696 | return s3c24xx_nand_probe(dev, 1); | 695 | return s3c24xx_nand_probe(dev, 1); |
697 | } | 696 | } |
698 | 697 | ||
699 | static struct device_driver s3c2410_nand_driver = { | 698 | static struct platform_driver s3c2410_nand_driver = { |
700 | .name = "s3c2410-nand", | ||
701 | .owner = THIS_MODULE, | ||
702 | .bus = &platform_bus_type, | ||
703 | .probe = s3c2410_nand_probe, | 699 | .probe = s3c2410_nand_probe, |
704 | .remove = s3c2410_nand_remove, | 700 | .remove = s3c2410_nand_remove, |
701 | .driver = { | ||
702 | .name = "s3c2410-nand", | ||
703 | .owner = THIS_MODULE, | ||
704 | }, | ||
705 | }; | 705 | }; |
706 | 706 | ||
707 | static struct device_driver s3c2440_nand_driver = { | 707 | static struct platform_driver s3c2440_nand_driver = { |
708 | .name = "s3c2440-nand", | ||
709 | .owner = THIS_MODULE, | ||
710 | .bus = &platform_bus_type, | ||
711 | .probe = s3c2440_nand_probe, | 708 | .probe = s3c2440_nand_probe, |
712 | .remove = s3c2410_nand_remove, | 709 | .remove = s3c2410_nand_remove, |
710 | .driver = { | ||
711 | .name = "s3c2440-nand", | ||
712 | .owner = THIS_MODULE, | ||
713 | }, | ||
713 | }; | 714 | }; |
714 | 715 | ||
715 | static int __init s3c2410_nand_init(void) | 716 | static int __init s3c2410_nand_init(void) |
716 | { | 717 | { |
717 | printk("S3C24XX NAND Driver, (c) 2004 Simtec Electronics\n"); | 718 | printk("S3C24XX NAND Driver, (c) 2004 Simtec Electronics\n"); |
718 | 719 | ||
719 | driver_register(&s3c2440_nand_driver); | 720 | platform_driver_register(&s3c2440_nand_driver); |
720 | return driver_register(&s3c2410_nand_driver); | 721 | return platform_driver_register(&s3c2410_nand_driver); |
721 | } | 722 | } |
722 | 723 | ||
723 | static void __exit s3c2410_nand_exit(void) | 724 | static void __exit s3c2410_nand_exit(void) |
724 | { | 725 | { |
725 | driver_unregister(&s3c2440_nand_driver); | 726 | platform_driver_unregister(&s3c2440_nand_driver); |
726 | driver_unregister(&s3c2410_nand_driver); | 727 | platform_driver_unregister(&s3c2410_nand_driver); |
727 | } | 728 | } |
728 | 729 | ||
729 | module_init(s3c2410_nand_init); | 730 | module_init(s3c2410_nand_init); |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 5c69d57f8548..ebd7313d7fc1 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -812,7 +812,7 @@ config SMC91X | |||
812 | tristate "SMC 91C9x/91C1xxx support" | 812 | tristate "SMC 91C9x/91C1xxx support" |
813 | select CRC32 | 813 | select CRC32 |
814 | select MII | 814 | select MII |
815 | depends on NET_ETHERNET && (ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH) | 815 | depends on NET_ETHERNET && (ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00) |
816 | help | 816 | help |
817 | This is a driver for SMC's 91x series of Ethernet chipsets, | 817 | This is a driver for SMC's 91x series of Ethernet chipsets, |
818 | including the SMC91C94 and the SMC91C111. Say Y if you want it | 818 | including the SMC91C94 and the SMC91C111. Say Y if you want it |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 8f464271664d..49fa1e4413fa 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -2707,7 +2707,7 @@ bnx2_init_nvram(struct bnx2 *bp) | |||
2707 | 2707 | ||
2708 | if (j == entry_count) { | 2708 | if (j == entry_count) { |
2709 | bp->flash_info = NULL; | 2709 | bp->flash_info = NULL; |
2710 | printk(KERN_ALERT "Unknown flash/EEPROM type.\n"); | 2710 | printk(KERN_ALERT PFX "Unknown flash/EEPROM type.\n"); |
2711 | rc = -ENODEV; | 2711 | rc = -ENODEV; |
2712 | } | 2712 | } |
2713 | 2713 | ||
@@ -3903,6 +3903,8 @@ bnx2_test_loopback(struct bnx2 *bp) | |||
3903 | 3903 | ||
3904 | pkt_size = 1514; | 3904 | pkt_size = 1514; |
3905 | skb = dev_alloc_skb(pkt_size); | 3905 | skb = dev_alloc_skb(pkt_size); |
3906 | if (!skb) | ||
3907 | return -ENOMEM; | ||
3906 | packet = skb_put(skb, pkt_size); | 3908 | packet = skb_put(skb, pkt_size); |
3907 | memcpy(packet, bp->mac_addr, 6); | 3909 | memcpy(packet, bp->mac_addr, 6); |
3908 | memset(packet + 6, 0x0, 8); | 3910 | memset(packet + 6, 0x0, 8); |
@@ -4798,11 +4800,7 @@ bnx2_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
4798 | struct bnx2 *bp = dev->priv; | 4800 | struct bnx2 *bp = dev->priv; |
4799 | int rc; | 4801 | int rc; |
4800 | 4802 | ||
4801 | if (eeprom->offset > bp->flash_info->total_size) | 4803 | /* parameters already validated in ethtool_get_eeprom */ |
4802 | return -EINVAL; | ||
4803 | |||
4804 | if ((eeprom->offset + eeprom->len) > bp->flash_info->total_size) | ||
4805 | eeprom->len = bp->flash_info->total_size - eeprom->offset; | ||
4806 | 4804 | ||
4807 | rc = bnx2_nvram_read(bp, eeprom->offset, eebuf, eeprom->len); | 4805 | rc = bnx2_nvram_read(bp, eeprom->offset, eebuf, eeprom->len); |
4808 | 4806 | ||
@@ -4816,11 +4814,7 @@ bnx2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
4816 | struct bnx2 *bp = dev->priv; | 4814 | struct bnx2 *bp = dev->priv; |
4817 | int rc; | 4815 | int rc; |
4818 | 4816 | ||
4819 | if (eeprom->offset > bp->flash_info->total_size) | 4817 | /* parameters already validated in ethtool_set_eeprom */ |
4820 | return -EINVAL; | ||
4821 | |||
4822 | if ((eeprom->offset + eeprom->len) > bp->flash_info->total_size) | ||
4823 | eeprom->len = bp->flash_info->total_size - eeprom->offset; | ||
4824 | 4818 | ||
4825 | rc = bnx2_nvram_write(bp, eeprom->offset, eebuf, eeprom->len); | 4819 | rc = bnx2_nvram_write(bp, eeprom->offset, eebuf, eeprom->len); |
4826 | 4820 | ||
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 0d33a93df96b..03804cc38be0 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
@@ -398,13 +398,19 @@ static struct mca_driver depca_mca_driver = { | |||
398 | }; | 398 | }; |
399 | #endif | 399 | #endif |
400 | 400 | ||
401 | static int depca_isa_probe (struct device *); | 401 | static int depca_isa_probe (struct platform_device *); |
402 | 402 | ||
403 | static struct device_driver depca_isa_driver = { | 403 | static int __devexit depca_isa_remove(struct platform_device *pdev) |
404 | .name = depca_string, | 404 | { |
405 | .bus = &platform_bus_type, | 405 | return depca_device_remove(&pdev->dev); |
406 | } | ||
407 | |||
408 | static struct platform_driver depca_isa_driver = { | ||
406 | .probe = depca_isa_probe, | 409 | .probe = depca_isa_probe, |
407 | .remove = __devexit_p(depca_device_remove), | 410 | .remove = __devexit_p(depca_isa_remove), |
411 | .driver = { | ||
412 | .name = depca_string, | ||
413 | }, | ||
408 | }; | 414 | }; |
409 | 415 | ||
410 | /* | 416 | /* |
@@ -1525,7 +1531,7 @@ static enum depca_type __init depca_shmem_probe (ulong *mem_start) | |||
1525 | return adapter; | 1531 | return adapter; |
1526 | } | 1532 | } |
1527 | 1533 | ||
1528 | static int __init depca_isa_probe (struct device *device) | 1534 | static int __init depca_isa_probe (struct platform_device *device) |
1529 | { | 1535 | { |
1530 | struct net_device *dev; | 1536 | struct net_device *dev; |
1531 | struct depca_private *lp; | 1537 | struct depca_private *lp; |
@@ -1533,7 +1539,7 @@ static int __init depca_isa_probe (struct device *device) | |||
1533 | enum depca_type adapter = unknown; | 1539 | enum depca_type adapter = unknown; |
1534 | int status = 0; | 1540 | int status = 0; |
1535 | 1541 | ||
1536 | ioaddr = (u_long) device->platform_data; | 1542 | ioaddr = (u_long) device->dev.platform_data; |
1537 | 1543 | ||
1538 | if ((status = depca_common_init (ioaddr, &dev))) | 1544 | if ((status = depca_common_init (ioaddr, &dev))) |
1539 | goto out; | 1545 | goto out; |
@@ -1553,7 +1559,7 @@ static int __init depca_isa_probe (struct device *device) | |||
1553 | lp->adapter = adapter; | 1559 | lp->adapter = adapter; |
1554 | lp->mem_start = mem_start; | 1560 | lp->mem_start = mem_start; |
1555 | 1561 | ||
1556 | if ((status = depca_hw_init(dev, device))) | 1562 | if ((status = depca_hw_init(dev, &device->dev))) |
1557 | goto out_free; | 1563 | goto out_free; |
1558 | 1564 | ||
1559 | return 0; | 1565 | return 0; |
@@ -2082,7 +2088,7 @@ static int __init depca_module_init (void) | |||
2082 | #ifdef CONFIG_EISA | 2088 | #ifdef CONFIG_EISA |
2083 | err |= eisa_driver_register (&depca_eisa_driver); | 2089 | err |= eisa_driver_register (&depca_eisa_driver); |
2084 | #endif | 2090 | #endif |
2085 | err |= driver_register (&depca_isa_driver); | 2091 | err |= platform_driver_register (&depca_isa_driver); |
2086 | depca_platform_probe (); | 2092 | depca_platform_probe (); |
2087 | 2093 | ||
2088 | return err; | 2094 | return err; |
@@ -2097,7 +2103,7 @@ static void __exit depca_module_exit (void) | |||
2097 | #ifdef CONFIG_EISA | 2103 | #ifdef CONFIG_EISA |
2098 | eisa_driver_unregister (&depca_eisa_driver); | 2104 | eisa_driver_unregister (&depca_eisa_driver); |
2099 | #endif | 2105 | #endif |
2100 | driver_unregister (&depca_isa_driver); | 2106 | platform_driver_unregister (&depca_isa_driver); |
2101 | 2107 | ||
2102 | for (i = 0; depca_io_ports[i].iobase; i++) { | 2108 | for (i = 0; depca_io_ports[i].iobase; i++) { |
2103 | if (depca_io_ports[i].device) { | 2109 | if (depca_io_ports[i].device) { |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index f8c9bcdab68b..24996da4c1c4 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -148,7 +148,7 @@ typedef struct board_info { | |||
148 | } board_info_t; | 148 | } board_info_t; |
149 | 149 | ||
150 | /* function declaration ------------------------------------- */ | 150 | /* function declaration ------------------------------------- */ |
151 | static int dm9000_probe(struct device *); | 151 | static int dm9000_probe(struct platform_device *); |
152 | static int dm9000_open(struct net_device *); | 152 | static int dm9000_open(struct net_device *); |
153 | static int dm9000_start_xmit(struct sk_buff *, struct net_device *); | 153 | static int dm9000_start_xmit(struct sk_buff *, struct net_device *); |
154 | static int dm9000_stop(struct net_device *); | 154 | static int dm9000_stop(struct net_device *); |
@@ -378,9 +378,8 @@ dm9000_release_board(struct platform_device *pdev, struct board_info *db) | |||
378 | * Search DM9000 board, allocate space and register it | 378 | * Search DM9000 board, allocate space and register it |
379 | */ | 379 | */ |
380 | static int | 380 | static int |
381 | dm9000_probe(struct device *dev) | 381 | dm9000_probe(struct platform_device *pdev) |
382 | { | 382 | { |
383 | struct platform_device *pdev = to_platform_device(dev); | ||
384 | struct dm9000_plat_data *pdata = pdev->dev.platform_data; | 383 | struct dm9000_plat_data *pdata = pdev->dev.platform_data; |
385 | struct board_info *db; /* Point a board information structure */ | 384 | struct board_info *db; /* Point a board information structure */ |
386 | struct net_device *ndev; | 385 | struct net_device *ndev; |
@@ -398,7 +397,7 @@ dm9000_probe(struct device *dev) | |||
398 | } | 397 | } |
399 | 398 | ||
400 | SET_MODULE_OWNER(ndev); | 399 | SET_MODULE_OWNER(ndev); |
401 | SET_NETDEV_DEV(ndev, dev); | 400 | SET_NETDEV_DEV(ndev, &pdev->dev); |
402 | 401 | ||
403 | PRINTK2("dm9000_probe()"); | 402 | PRINTK2("dm9000_probe()"); |
404 | 403 | ||
@@ -569,7 +568,7 @@ dm9000_probe(struct device *dev) | |||
569 | printk("%s: Invalid ethernet MAC address. Please " | 568 | printk("%s: Invalid ethernet MAC address. Please " |
570 | "set using ifconfig\n", ndev->name); | 569 | "set using ifconfig\n", ndev->name); |
571 | 570 | ||
572 | dev_set_drvdata(dev, ndev); | 571 | platform_set_drvdata(pdev, ndev); |
573 | ret = register_netdev(ndev); | 572 | ret = register_netdev(ndev); |
574 | 573 | ||
575 | if (ret == 0) { | 574 | if (ret == 0) { |
@@ -1140,9 +1139,9 @@ dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value) | |||
1140 | } | 1139 | } |
1141 | 1140 | ||
1142 | static int | 1141 | static int |
1143 | dm9000_drv_suspend(struct device *dev, pm_message_t state) | 1142 | dm9000_drv_suspend(struct platform_device *dev, pm_message_t state) |
1144 | { | 1143 | { |
1145 | struct net_device *ndev = dev_get_drvdata(dev); | 1144 | struct net_device *ndev = platform_get_drvdata(dev); |
1146 | 1145 | ||
1147 | if (ndev) { | 1146 | if (ndev) { |
1148 | if (netif_running(ndev)) { | 1147 | if (netif_running(ndev)) { |
@@ -1154,9 +1153,9 @@ dm9000_drv_suspend(struct device *dev, pm_message_t state) | |||
1154 | } | 1153 | } |
1155 | 1154 | ||
1156 | static int | 1155 | static int |
1157 | dm9000_drv_resume(struct device *dev) | 1156 | dm9000_drv_resume(struct platform_device *dev) |
1158 | { | 1157 | { |
1159 | struct net_device *ndev = dev_get_drvdata(dev); | 1158 | struct net_device *ndev = platform_get_drvdata(dev); |
1160 | board_info_t *db = (board_info_t *) ndev->priv; | 1159 | board_info_t *db = (board_info_t *) ndev->priv; |
1161 | 1160 | ||
1162 | if (ndev) { | 1161 | if (ndev) { |
@@ -1172,12 +1171,11 @@ dm9000_drv_resume(struct device *dev) | |||
1172 | } | 1171 | } |
1173 | 1172 | ||
1174 | static int | 1173 | static int |
1175 | dm9000_drv_remove(struct device *dev) | 1174 | dm9000_drv_remove(struct platform_device *pdev) |
1176 | { | 1175 | { |
1177 | struct platform_device *pdev = to_platform_device(dev); | 1176 | struct net_device *ndev = platform_get_drvdata(pdev); |
1178 | struct net_device *ndev = dev_get_drvdata(dev); | ||
1179 | 1177 | ||
1180 | dev_set_drvdata(dev, NULL); | 1178 | platform_set_drvdata(pdev, NULL); |
1181 | 1179 | ||
1182 | unregister_netdev(ndev); | 1180 | unregister_netdev(ndev); |
1183 | dm9000_release_board(pdev, (board_info_t *) ndev->priv); | 1181 | dm9000_release_board(pdev, (board_info_t *) ndev->priv); |
@@ -1188,13 +1186,14 @@ dm9000_drv_remove(struct device *dev) | |||
1188 | return 0; | 1186 | return 0; |
1189 | } | 1187 | } |
1190 | 1188 | ||
1191 | static struct device_driver dm9000_driver = { | 1189 | static struct platform_driver dm9000_driver = { |
1192 | .name = "dm9000", | ||
1193 | .bus = &platform_bus_type, | ||
1194 | .probe = dm9000_probe, | 1190 | .probe = dm9000_probe, |
1195 | .remove = dm9000_drv_remove, | 1191 | .remove = dm9000_drv_remove, |
1196 | .suspend = dm9000_drv_suspend, | 1192 | .suspend = dm9000_drv_suspend, |
1197 | .resume = dm9000_drv_resume, | 1193 | .resume = dm9000_drv_resume, |
1194 | .driver = { | ||
1195 | .name = "dm9000", | ||
1196 | }, | ||
1198 | }; | 1197 | }; |
1199 | 1198 | ||
1200 | static int __init | 1199 | static int __init |
@@ -1202,13 +1201,13 @@ dm9000_init(void) | |||
1202 | { | 1201 | { |
1203 | printk(KERN_INFO "%s Ethernet Driver\n", CARDNAME); | 1202 | printk(KERN_INFO "%s Ethernet Driver\n", CARDNAME); |
1204 | 1203 | ||
1205 | return driver_register(&dm9000_driver); /* search board and register */ | 1204 | return platform_driver_register(&dm9000_driver); /* search board and register */ |
1206 | } | 1205 | } |
1207 | 1206 | ||
1208 | static void __exit | 1207 | static void __exit |
1209 | dm9000_cleanup(void) | 1208 | dm9000_cleanup(void) |
1210 | { | 1209 | { |
1211 | driver_unregister(&dm9000_driver); | 1210 | platform_driver_unregister(&dm9000_driver); |
1212 | } | 1211 | } |
1213 | 1212 | ||
1214 | module_init(dm9000_init); | 1213 | module_init(dm9000_init); |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 22aec6ed80f5..525624fc03b4 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -80,7 +80,7 @@ | |||
80 | * into nv_close, otherwise reenabling for wol can | 80 | * into nv_close, otherwise reenabling for wol can |
81 | * cause DMA to kfree'd memory. | 81 | * cause DMA to kfree'd memory. |
82 | * 0.31: 14 Nov 2004: ethtool support for getting/setting link | 82 | * 0.31: 14 Nov 2004: ethtool support for getting/setting link |
83 | * capabilities. | 83 | * capabilities. |
84 | * 0.32: 16 Apr 2005: RX_ERROR4 handling added. | 84 | * 0.32: 16 Apr 2005: RX_ERROR4 handling added. |
85 | * 0.33: 16 May 2005: Support for MCP51 added. | 85 | * 0.33: 16 May 2005: Support for MCP51 added. |
86 | * 0.34: 18 Jun 2005: Add DEV_NEED_LINKTIMER to all nForce nics. | 86 | * 0.34: 18 Jun 2005: Add DEV_NEED_LINKTIMER to all nForce nics. |
@@ -89,14 +89,17 @@ | |||
89 | * 0.37: 10 Jul 2005: Additional ethtool support, cleanup of pci id list | 89 | * 0.37: 10 Jul 2005: Additional ethtool support, cleanup of pci id list |
90 | * 0.38: 16 Jul 2005: tx irq rewrite: Use global flags instead of | 90 | * 0.38: 16 Jul 2005: tx irq rewrite: Use global flags instead of |
91 | * per-packet flags. | 91 | * per-packet flags. |
92 | * 0.39: 18 Jul 2005: Add 64bit descriptor support. | 92 | * 0.39: 18 Jul 2005: Add 64bit descriptor support. |
93 | * 0.40: 19 Jul 2005: Add support for mac address change. | 93 | * 0.40: 19 Jul 2005: Add support for mac address change. |
94 | * 0.41: 30 Jul 2005: Write back original MAC in nv_close instead | 94 | * 0.41: 30 Jul 2005: Write back original MAC in nv_close instead |
95 | * of nv_remove | 95 | * of nv_remove |
96 | * 0.42: 06 Aug 2005: Fix lack of link speed initialization | 96 | * 0.42: 06 Aug 2005: Fix lack of link speed initialization |
97 | * in the second (and later) nv_open call | 97 | * in the second (and later) nv_open call |
98 | * 0.43: 10 Aug 2005: Add support for tx checksum. | 98 | * 0.43: 10 Aug 2005: Add support for tx checksum. |
99 | * 0.44: 20 Aug 2005: Add support for scatter gather and segmentation. | 99 | * 0.44: 20 Aug 2005: Add support for scatter gather and segmentation. |
100 | * 0.45: 18 Sep 2005: Remove nv_stop/start_rx from every link check | ||
101 | * 0.46: 20 Oct 2005: Add irq optimization modes. | ||
102 | * 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. | ||
100 | * | 103 | * |
101 | * Known bugs: | 104 | * Known bugs: |
102 | * We suspect that on some hardware no TX done interrupts are generated. | 105 | * We suspect that on some hardware no TX done interrupts are generated. |
@@ -108,7 +111,7 @@ | |||
108 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few | 111 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few |
109 | * superfluous timer interrupts from the nic. | 112 | * superfluous timer interrupts from the nic. |
110 | */ | 113 | */ |
111 | #define FORCEDETH_VERSION "0.44" | 114 | #define FORCEDETH_VERSION "0.47" |
112 | #define DRV_NAME "forcedeth" | 115 | #define DRV_NAME "forcedeth" |
113 | 116 | ||
114 | #include <linux/module.h> | 117 | #include <linux/module.h> |
@@ -163,7 +166,8 @@ enum { | |||
163 | #define NVREG_IRQ_LINK 0x0040 | 166 | #define NVREG_IRQ_LINK 0x0040 |
164 | #define NVREG_IRQ_TX_ERROR 0x0080 | 167 | #define NVREG_IRQ_TX_ERROR 0x0080 |
165 | #define NVREG_IRQ_TX1 0x0100 | 168 | #define NVREG_IRQ_TX1 0x0100 |
166 | #define NVREG_IRQMASK_WANTED 0x00df | 169 | #define NVREG_IRQMASK_THROUGHPUT 0x00df |
170 | #define NVREG_IRQMASK_CPU 0x0040 | ||
167 | 171 | ||
168 | #define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR| \ | 172 | #define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR| \ |
169 | NVREG_IRQ_TX_OK|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_TX_ERROR| \ | 173 | NVREG_IRQ_TX_OK|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_TX_ERROR| \ |
@@ -177,7 +181,8 @@ enum { | |||
177 | * NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms | 181 | * NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms |
178 | */ | 182 | */ |
179 | NvRegPollingInterval = 0x00c, | 183 | NvRegPollingInterval = 0x00c, |
180 | #define NVREG_POLL_DEFAULT 970 | 184 | #define NVREG_POLL_DEFAULT_THROUGHPUT 970 |
185 | #define NVREG_POLL_DEFAULT_CPU 13 | ||
181 | NvRegMisc1 = 0x080, | 186 | NvRegMisc1 = 0x080, |
182 | #define NVREG_MISC1_HD 0x02 | 187 | #define NVREG_MISC1_HD 0x02 |
183 | #define NVREG_MISC1_FORCE 0x3b0f3c | 188 | #define NVREG_MISC1_FORCE 0x3b0f3c |
@@ -538,6 +543,25 @@ struct fe_priv { | |||
538 | */ | 543 | */ |
539 | static int max_interrupt_work = 5; | 544 | static int max_interrupt_work = 5; |
540 | 545 | ||
546 | /* | ||
547 | * Optimization can be either throuput mode or cpu mode | ||
548 | * | ||
549 | * Throughput Mode: Every tx and rx packet will generate an interrupt. | ||
550 | * CPU Mode: Interrupts are controlled by a timer. | ||
551 | */ | ||
552 | #define NV_OPTIMIZATION_MODE_THROUGHPUT 0 | ||
553 | #define NV_OPTIMIZATION_MODE_CPU 1 | ||
554 | static int optimization_mode = NV_OPTIMIZATION_MODE_THROUGHPUT; | ||
555 | |||
556 | /* | ||
557 | * Poll interval for timer irq | ||
558 | * | ||
559 | * This interval determines how frequent an interrupt is generated. | ||
560 | * The is value is determined by [(time_in_micro_secs * 100) / (2^10)] | ||
561 | * Min = 0, and Max = 65535 | ||
562 | */ | ||
563 | static int poll_interval = -1; | ||
564 | |||
541 | static inline struct fe_priv *get_nvpriv(struct net_device *dev) | 565 | static inline struct fe_priv *get_nvpriv(struct net_device *dev) |
542 | { | 566 | { |
543 | return netdev_priv(dev); | 567 | return netdev_priv(dev); |
@@ -1328,67 +1352,71 @@ static void nv_rx_process(struct net_device *dev) | |||
1328 | if (!(Flags & NV_RX_DESCRIPTORVALID)) | 1352 | if (!(Flags & NV_RX_DESCRIPTORVALID)) |
1329 | goto next_pkt; | 1353 | goto next_pkt; |
1330 | 1354 | ||
1331 | if (Flags & NV_RX_MISSEDFRAME) { | 1355 | if (Flags & NV_RX_ERROR) { |
1332 | np->stats.rx_missed_errors++; | 1356 | if (Flags & NV_RX_MISSEDFRAME) { |
1333 | np->stats.rx_errors++; | 1357 | np->stats.rx_missed_errors++; |
1334 | goto next_pkt; | ||
1335 | } | ||
1336 | if (Flags & (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) { | ||
1337 | np->stats.rx_errors++; | ||
1338 | goto next_pkt; | ||
1339 | } | ||
1340 | if (Flags & NV_RX_CRCERR) { | ||
1341 | np->stats.rx_crc_errors++; | ||
1342 | np->stats.rx_errors++; | ||
1343 | goto next_pkt; | ||
1344 | } | ||
1345 | if (Flags & NV_RX_OVERFLOW) { | ||
1346 | np->stats.rx_over_errors++; | ||
1347 | np->stats.rx_errors++; | ||
1348 | goto next_pkt; | ||
1349 | } | ||
1350 | if (Flags & NV_RX_ERROR4) { | ||
1351 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | ||
1352 | if (len < 0) { | ||
1353 | np->stats.rx_errors++; | 1358 | np->stats.rx_errors++; |
1354 | goto next_pkt; | 1359 | goto next_pkt; |
1355 | } | 1360 | } |
1356 | } | 1361 | if (Flags & (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) { |
1357 | /* framing errors are soft errors. */ | 1362 | np->stats.rx_errors++; |
1358 | if (Flags & NV_RX_FRAMINGERR) { | 1363 | goto next_pkt; |
1359 | if (Flags & NV_RX_SUBSTRACT1) { | 1364 | } |
1360 | len--; | 1365 | if (Flags & NV_RX_CRCERR) { |
1366 | np->stats.rx_crc_errors++; | ||
1367 | np->stats.rx_errors++; | ||
1368 | goto next_pkt; | ||
1369 | } | ||
1370 | if (Flags & NV_RX_OVERFLOW) { | ||
1371 | np->stats.rx_over_errors++; | ||
1372 | np->stats.rx_errors++; | ||
1373 | goto next_pkt; | ||
1374 | } | ||
1375 | if (Flags & NV_RX_ERROR4) { | ||
1376 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | ||
1377 | if (len < 0) { | ||
1378 | np->stats.rx_errors++; | ||
1379 | goto next_pkt; | ||
1380 | } | ||
1381 | } | ||
1382 | /* framing errors are soft errors. */ | ||
1383 | if (Flags & NV_RX_FRAMINGERR) { | ||
1384 | if (Flags & NV_RX_SUBSTRACT1) { | ||
1385 | len--; | ||
1386 | } | ||
1361 | } | 1387 | } |
1362 | } | 1388 | } |
1363 | } else { | 1389 | } else { |
1364 | if (!(Flags & NV_RX2_DESCRIPTORVALID)) | 1390 | if (!(Flags & NV_RX2_DESCRIPTORVALID)) |
1365 | goto next_pkt; | 1391 | goto next_pkt; |
1366 | 1392 | ||
1367 | if (Flags & (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3)) { | 1393 | if (Flags & NV_RX2_ERROR) { |
1368 | np->stats.rx_errors++; | 1394 | if (Flags & (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3)) { |
1369 | goto next_pkt; | ||
1370 | } | ||
1371 | if (Flags & NV_RX2_CRCERR) { | ||
1372 | np->stats.rx_crc_errors++; | ||
1373 | np->stats.rx_errors++; | ||
1374 | goto next_pkt; | ||
1375 | } | ||
1376 | if (Flags & NV_RX2_OVERFLOW) { | ||
1377 | np->stats.rx_over_errors++; | ||
1378 | np->stats.rx_errors++; | ||
1379 | goto next_pkt; | ||
1380 | } | ||
1381 | if (Flags & NV_RX2_ERROR4) { | ||
1382 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | ||
1383 | if (len < 0) { | ||
1384 | np->stats.rx_errors++; | 1395 | np->stats.rx_errors++; |
1385 | goto next_pkt; | 1396 | goto next_pkt; |
1386 | } | 1397 | } |
1387 | } | 1398 | if (Flags & NV_RX2_CRCERR) { |
1388 | /* framing errors are soft errors */ | 1399 | np->stats.rx_crc_errors++; |
1389 | if (Flags & NV_RX2_FRAMINGERR) { | 1400 | np->stats.rx_errors++; |
1390 | if (Flags & NV_RX2_SUBSTRACT1) { | 1401 | goto next_pkt; |
1391 | len--; | 1402 | } |
1403 | if (Flags & NV_RX2_OVERFLOW) { | ||
1404 | np->stats.rx_over_errors++; | ||
1405 | np->stats.rx_errors++; | ||
1406 | goto next_pkt; | ||
1407 | } | ||
1408 | if (Flags & NV_RX2_ERROR4) { | ||
1409 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | ||
1410 | if (len < 0) { | ||
1411 | np->stats.rx_errors++; | ||
1412 | goto next_pkt; | ||
1413 | } | ||
1414 | } | ||
1415 | /* framing errors are soft errors */ | ||
1416 | if (Flags & NV_RX2_FRAMINGERR) { | ||
1417 | if (Flags & NV_RX2_SUBSTRACT1) { | ||
1418 | len--; | ||
1419 | } | ||
1392 | } | 1420 | } |
1393 | } | 1421 | } |
1394 | Flags &= NV_RX2_CHECKSUMMASK; | 1422 | Flags &= NV_RX2_CHECKSUMMASK; |
@@ -1612,6 +1640,17 @@ static void nv_set_multicast(struct net_device *dev) | |||
1612 | spin_unlock_irq(&np->lock); | 1640 | spin_unlock_irq(&np->lock); |
1613 | } | 1641 | } |
1614 | 1642 | ||
1643 | /** | ||
1644 | * nv_update_linkspeed: Setup the MAC according to the link partner | ||
1645 | * @dev: Network device to be configured | ||
1646 | * | ||
1647 | * The function queries the PHY and checks if there is a link partner. | ||
1648 | * If yes, then it sets up the MAC accordingly. Otherwise, the MAC is | ||
1649 | * set to 10 MBit HD. | ||
1650 | * | ||
1651 | * The function returns 0 if there is no link partner and 1 if there is | ||
1652 | * a good link partner. | ||
1653 | */ | ||
1615 | static int nv_update_linkspeed(struct net_device *dev) | 1654 | static int nv_update_linkspeed(struct net_device *dev) |
1616 | { | 1655 | { |
1617 | struct fe_priv *np = netdev_priv(dev); | 1656 | struct fe_priv *np = netdev_priv(dev); |
@@ -1751,13 +1790,11 @@ set_speed: | |||
1751 | static void nv_linkchange(struct net_device *dev) | 1790 | static void nv_linkchange(struct net_device *dev) |
1752 | { | 1791 | { |
1753 | if (nv_update_linkspeed(dev)) { | 1792 | if (nv_update_linkspeed(dev)) { |
1754 | if (netif_carrier_ok(dev)) { | 1793 | if (!netif_carrier_ok(dev)) { |
1755 | nv_stop_rx(dev); | ||
1756 | } else { | ||
1757 | netif_carrier_on(dev); | 1794 | netif_carrier_on(dev); |
1758 | printk(KERN_INFO "%s: link up.\n", dev->name); | 1795 | printk(KERN_INFO "%s: link up.\n", dev->name); |
1796 | nv_start_rx(dev); | ||
1759 | } | 1797 | } |
1760 | nv_start_rx(dev); | ||
1761 | } else { | 1798 | } else { |
1762 | if (netif_carrier_ok(dev)) { | 1799 | if (netif_carrier_ok(dev)) { |
1763 | netif_carrier_off(dev); | 1800 | netif_carrier_off(dev); |
@@ -1799,22 +1836,18 @@ static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs) | |||
1799 | if (!(events & np->irqmask)) | 1836 | if (!(events & np->irqmask)) |
1800 | break; | 1837 | break; |
1801 | 1838 | ||
1802 | if (events & (NVREG_IRQ_TX1|NVREG_IRQ_TX_OK|NVREG_IRQ_TX_ERROR|NVREG_IRQ_TX_ERR)) { | 1839 | spin_lock(&np->lock); |
1840 | nv_tx_done(dev); | ||
1841 | spin_unlock(&np->lock); | ||
1842 | |||
1843 | nv_rx_process(dev); | ||
1844 | if (nv_alloc_rx(dev)) { | ||
1803 | spin_lock(&np->lock); | 1845 | spin_lock(&np->lock); |
1804 | nv_tx_done(dev); | 1846 | if (!np->in_shutdown) |
1847 | mod_timer(&np->oom_kick, jiffies + OOM_REFILL); | ||
1805 | spin_unlock(&np->lock); | 1848 | spin_unlock(&np->lock); |
1806 | } | 1849 | } |
1807 | 1850 | ||
1808 | if (events & (NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF)) { | ||
1809 | nv_rx_process(dev); | ||
1810 | if (nv_alloc_rx(dev)) { | ||
1811 | spin_lock(&np->lock); | ||
1812 | if (!np->in_shutdown) | ||
1813 | mod_timer(&np->oom_kick, jiffies + OOM_REFILL); | ||
1814 | spin_unlock(&np->lock); | ||
1815 | } | ||
1816 | } | ||
1817 | |||
1818 | if (events & NVREG_IRQ_LINK) { | 1851 | if (events & NVREG_IRQ_LINK) { |
1819 | spin_lock(&np->lock); | 1852 | spin_lock(&np->lock); |
1820 | nv_link_irq(dev); | 1853 | nv_link_irq(dev); |
@@ -2216,7 +2249,14 @@ static int nv_open(struct net_device *dev) | |||
2216 | writel(NVREG_RNDSEED_FORCE | (i&NVREG_RNDSEED_MASK), base + NvRegRandomSeed); | 2249 | writel(NVREG_RNDSEED_FORCE | (i&NVREG_RNDSEED_MASK), base + NvRegRandomSeed); |
2217 | writel(NVREG_UNKSETUP1_VAL, base + NvRegUnknownSetupReg1); | 2250 | writel(NVREG_UNKSETUP1_VAL, base + NvRegUnknownSetupReg1); |
2218 | writel(NVREG_UNKSETUP2_VAL, base + NvRegUnknownSetupReg2); | 2251 | writel(NVREG_UNKSETUP2_VAL, base + NvRegUnknownSetupReg2); |
2219 | writel(NVREG_POLL_DEFAULT, base + NvRegPollingInterval); | 2252 | if (poll_interval == -1) { |
2253 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) | ||
2254 | writel(NVREG_POLL_DEFAULT_THROUGHPUT, base + NvRegPollingInterval); | ||
2255 | else | ||
2256 | writel(NVREG_POLL_DEFAULT_CPU, base + NvRegPollingInterval); | ||
2257 | } | ||
2258 | else | ||
2259 | writel(poll_interval & 0xFFFF, base + NvRegPollingInterval); | ||
2220 | writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); | 2260 | writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); |
2221 | writel((np->phyaddr << NVREG_ADAPTCTL_PHYSHIFT)|NVREG_ADAPTCTL_PHYVALID|NVREG_ADAPTCTL_RUNNING, | 2261 | writel((np->phyaddr << NVREG_ADAPTCTL_PHYSHIFT)|NVREG_ADAPTCTL_PHYVALID|NVREG_ADAPTCTL_RUNNING, |
2222 | base + NvRegAdapterControl); | 2262 | base + NvRegAdapterControl); |
@@ -2501,7 +2541,11 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2501 | } else { | 2541 | } else { |
2502 | np->tx_flags = NV_TX2_VALID; | 2542 | np->tx_flags = NV_TX2_VALID; |
2503 | } | 2543 | } |
2504 | np->irqmask = NVREG_IRQMASK_WANTED; | 2544 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) |
2545 | np->irqmask = NVREG_IRQMASK_THROUGHPUT; | ||
2546 | else | ||
2547 | np->irqmask = NVREG_IRQMASK_CPU; | ||
2548 | |||
2505 | if (id->driver_data & DEV_NEED_TIMERIRQ) | 2549 | if (id->driver_data & DEV_NEED_TIMERIRQ) |
2506 | np->irqmask |= NVREG_IRQ_TIMER; | 2550 | np->irqmask |= NVREG_IRQ_TIMER; |
2507 | if (id->driver_data & DEV_NEED_LINKTIMER) { | 2551 | if (id->driver_data & DEV_NEED_LINKTIMER) { |
@@ -2514,16 +2558,17 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2514 | } | 2558 | } |
2515 | 2559 | ||
2516 | /* find a suitable phy */ | 2560 | /* find a suitable phy */ |
2517 | for (i = 1; i < 32; i++) { | 2561 | for (i = 1; i <= 32; i++) { |
2518 | int id1, id2; | 2562 | int id1, id2; |
2563 | int phyaddr = i & 0x1F; | ||
2519 | 2564 | ||
2520 | spin_lock_irq(&np->lock); | 2565 | spin_lock_irq(&np->lock); |
2521 | id1 = mii_rw(dev, i, MII_PHYSID1, MII_READ); | 2566 | id1 = mii_rw(dev, phyaddr, MII_PHYSID1, MII_READ); |
2522 | spin_unlock_irq(&np->lock); | 2567 | spin_unlock_irq(&np->lock); |
2523 | if (id1 < 0 || id1 == 0xffff) | 2568 | if (id1 < 0 || id1 == 0xffff) |
2524 | continue; | 2569 | continue; |
2525 | spin_lock_irq(&np->lock); | 2570 | spin_lock_irq(&np->lock); |
2526 | id2 = mii_rw(dev, i, MII_PHYSID2, MII_READ); | 2571 | id2 = mii_rw(dev, phyaddr, MII_PHYSID2, MII_READ); |
2527 | spin_unlock_irq(&np->lock); | 2572 | spin_unlock_irq(&np->lock); |
2528 | if (id2 < 0 || id2 == 0xffff) | 2573 | if (id2 < 0 || id2 == 0xffff) |
2529 | continue; | 2574 | continue; |
@@ -2531,23 +2576,19 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2531 | id1 = (id1 & PHYID1_OUI_MASK) << PHYID1_OUI_SHFT; | 2576 | id1 = (id1 & PHYID1_OUI_MASK) << PHYID1_OUI_SHFT; |
2532 | id2 = (id2 & PHYID2_OUI_MASK) >> PHYID2_OUI_SHFT; | 2577 | id2 = (id2 & PHYID2_OUI_MASK) >> PHYID2_OUI_SHFT; |
2533 | dprintk(KERN_DEBUG "%s: open: Found PHY %04x:%04x at address %d.\n", | 2578 | dprintk(KERN_DEBUG "%s: open: Found PHY %04x:%04x at address %d.\n", |
2534 | pci_name(pci_dev), id1, id2, i); | 2579 | pci_name(pci_dev), id1, id2, phyaddr); |
2535 | np->phyaddr = i; | 2580 | np->phyaddr = phyaddr; |
2536 | np->phy_oui = id1 | id2; | 2581 | np->phy_oui = id1 | id2; |
2537 | break; | 2582 | break; |
2538 | } | 2583 | } |
2539 | if (i == 32) { | 2584 | if (i == 33) { |
2540 | /* PHY in isolate mode? No phy attached and user wants to | ||
2541 | * test loopback? Very odd, but can be correct. | ||
2542 | */ | ||
2543 | printk(KERN_INFO "%s: open: Could not find a valid PHY.\n", | 2585 | printk(KERN_INFO "%s: open: Could not find a valid PHY.\n", |
2544 | pci_name(pci_dev)); | 2586 | pci_name(pci_dev)); |
2545 | } | 2587 | goto out_freering; |
2546 | |||
2547 | if (i != 32) { | ||
2548 | /* reset it */ | ||
2549 | phy_init(dev); | ||
2550 | } | 2588 | } |
2589 | |||
2590 | /* reset it */ | ||
2591 | phy_init(dev); | ||
2551 | 2592 | ||
2552 | /* set default link speed settings */ | 2593 | /* set default link speed settings */ |
2553 | np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; | 2594 | np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
@@ -2689,6 +2730,10 @@ static void __exit exit_nic(void) | |||
2689 | 2730 | ||
2690 | module_param(max_interrupt_work, int, 0); | 2731 | module_param(max_interrupt_work, int, 0); |
2691 | MODULE_PARM_DESC(max_interrupt_work, "forcedeth maximum events handled per interrupt"); | 2732 | MODULE_PARM_DESC(max_interrupt_work, "forcedeth maximum events handled per interrupt"); |
2733 | module_param(optimization_mode, int, 0); | ||
2734 | MODULE_PARM_DESC(optimization_mode, "In throughput mode (0), every tx & rx packet will generate an interrupt. In CPU mode (1), interrupts are controlled by a timer."); | ||
2735 | module_param(poll_interval, int, 0); | ||
2736 | MODULE_PARM_DESC(poll_interval, "Interval determines how frequent timer interrupt is generated by [(time_in_micro_secs * 100) / (2^10)]. Min is 0 and Max is 65535."); | ||
2692 | 2737 | ||
2693 | MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); | 2738 | MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); |
2694 | MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); | 2739 | MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 9342d5bc7bb4..f5d49a110654 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/ethtool.h> | 37 | #include <linux/ethtool.h> |
38 | #include <linux/bitops.h> | 38 | #include <linux/bitops.h> |
39 | #include <linux/fs.h> | 39 | #include <linux/fs.h> |
40 | #include <linux/platform_device.h> | ||
40 | 41 | ||
41 | #include <linux/vmalloc.h> | 42 | #include <linux/vmalloc.h> |
42 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c index a940b96433c7..e67b1d06611c 100644 --- a/drivers/net/fs_enet/mac-fcc.c +++ b/drivers/net/fs_enet/mac-fcc.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/ethtool.h> | 34 | #include <linux/ethtool.h> |
35 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/platform_device.h> | ||
37 | 38 | ||
38 | #include <asm/immap_cpm2.h> | 39 | #include <asm/immap_cpm2.h> |
39 | #include <asm/mpc8260.h> | 40 | #include <asm/mpc8260.h> |
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c index 5ef4e845a387..2e8f44469699 100644 --- a/drivers/net/fs_enet/mac-fec.c +++ b/drivers/net/fs_enet/mac-fec.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/ethtool.h> | 34 | #include <linux/ethtool.h> |
35 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/platform_device.h> | ||
37 | 38 | ||
38 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index d8c6e9cadcf5..a3897fda71fa 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/ethtool.h> | 34 | #include <linux/ethtool.h> |
35 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/platform_device.h> | ||
37 | 38 | ||
38 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 54d294ad6df5..e3a329539f1c 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -126,8 +126,8 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs); | |||
126 | static void adjust_link(struct net_device *dev); | 126 | static void adjust_link(struct net_device *dev); |
127 | static void init_registers(struct net_device *dev); | 127 | static void init_registers(struct net_device *dev); |
128 | static int init_phy(struct net_device *dev); | 128 | static int init_phy(struct net_device *dev); |
129 | static int gfar_probe(struct device *device); | 129 | static int gfar_probe(struct platform_device *pdev); |
130 | static int gfar_remove(struct device *device); | 130 | static int gfar_remove(struct platform_device *pdev); |
131 | static void free_skb_resources(struct gfar_private *priv); | 131 | static void free_skb_resources(struct gfar_private *priv); |
132 | static void gfar_set_multi(struct net_device *dev); | 132 | static void gfar_set_multi(struct net_device *dev); |
133 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); | 133 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); |
@@ -156,12 +156,11 @@ int gfar_uses_fcb(struct gfar_private *priv) | |||
156 | 156 | ||
157 | /* Set up the ethernet device structure, private data, | 157 | /* Set up the ethernet device structure, private data, |
158 | * and anything else we need before we start */ | 158 | * and anything else we need before we start */ |
159 | static int gfar_probe(struct device *device) | 159 | static int gfar_probe(struct platform_device *pdev) |
160 | { | 160 | { |
161 | u32 tempval; | 161 | u32 tempval; |
162 | struct net_device *dev = NULL; | 162 | struct net_device *dev = NULL; |
163 | struct gfar_private *priv = NULL; | 163 | struct gfar_private *priv = NULL; |
164 | struct platform_device *pdev = to_platform_device(device); | ||
165 | struct gianfar_platform_data *einfo; | 164 | struct gianfar_platform_data *einfo; |
166 | struct resource *r; | 165 | struct resource *r; |
167 | int idx; | 166 | int idx; |
@@ -208,7 +207,7 @@ static int gfar_probe(struct device *device) | |||
208 | 207 | ||
209 | spin_lock_init(&priv->lock); | 208 | spin_lock_init(&priv->lock); |
210 | 209 | ||
211 | dev_set_drvdata(device, dev); | 210 | platform_set_drvdata(pdev, dev); |
212 | 211 | ||
213 | /* Stop the DMA engine now, in case it was running before */ | 212 | /* Stop the DMA engine now, in case it was running before */ |
214 | /* (The firmware could have used it, and left it running). */ | 213 | /* (The firmware could have used it, and left it running). */ |
@@ -245,7 +244,7 @@ static int gfar_probe(struct device *device) | |||
245 | dev->base_addr = (unsigned long) (priv->regs); | 244 | dev->base_addr = (unsigned long) (priv->regs); |
246 | 245 | ||
247 | SET_MODULE_OWNER(dev); | 246 | SET_MODULE_OWNER(dev); |
248 | SET_NETDEV_DEV(dev, device); | 247 | SET_NETDEV_DEV(dev, &pdev->dev); |
249 | 248 | ||
250 | /* Fill in the dev structure */ | 249 | /* Fill in the dev structure */ |
251 | dev->open = gfar_enet_open; | 250 | dev->open = gfar_enet_open; |
@@ -377,12 +376,12 @@ regs_fail: | |||
377 | return err; | 376 | return err; |
378 | } | 377 | } |
379 | 378 | ||
380 | static int gfar_remove(struct device *device) | 379 | static int gfar_remove(struct platform_device *pdev) |
381 | { | 380 | { |
382 | struct net_device *dev = dev_get_drvdata(device); | 381 | struct net_device *dev = platform_get_drvdata(pdev); |
383 | struct gfar_private *priv = netdev_priv(dev); | 382 | struct gfar_private *priv = netdev_priv(dev); |
384 | 383 | ||
385 | dev_set_drvdata(device, NULL); | 384 | platform_set_drvdata(pdev, NULL); |
386 | 385 | ||
387 | iounmap((void *) priv->regs); | 386 | iounmap((void *) priv->regs); |
388 | free_netdev(dev); | 387 | free_netdev(dev); |
@@ -1861,11 +1860,12 @@ static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs) | |||
1861 | } | 1860 | } |
1862 | 1861 | ||
1863 | /* Structure for a device driver */ | 1862 | /* Structure for a device driver */ |
1864 | static struct device_driver gfar_driver = { | 1863 | static struct platform_driver gfar_driver = { |
1865 | .name = "fsl-gianfar", | ||
1866 | .bus = &platform_bus_type, | ||
1867 | .probe = gfar_probe, | 1864 | .probe = gfar_probe, |
1868 | .remove = gfar_remove, | 1865 | .remove = gfar_remove, |
1866 | .driver = { | ||
1867 | .name = "fsl-gianfar", | ||
1868 | }, | ||
1869 | }; | 1869 | }; |
1870 | 1870 | ||
1871 | static int __init gfar_init(void) | 1871 | static int __init gfar_init(void) |
@@ -1875,7 +1875,7 @@ static int __init gfar_init(void) | |||
1875 | if (err) | 1875 | if (err) |
1876 | return err; | 1876 | return err; |
1877 | 1877 | ||
1878 | err = driver_register(&gfar_driver); | 1878 | err = platform_driver_register(&gfar_driver); |
1879 | 1879 | ||
1880 | if (err) | 1880 | if (err) |
1881 | gfar_mdio_exit(); | 1881 | gfar_mdio_exit(); |
@@ -1885,7 +1885,7 @@ static int __init gfar_init(void) | |||
1885 | 1885 | ||
1886 | static void __exit gfar_exit(void) | 1886 | static void __exit gfar_exit(void) |
1887 | { | 1887 | { |
1888 | driver_unregister(&gfar_driver); | 1888 | platform_driver_unregister(&gfar_driver); |
1889 | gfar_mdio_exit(); | 1889 | gfar_mdio_exit(); |
1890 | } | 1890 | } |
1891 | 1891 | ||
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c index 7263395d78bb..9544279e8bcd 100644 --- a/drivers/net/gianfar_mii.c +++ b/drivers/net/gianfar_mii.c | |||
@@ -133,7 +133,7 @@ int gfar_mdio_probe(struct device *dev) | |||
133 | if (NULL == dev) | 133 | if (NULL == dev) |
134 | return -EINVAL; | 134 | return -EINVAL; |
135 | 135 | ||
136 | new_bus = kmalloc(sizeof(struct mii_bus), GFP_KERNEL); | 136 | new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL); |
137 | 137 | ||
138 | if (NULL == new_bus) | 138 | if (NULL == new_bus) |
139 | return -ENOMEM; | 139 | return -ENOMEM; |
diff --git a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c index 666cfbbcf6d9..5958a6314723 100644 --- a/drivers/net/gt96100eth.c +++ b/drivers/net/gt96100eth.c | |||
@@ -72,8 +72,6 @@ static void dump_tx_desc(int dbg_lvl, struct net_device *dev, int i); | |||
72 | static void dump_rx_desc(int dbg_lvl, struct net_device *dev, int i); | 72 | static void dump_rx_desc(int dbg_lvl, struct net_device *dev, int i); |
73 | static void dump_skb(int dbg_lvl, struct net_device *dev, | 73 | static void dump_skb(int dbg_lvl, struct net_device *dev, |
74 | struct sk_buff *skb); | 74 | struct sk_buff *skb); |
75 | static void dump_hw_addr(int dbg_lvl, struct net_device *dev, | ||
76 | const char* pfx, unsigned char* addr_str); | ||
77 | static void update_stats(struct gt96100_private *gp); | 75 | static void update_stats(struct gt96100_private *gp); |
78 | static void abort(struct net_device *dev, u32 abort_bits); | 76 | static void abort(struct net_device *dev, u32 abort_bits); |
79 | static void hard_stop(struct net_device *dev); | 77 | static void hard_stop(struct net_device *dev); |
@@ -334,13 +332,13 @@ dump_MII(int dbg_lvl, struct net_device *dev) | |||
334 | 332 | ||
335 | static void | 333 | static void |
336 | dump_hw_addr(int dbg_lvl, struct net_device *dev, const char* pfx, | 334 | dump_hw_addr(int dbg_lvl, struct net_device *dev, const char* pfx, |
337 | unsigned char* addr_str) | 335 | const char* func, unsigned char* addr_str) |
338 | { | 336 | { |
339 | int i; | 337 | int i; |
340 | char buf[100], octet[5]; | 338 | char buf[100], octet[5]; |
341 | 339 | ||
342 | if (dbg_lvl <= GT96100_DEBUG) { | 340 | if (dbg_lvl <= GT96100_DEBUG) { |
343 | strcpy(buf, pfx); | 341 | sprintf(buf, pfx, func); |
344 | for (i = 0; i < 6; i++) { | 342 | for (i = 0; i < 6; i++) { |
345 | sprintf(octet, "%2.2x%s", | 343 | sprintf(octet, "%2.2x%s", |
346 | addr_str[i], i<5 ? ":" : "\n"); | 344 | addr_str[i], i<5 ? ":" : "\n"); |
@@ -708,7 +706,7 @@ static int __init gt96100_probe1(struct pci_dev *pci, int port_num) | |||
708 | 706 | ||
709 | info("%s found at 0x%x, irq %d\n", | 707 | info("%s found at 0x%x, irq %d\n", |
710 | chip_name(gp->chip_rev), gtif->iobase, gtif->irq); | 708 | chip_name(gp->chip_rev), gtif->iobase, gtif->irq); |
711 | dump_hw_addr(0, dev, "HW Address ", dev->dev_addr); | 709 | dump_hw_addr(0, dev, "%s: HW Address ", __FUNCTION__, dev->dev_addr); |
712 | info("%s chip revision=%d\n", chip_name(gp->chip_rev), gp->chip_rev); | 710 | info("%s chip revision=%d\n", chip_name(gp->chip_rev), gp->chip_rev); |
713 | info("%s ethernet port %d\n", chip_name(gp->chip_rev), gp->port_num); | 711 | info("%s ethernet port %d\n", chip_name(gp->chip_rev), gp->port_num); |
714 | info("external PHY ID1=0x%04x, ID2=0x%04x\n", phy_id1, phy_id2); | 712 | info("external PHY ID1=0x%04x, ID2=0x%04x\n", phy_id1, phy_id2); |
@@ -1488,7 +1486,7 @@ gt96100_set_rx_mode(struct net_device *dev) | |||
1488 | gt96100_add_hash_entry(dev, dev->dev_addr); | 1486 | gt96100_add_hash_entry(dev, dev->dev_addr); |
1489 | 1487 | ||
1490 | for (mcptr = dev->mc_list; mcptr; mcptr = mcptr->next) { | 1488 | for (mcptr = dev->mc_list; mcptr; mcptr = mcptr->next) { |
1491 | dump_hw_addr(2, dev, __FUNCTION__ ": addr=", | 1489 | dump_hw_addr(2, dev, "%s: addr=", __FUNCTION__, |
1492 | mcptr->dmi_addr); | 1490 | mcptr->dmi_addr); |
1493 | gt96100_add_hash_entry(dev, mcptr->dmi_addr); | 1491 | gt96100_add_hash_entry(dev, mcptr->dmi_addr); |
1494 | } | 1492 | } |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index be191d80ef9c..ceb98fd398af 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | #include "ibmveth.h" | 59 | #include "ibmveth.h" |
60 | 60 | ||
61 | #define DEBUG 1 | 61 | #undef DEBUG |
62 | 62 | ||
63 | #define ibmveth_printk(fmt, args...) \ | 63 | #define ibmveth_printk(fmt, args...) \ |
64 | printk(KERN_INFO "%s: " fmt, __FILE__, ## args) | 64 | printk(KERN_INFO "%s: " fmt, __FILE__, ## args) |
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c index 76e0b9fb5e96..63d38fbbd04e 100644 --- a/drivers/net/irda/sa1100_ir.c +++ b/drivers/net/irda/sa1100_ir.c | |||
@@ -291,9 +291,9 @@ static void sa1100_irda_shutdown(struct sa1100_irda *si) | |||
291 | /* | 291 | /* |
292 | * Suspend the IrDA interface. | 292 | * Suspend the IrDA interface. |
293 | */ | 293 | */ |
294 | static int sa1100_irda_suspend(struct device *_dev, pm_message_t state) | 294 | static int sa1100_irda_suspend(struct platform_device *pdev, pm_message_t state) |
295 | { | 295 | { |
296 | struct net_device *dev = dev_get_drvdata(_dev); | 296 | struct net_device *dev = platform_get_drvdata(pdev); |
297 | struct sa1100_irda *si; | 297 | struct sa1100_irda *si; |
298 | 298 | ||
299 | if (!dev) | 299 | if (!dev) |
@@ -316,9 +316,9 @@ static int sa1100_irda_suspend(struct device *_dev, pm_message_t state) | |||
316 | /* | 316 | /* |
317 | * Resume the IrDA interface. | 317 | * Resume the IrDA interface. |
318 | */ | 318 | */ |
319 | static int sa1100_irda_resume(struct device *_dev) | 319 | static int sa1100_irda_resume(struct platform_device *pdev) |
320 | { | 320 | { |
321 | struct net_device *dev = dev_get_drvdata(_dev); | 321 | struct net_device *dev = platform_get_drvdata(pdev); |
322 | struct sa1100_irda *si; | 322 | struct sa1100_irda *si; |
323 | 323 | ||
324 | if (!dev) | 324 | if (!dev) |
@@ -886,9 +886,8 @@ static int sa1100_irda_init_iobuf(iobuff_t *io, int size) | |||
886 | return io->head ? 0 : -ENOMEM; | 886 | return io->head ? 0 : -ENOMEM; |
887 | } | 887 | } |
888 | 888 | ||
889 | static int sa1100_irda_probe(struct device *_dev) | 889 | static int sa1100_irda_probe(struct platform_device *pdev) |
890 | { | 890 | { |
891 | struct platform_device *pdev = to_platform_device(_dev); | ||
892 | struct net_device *dev; | 891 | struct net_device *dev; |
893 | struct sa1100_irda *si; | 892 | struct sa1100_irda *si; |
894 | unsigned int baudrate_mask; | 893 | unsigned int baudrate_mask; |
@@ -967,7 +966,7 @@ static int sa1100_irda_probe(struct device *_dev) | |||
967 | 966 | ||
968 | err = register_netdev(dev); | 967 | err = register_netdev(dev); |
969 | if (err == 0) | 968 | if (err == 0) |
970 | dev_set_drvdata(&pdev->dev, dev); | 969 | platform_set_drvdata(pdev, dev); |
971 | 970 | ||
972 | if (err) { | 971 | if (err) { |
973 | err_mem_5: | 972 | err_mem_5: |
@@ -985,9 +984,9 @@ static int sa1100_irda_probe(struct device *_dev) | |||
985 | return err; | 984 | return err; |
986 | } | 985 | } |
987 | 986 | ||
988 | static int sa1100_irda_remove(struct device *_dev) | 987 | static int sa1100_irda_remove(struct platform_device *pdev) |
989 | { | 988 | { |
990 | struct net_device *dev = dev_get_drvdata(_dev); | 989 | struct net_device *dev = platform_get_drvdata(pdev); |
991 | 990 | ||
992 | if (dev) { | 991 | if (dev) { |
993 | struct sa1100_irda *si = dev->priv; | 992 | struct sa1100_irda *si = dev->priv; |
@@ -1004,13 +1003,14 @@ static int sa1100_irda_remove(struct device *_dev) | |||
1004 | return 0; | 1003 | return 0; |
1005 | } | 1004 | } |
1006 | 1005 | ||
1007 | static struct device_driver sa1100ir_driver = { | 1006 | static struct platform_driver sa1100ir_driver = { |
1008 | .name = "sa11x0-ir", | ||
1009 | .bus = &platform_bus_type, | ||
1010 | .probe = sa1100_irda_probe, | 1007 | .probe = sa1100_irda_probe, |
1011 | .remove = sa1100_irda_remove, | 1008 | .remove = sa1100_irda_remove, |
1012 | .suspend = sa1100_irda_suspend, | 1009 | .suspend = sa1100_irda_suspend, |
1013 | .resume = sa1100_irda_resume, | 1010 | .resume = sa1100_irda_resume, |
1011 | .driver = { | ||
1012 | .name = "sa11x0-ir", | ||
1013 | }, | ||
1014 | }; | 1014 | }; |
1015 | 1015 | ||
1016 | static int __init sa1100_irda_init(void) | 1016 | static int __init sa1100_irda_init(void) |
@@ -1023,12 +1023,12 @@ static int __init sa1100_irda_init(void) | |||
1023 | if (power_level > 3) | 1023 | if (power_level > 3) |
1024 | power_level = 3; | 1024 | power_level = 3; |
1025 | 1025 | ||
1026 | return driver_register(&sa1100ir_driver); | 1026 | return platform_driver_register(&sa1100ir_driver); |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | static void __exit sa1100_irda_exit(void) | 1029 | static void __exit sa1100_irda_exit(void) |
1030 | { | 1030 | { |
1031 | driver_unregister(&sa1100ir_driver); | 1031 | platform_driver_unregister(&sa1100ir_driver); |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | module_init(sa1100_irda_init); | 1034 | module_init(sa1100_irda_init); |
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index a1d207f2fa68..ec94ecdb103d 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -214,14 +214,15 @@ static int smsc_ircc_probe_transceiver_smsc_ircc_atc(int fir_base); | |||
214 | 214 | ||
215 | /* Power Management */ | 215 | /* Power Management */ |
216 | 216 | ||
217 | static int smsc_ircc_suspend(struct device *dev, pm_message_t state); | 217 | static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state); |
218 | static int smsc_ircc_resume(struct device *dev); | 218 | static int smsc_ircc_resume(struct platform_device *dev); |
219 | 219 | ||
220 | static struct device_driver smsc_ircc_driver = { | 220 | static struct platform_driver smsc_ircc_driver = { |
221 | .name = SMSC_IRCC2_DRIVER_NAME, | ||
222 | .bus = &platform_bus_type, | ||
223 | .suspend = smsc_ircc_suspend, | 221 | .suspend = smsc_ircc_suspend, |
224 | .resume = smsc_ircc_resume, | 222 | .resume = smsc_ircc_resume, |
223 | .driver = { | ||
224 | .name = SMSC_IRCC2_DRIVER_NAME, | ||
225 | }, | ||
225 | }; | 226 | }; |
226 | 227 | ||
227 | /* Transceivers for SMSC-ircc */ | 228 | /* Transceivers for SMSC-ircc */ |
@@ -346,7 +347,7 @@ static int __init smsc_ircc_init(void) | |||
346 | 347 | ||
347 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); | 348 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); |
348 | 349 | ||
349 | ret = driver_register(&smsc_ircc_driver); | 350 | ret = platform_driver_register(&smsc_ircc_driver); |
350 | if (ret) { | 351 | if (ret) { |
351 | IRDA_ERROR("%s, Can't register driver!\n", driver_name); | 352 | IRDA_ERROR("%s, Can't register driver!\n", driver_name); |
352 | return ret; | 353 | return ret; |
@@ -378,7 +379,7 @@ static int __init smsc_ircc_init(void) | |||
378 | } | 379 | } |
379 | 380 | ||
380 | if (ret) | 381 | if (ret) |
381 | driver_unregister(&smsc_ircc_driver); | 382 | platform_driver_unregister(&smsc_ircc_driver); |
382 | 383 | ||
383 | return ret; | 384 | return ret; |
384 | } | 385 | } |
@@ -491,7 +492,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u | |||
491 | err = PTR_ERR(self->pldev); | 492 | err = PTR_ERR(self->pldev); |
492 | goto err_out5; | 493 | goto err_out5; |
493 | } | 494 | } |
494 | dev_set_drvdata(&self->pldev->dev, self); | 495 | platform_set_drvdata(self->pldev, self); |
495 | 496 | ||
496 | IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name); | 497 | IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name); |
497 | dev_count++; | 498 | dev_count++; |
@@ -1685,9 +1686,9 @@ static int smsc_ircc_net_close(struct net_device *dev) | |||
1685 | return 0; | 1686 | return 0; |
1686 | } | 1687 | } |
1687 | 1688 | ||
1688 | static int smsc_ircc_suspend(struct device *dev, pm_message_t state) | 1689 | static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state) |
1689 | { | 1690 | { |
1690 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); | 1691 | struct smsc_ircc_cb *self = platform_get_drvdata(dev); |
1691 | 1692 | ||
1692 | if (!self->io.suspended) { | 1693 | if (!self->io.suspended) { |
1693 | IRDA_DEBUG(1, "%s, Suspending\n", driver_name); | 1694 | IRDA_DEBUG(1, "%s, Suspending\n", driver_name); |
@@ -1706,9 +1707,9 @@ static int smsc_ircc_suspend(struct device *dev, pm_message_t state) | |||
1706 | return 0; | 1707 | return 0; |
1707 | } | 1708 | } |
1708 | 1709 | ||
1709 | static int smsc_ircc_resume(struct device *dev) | 1710 | static int smsc_ircc_resume(struct platform_device *dev) |
1710 | { | 1711 | { |
1711 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); | 1712 | struct smsc_ircc_cb *self = platform_get_drvdata(dev); |
1712 | 1713 | ||
1713 | if (self->io.suspended) { | 1714 | if (self->io.suspended) { |
1714 | IRDA_DEBUG(1, "%s, Waking up\n", driver_name); | 1715 | IRDA_DEBUG(1, "%s, Waking up\n", driver_name); |
@@ -1788,7 +1789,7 @@ static void __exit smsc_ircc_cleanup(void) | |||
1788 | smsc_ircc_close(dev_self[i]); | 1789 | smsc_ircc_close(dev_self[i]); |
1789 | } | 1790 | } |
1790 | 1791 | ||
1791 | driver_unregister(&smsc_ircc_driver); | 1792 | platform_driver_unregister(&smsc_ircc_driver); |
1792 | } | 1793 | } |
1793 | 1794 | ||
1794 | /* | 1795 | /* |
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c index 2fb3101cb33e..b039bd89ceb9 100644 --- a/drivers/net/jazzsonic.c +++ b/drivers/net/jazzsonic.c | |||
@@ -194,7 +194,7 @@ out: | |||
194 | * Probe for a SONIC ethernet controller on a Mips Jazz board. | 194 | * Probe for a SONIC ethernet controller on a Mips Jazz board. |
195 | * Actually probing is superfluous but we're paranoid. | 195 | * Actually probing is superfluous but we're paranoid. |
196 | */ | 196 | */ |
197 | static int __init jazz_sonic_probe(struct device *device) | 197 | static int __init jazz_sonic_probe(struct platform_device *pdev) |
198 | { | 198 | { |
199 | struct net_device *dev; | 199 | struct net_device *dev; |
200 | struct sonic_local *lp; | 200 | struct sonic_local *lp; |
@@ -212,8 +212,8 @@ static int __init jazz_sonic_probe(struct device *device) | |||
212 | return -ENOMEM; | 212 | return -ENOMEM; |
213 | 213 | ||
214 | lp = netdev_priv(dev); | 214 | lp = netdev_priv(dev); |
215 | lp->device = device; | 215 | lp->device = &pdev->dev; |
216 | SET_NETDEV_DEV(dev, device); | 216 | SET_NETDEV_DEV(dev, &pdev->dev); |
217 | SET_MODULE_OWNER(dev); | 217 | SET_MODULE_OWNER(dev); |
218 | 218 | ||
219 | netdev_boot_setup_check(dev); | 219 | netdev_boot_setup_check(dev); |
@@ -264,9 +264,9 @@ MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)"); | |||
264 | 264 | ||
265 | #include "sonic.c" | 265 | #include "sonic.c" |
266 | 266 | ||
267 | static int __devexit jazz_sonic_device_remove (struct device *device) | 267 | static int __devexit jazz_sonic_device_remove (struct platform_device *pdev) |
268 | { | 268 | { |
269 | struct net_device *dev = device->driver_data; | 269 | struct net_device *dev = platform_get_drvdata(pdev); |
270 | struct sonic_local* lp = netdev_priv(dev); | 270 | struct sonic_local* lp = netdev_priv(dev); |
271 | 271 | ||
272 | unregister_netdev (dev); | 272 | unregister_netdev (dev); |
@@ -278,18 +278,19 @@ static int __devexit jazz_sonic_device_remove (struct device *device) | |||
278 | return 0; | 278 | return 0; |
279 | } | 279 | } |
280 | 280 | ||
281 | static struct device_driver jazz_sonic_driver = { | 281 | static struct platform_driver jazz_sonic_driver = { |
282 | .name = jazz_sonic_string, | ||
283 | .bus = &platform_bus_type, | ||
284 | .probe = jazz_sonic_probe, | 282 | .probe = jazz_sonic_probe, |
285 | .remove = __devexit_p(jazz_sonic_device_remove), | 283 | .remove = __devexit_p(jazz_sonic_device_remove), |
284 | .driver = { | ||
285 | .name = jazz_sonic_string, | ||
286 | }, | ||
286 | }; | 287 | }; |
287 | 288 | ||
288 | static int __init jazz_sonic_init_module(void) | 289 | static int __init jazz_sonic_init_module(void) |
289 | { | 290 | { |
290 | int err; | 291 | int err; |
291 | 292 | ||
292 | if ((err = driver_register(&jazz_sonic_driver))) { | 293 | if ((err = platform_driver_register(&jazz_sonic_driver))) { |
293 | printk(KERN_ERR "Driver registration failed\n"); | 294 | printk(KERN_ERR "Driver registration failed\n"); |
294 | return err; | 295 | return err; |
295 | } | 296 | } |
@@ -313,7 +314,7 @@ out_unregister: | |||
313 | 314 | ||
314 | static void __exit jazz_sonic_cleanup_module(void) | 315 | static void __exit jazz_sonic_cleanup_module(void) |
315 | { | 316 | { |
316 | driver_unregister(&jazz_sonic_driver); | 317 | platform_driver_unregister(&jazz_sonic_driver); |
317 | 318 | ||
318 | if (jazz_sonic_device) { | 319 | if (jazz_sonic_device) { |
319 | platform_device_unregister(jazz_sonic_device); | 320 | platform_device_unregister(jazz_sonic_device); |
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c index 9ef4592aca03..02d5c6822733 100644 --- a/drivers/net/macsonic.c +++ b/drivers/net/macsonic.c | |||
@@ -525,7 +525,7 @@ int __init mac_nubus_sonic_probe(struct net_device* dev) | |||
525 | return macsonic_init(dev); | 525 | return macsonic_init(dev); |
526 | } | 526 | } |
527 | 527 | ||
528 | static int __init mac_sonic_probe(struct device *device) | 528 | static int __init mac_sonic_probe(struct platform_device *device) |
529 | { | 529 | { |
530 | struct net_device *dev; | 530 | struct net_device *dev; |
531 | struct sonic_local *lp; | 531 | struct sonic_local *lp; |
@@ -537,8 +537,8 @@ static int __init mac_sonic_probe(struct device *device) | |||
537 | return -ENOMEM; | 537 | return -ENOMEM; |
538 | 538 | ||
539 | lp = netdev_priv(dev); | 539 | lp = netdev_priv(dev); |
540 | lp->device = device; | 540 | lp->device = &device->dev; |
541 | SET_NETDEV_DEV(dev, device); | 541 | SET_NETDEV_DEV(dev, &device->dev); |
542 | SET_MODULE_OWNER(dev); | 542 | SET_MODULE_OWNER(dev); |
543 | 543 | ||
544 | /* This will catch fatal stuff like -ENOMEM as well as success */ | 544 | /* This will catch fatal stuff like -ENOMEM as well as success */ |
@@ -579,9 +579,9 @@ MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)"); | |||
579 | 579 | ||
580 | #include "sonic.c" | 580 | #include "sonic.c" |
581 | 581 | ||
582 | static int __devexit mac_sonic_device_remove (struct device *device) | 582 | static int __devexit mac_sonic_device_remove (struct platform_device *device) |
583 | { | 583 | { |
584 | struct net_device *dev = device->driver_data; | 584 | struct net_device *dev = platform_get_drvdata(device); |
585 | struct sonic_local* lp = netdev_priv(dev); | 585 | struct sonic_local* lp = netdev_priv(dev); |
586 | 586 | ||
587 | unregister_netdev (dev); | 587 | unregister_netdev (dev); |
@@ -592,18 +592,19 @@ static int __devexit mac_sonic_device_remove (struct device *device) | |||
592 | return 0; | 592 | return 0; |
593 | } | 593 | } |
594 | 594 | ||
595 | static struct device_driver mac_sonic_driver = { | 595 | static struct platform_driver mac_sonic_driver = { |
596 | .name = mac_sonic_string, | ||
597 | .bus = &platform_bus_type, | ||
598 | .probe = mac_sonic_probe, | 596 | .probe = mac_sonic_probe, |
599 | .remove = __devexit_p(mac_sonic_device_remove), | 597 | .remove = __devexit_p(mac_sonic_device_remove), |
598 | .driver = { | ||
599 | .name = mac_sonic_string, | ||
600 | }, | ||
600 | }; | 601 | }; |
601 | 602 | ||
602 | static int __init mac_sonic_init_module(void) | 603 | static int __init mac_sonic_init_module(void) |
603 | { | 604 | { |
604 | int err; | 605 | int err; |
605 | 606 | ||
606 | if ((err = driver_register(&mac_sonic_driver))) { | 607 | if ((err = platform_driver_register(&mac_sonic_driver))) { |
607 | printk(KERN_ERR "Driver registration failed\n"); | 608 | printk(KERN_ERR "Driver registration failed\n"); |
608 | return err; | 609 | return err; |
609 | } | 610 | } |
@@ -628,7 +629,7 @@ out_unregister: | |||
628 | 629 | ||
629 | static void __exit mac_sonic_cleanup_module(void) | 630 | static void __exit mac_sonic_cleanup_module(void) |
630 | { | 631 | { |
631 | driver_unregister(&mac_sonic_driver); | 632 | platform_driver_unregister(&mac_sonic_driver); |
632 | 633 | ||
633 | if (mac_sonic_device) { | 634 | if (mac_sonic_device) { |
634 | platform_device_unregister(mac_sonic_device); | 635 | platform_device_unregister(mac_sonic_device); |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 71f2c6705bc3..3cb9b3fe0cf1 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -1387,9 +1387,8 @@ static void mv643xx_netpoll(struct net_device *netdev) | |||
1387 | * Input : struct device * | 1387 | * Input : struct device * |
1388 | * Output : -ENOMEM if failed , 0 if success | 1388 | * Output : -ENOMEM if failed , 0 if success |
1389 | */ | 1389 | */ |
1390 | static int mv643xx_eth_probe(struct device *ddev) | 1390 | static int mv643xx_eth_probe(struct platform_device *pdev) |
1391 | { | 1391 | { |
1392 | struct platform_device *pdev = to_platform_device(ddev); | ||
1393 | struct mv643xx_eth_platform_data *pd; | 1392 | struct mv643xx_eth_platform_data *pd; |
1394 | int port_num = pdev->id; | 1393 | int port_num = pdev->id; |
1395 | struct mv643xx_private *mp; | 1394 | struct mv643xx_private *mp; |
@@ -1402,7 +1401,7 @@ static int mv643xx_eth_probe(struct device *ddev) | |||
1402 | if (!dev) | 1401 | if (!dev) |
1403 | return -ENOMEM; | 1402 | return -ENOMEM; |
1404 | 1403 | ||
1405 | dev_set_drvdata(ddev, dev); | 1404 | platform_set_drvdata(pdev, dev); |
1406 | 1405 | ||
1407 | mp = netdev_priv(dev); | 1406 | mp = netdev_priv(dev); |
1408 | 1407 | ||
@@ -1546,21 +1545,20 @@ out: | |||
1546 | return err; | 1545 | return err; |
1547 | } | 1546 | } |
1548 | 1547 | ||
1549 | static int mv643xx_eth_remove(struct device *ddev) | 1548 | static int mv643xx_eth_remove(struct platform_device *pdev) |
1550 | { | 1549 | { |
1551 | struct net_device *dev = dev_get_drvdata(ddev); | 1550 | struct net_device *dev = platform_get_drvdata(pdev); |
1552 | 1551 | ||
1553 | unregister_netdev(dev); | 1552 | unregister_netdev(dev); |
1554 | flush_scheduled_work(); | 1553 | flush_scheduled_work(); |
1555 | 1554 | ||
1556 | free_netdev(dev); | 1555 | free_netdev(dev); |
1557 | dev_set_drvdata(ddev, NULL); | 1556 | platform_set_drvdata(pdev, NULL); |
1558 | return 0; | 1557 | return 0; |
1559 | } | 1558 | } |
1560 | 1559 | ||
1561 | static int mv643xx_eth_shared_probe(struct device *ddev) | 1560 | static int mv643xx_eth_shared_probe(struct platform_device *pdev) |
1562 | { | 1561 | { |
1563 | struct platform_device *pdev = to_platform_device(ddev); | ||
1564 | struct resource *res; | 1562 | struct resource *res; |
1565 | 1563 | ||
1566 | printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); | 1564 | printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); |
@@ -1578,7 +1576,7 @@ static int mv643xx_eth_shared_probe(struct device *ddev) | |||
1578 | 1576 | ||
1579 | } | 1577 | } |
1580 | 1578 | ||
1581 | static int mv643xx_eth_shared_remove(struct device *ddev) | 1579 | static int mv643xx_eth_shared_remove(struct platform_device *pdev) |
1582 | { | 1580 | { |
1583 | iounmap(mv643xx_eth_shared_base); | 1581 | iounmap(mv643xx_eth_shared_base); |
1584 | mv643xx_eth_shared_base = NULL; | 1582 | mv643xx_eth_shared_base = NULL; |
@@ -1586,18 +1584,20 @@ static int mv643xx_eth_shared_remove(struct device *ddev) | |||
1586 | return 0; | 1584 | return 0; |
1587 | } | 1585 | } |
1588 | 1586 | ||
1589 | static struct device_driver mv643xx_eth_driver = { | 1587 | static struct platform_driver mv643xx_eth_driver = { |
1590 | .name = MV643XX_ETH_NAME, | ||
1591 | .bus = &platform_bus_type, | ||
1592 | .probe = mv643xx_eth_probe, | 1588 | .probe = mv643xx_eth_probe, |
1593 | .remove = mv643xx_eth_remove, | 1589 | .remove = mv643xx_eth_remove, |
1590 | .driver = { | ||
1591 | .name = MV643XX_ETH_NAME, | ||
1592 | }, | ||
1594 | }; | 1593 | }; |
1595 | 1594 | ||
1596 | static struct device_driver mv643xx_eth_shared_driver = { | 1595 | static struct platform_driver mv643xx_eth_shared_driver = { |
1597 | .name = MV643XX_ETH_SHARED_NAME, | ||
1598 | .bus = &platform_bus_type, | ||
1599 | .probe = mv643xx_eth_shared_probe, | 1596 | .probe = mv643xx_eth_shared_probe, |
1600 | .remove = mv643xx_eth_shared_remove, | 1597 | .remove = mv643xx_eth_shared_remove, |
1598 | .driver = { | ||
1599 | .name = MV643XX_ETH_SHARED_NAME, | ||
1600 | }, | ||
1601 | }; | 1601 | }; |
1602 | 1602 | ||
1603 | /* | 1603 | /* |
@@ -1613,11 +1613,11 @@ static int __init mv643xx_init_module(void) | |||
1613 | { | 1613 | { |
1614 | int rc; | 1614 | int rc; |
1615 | 1615 | ||
1616 | rc = driver_register(&mv643xx_eth_shared_driver); | 1616 | rc = platform_driver_register(&mv643xx_eth_shared_driver); |
1617 | if (!rc) { | 1617 | if (!rc) { |
1618 | rc = driver_register(&mv643xx_eth_driver); | 1618 | rc = platform_driver_register(&mv643xx_eth_driver); |
1619 | if (rc) | 1619 | if (rc) |
1620 | driver_unregister(&mv643xx_eth_shared_driver); | 1620 | platform_driver_unregister(&mv643xx_eth_shared_driver); |
1621 | } | 1621 | } |
1622 | return rc; | 1622 | return rc; |
1623 | } | 1623 | } |
@@ -1633,8 +1633,8 @@ static int __init mv643xx_init_module(void) | |||
1633 | */ | 1633 | */ |
1634 | static void __exit mv643xx_cleanup_module(void) | 1634 | static void __exit mv643xx_cleanup_module(void) |
1635 | { | 1635 | { |
1636 | driver_unregister(&mv643xx_eth_driver); | 1636 | platform_driver_unregister(&mv643xx_eth_driver); |
1637 | driver_unregister(&mv643xx_eth_shared_driver); | 1637 | platform_driver_unregister(&mv643xx_eth_shared_driver); |
1638 | } | 1638 | } |
1639 | 1639 | ||
1640 | module_init(mv643xx_init_module); | 1640 | module_init(mv643xx_init_module); |
diff --git a/drivers/net/saa9730.c b/drivers/net/saa9730.c index 110e777f206e..b2acedbefa8f 100644 --- a/drivers/net/saa9730.c +++ b/drivers/net/saa9730.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Carsten Langgaard, carstenl@mips.com | 2 | * Copyright (C) 2000, 2005 MIPS Technologies, Inc. All rights reserved. |
3 | * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. | 3 | * Authors: Carsten Langgaard <carstenl@mips.com> |
4 | * | 4 | * Maciej W. Rozycki <macro@mips.com> |
5 | * ######################################################################## | 5 | * Copyright (C) 2004 Ralf Baechle <ralf@linux-mips.org> |
6 | * | 6 | * |
7 | * This program is free software; you can distribute it and/or modify it | 7 | * This program is free software; you can distribute it and/or modify it |
8 | * under the terms of the GNU General Public License (Version 2) as | 8 | * under the terms of the GNU General Public License (Version 2) as |
@@ -17,15 +17,13 @@ | |||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | 17 | * with this program; if not, write to the Free Software Foundation, Inc., |
18 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | 18 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * ######################################################################## | ||
21 | * | ||
22 | * SAA9730 ethernet driver. | 20 | * SAA9730 ethernet driver. |
23 | * | 21 | * |
24 | * Changes: | 22 | * Changes: |
25 | * Angelo Dell'Aera <buffer@antifork.org> : Conversion to the new PCI API (pci_driver). | 23 | * Angelo Dell'Aera <buffer@antifork.org> : Conversion to the new PCI API |
26 | * Conversion to spinlocks. | 24 | * (pci_driver). |
27 | * Error handling fixes. | 25 | * Conversion to spinlocks. |
28 | * | 26 | * Error handling fixes. |
29 | */ | 27 | */ |
30 | 28 | ||
31 | #include <linux/init.h> | 29 | #include <linux/init.h> |
@@ -36,8 +34,11 @@ | |||
36 | #include <linux/skbuff.h> | 34 | #include <linux/skbuff.h> |
37 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
38 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
37 | #include <linux/types.h> | ||
39 | 38 | ||
40 | #include <asm/addrspace.h> | 39 | #include <asm/addrspace.h> |
40 | #include <asm/io.h> | ||
41 | |||
41 | #include <asm/mips-boards/prom.h> | 42 | #include <asm/mips-boards/prom.h> |
42 | 43 | ||
43 | #include "saa9730.h" | 44 | #include "saa9730.h" |
@@ -51,8 +52,8 @@ int lan_saa9730_debug; | |||
51 | #define DRV_MODULE_NAME "saa9730" | 52 | #define DRV_MODULE_NAME "saa9730" |
52 | 53 | ||
53 | static struct pci_device_id saa9730_pci_tbl[] = { | 54 | static struct pci_device_id saa9730_pci_tbl[] = { |
54 | { PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA9370, | 55 | { PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA9730, |
55 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, | 56 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
56 | { 0, } | 57 | { 0, } |
57 | }; | 58 | }; |
58 | 59 | ||
@@ -61,50 +62,48 @@ MODULE_DEVICE_TABLE(pci, saa9730_pci_tbl); | |||
61 | /* Non-zero only if the current card is a PCI with BIOS-set IRQ. */ | 62 | /* Non-zero only if the current card is a PCI with BIOS-set IRQ. */ |
62 | static unsigned int pci_irq_line; | 63 | static unsigned int pci_irq_line; |
63 | 64 | ||
64 | #define INL(a) inl((unsigned long)a) | ||
65 | #define OUTL(x,a) outl(x,(unsigned long)a) | ||
66 | |||
67 | static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp) | 65 | static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp) |
68 | { | 66 | { |
69 | OUTL(INL(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, | 67 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, |
70 | &lp->evm_saa9730_regs->InterruptBlock1); | 68 | &lp->evm_saa9730_regs->InterruptBlock1); |
71 | OUTL(INL(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT, | 69 | outl(readl(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT, |
72 | &lp->evm_saa9730_regs->InterruptStatus1); | 70 | &lp->evm_saa9730_regs->InterruptStatus1); |
73 | OUTL(INL(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT | | 71 | outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT | |
74 | EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1); | 72 | EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1); |
75 | } | 73 | } |
74 | |||
76 | static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp) | 75 | static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp) |
77 | { | 76 | { |
78 | OUTL(INL(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, | 77 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, |
79 | &lp->evm_saa9730_regs->InterruptBlock1); | 78 | &lp->evm_saa9730_regs->InterruptBlock1); |
80 | OUTL(INL(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT, | 79 | outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT, |
81 | &lp->evm_saa9730_regs->InterruptEnable1); | 80 | &lp->evm_saa9730_regs->InterruptEnable1); |
82 | } | 81 | } |
83 | 82 | ||
84 | static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp) | 83 | static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp) |
85 | { | 84 | { |
86 | OUTL(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1); | 85 | outl(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1); |
87 | } | 86 | } |
88 | 87 | ||
89 | static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp) | 88 | static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp) |
90 | { | 89 | { |
91 | OUTL(INL(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, | 90 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, |
92 | &lp->evm_saa9730_regs->InterruptBlock1); | 91 | &lp->evm_saa9730_regs->InterruptBlock1); |
93 | } | 92 | } |
94 | 93 | ||
95 | static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp) | 94 | static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp) |
96 | { | 95 | { |
97 | OUTL(INL(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, | 96 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, |
98 | &lp->evm_saa9730_regs->InterruptBlock1); | 97 | &lp->evm_saa9730_regs->InterruptBlock1); |
99 | } | 98 | } |
100 | 99 | ||
101 | static void show_saa9730_regs(struct lan_saa9730_private *lp) | 100 | static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp) |
102 | { | 101 | { |
103 | int i, j; | 102 | int i, j; |
104 | printk("TxmBufferA = %x\n", lp->TxmBuffer[0][0]); | 103 | printk("TxmBufferA = %p\n", lp->TxmBuffer[0][0]); |
105 | printk("TxmBufferB = %x\n", lp->TxmBuffer[1][0]); | 104 | printk("TxmBufferB = %p\n", lp->TxmBuffer[1][0]); |
106 | printk("RcvBufferA = %x\n", lp->RcvBuffer[0][0]); | 105 | printk("RcvBufferA = %p\n", lp->RcvBuffer[0][0]); |
107 | printk("RcvBufferB = %x\n", lp->RcvBuffer[1][0]); | 106 | printk("RcvBufferB = %p\n", lp->RcvBuffer[1][0]); |
108 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { | 107 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { |
109 | for (j = 0; j < LAN_SAA9730_TXM_Q_SIZE; j++) { | 108 | for (j = 0; j < LAN_SAA9730_TXM_Q_SIZE; j++) { |
110 | printk("TxmBuffer[%d][%d] = %x\n", i, j, | 109 | printk("TxmBuffer[%d][%d] = %x\n", i, j, |
@@ -120,13 +119,13 @@ static void show_saa9730_regs(struct lan_saa9730_private *lp) | |||
120 | } | 119 | } |
121 | } | 120 | } |
122 | printk("lp->evm_saa9730_regs->InterruptBlock1 = %x\n", | 121 | printk("lp->evm_saa9730_regs->InterruptBlock1 = %x\n", |
123 | INL(&lp->evm_saa9730_regs->InterruptBlock1)); | 122 | readl(&lp->evm_saa9730_regs->InterruptBlock1)); |
124 | printk("lp->evm_saa9730_regs->InterruptStatus1 = %x\n", | 123 | printk("lp->evm_saa9730_regs->InterruptStatus1 = %x\n", |
125 | INL(&lp->evm_saa9730_regs->InterruptStatus1)); | 124 | readl(&lp->evm_saa9730_regs->InterruptStatus1)); |
126 | printk("lp->evm_saa9730_regs->InterruptEnable1 = %x\n", | 125 | printk("lp->evm_saa9730_regs->InterruptEnable1 = %x\n", |
127 | INL(&lp->evm_saa9730_regs->InterruptEnable1)); | 126 | readl(&lp->evm_saa9730_regs->InterruptEnable1)); |
128 | printk("lp->lan_saa9730_regs->Ok2Use = %x\n", | 127 | printk("lp->lan_saa9730_regs->Ok2Use = %x\n", |
129 | INL(&lp->lan_saa9730_regs->Ok2Use)); | 128 | readl(&lp->lan_saa9730_regs->Ok2Use)); |
130 | printk("lp->NextTxmBufferIndex = %x\n", lp->NextTxmBufferIndex); | 129 | printk("lp->NextTxmBufferIndex = %x\n", lp->NextTxmBufferIndex); |
131 | printk("lp->NextTxmPacketIndex = %x\n", lp->NextTxmPacketIndex); | 130 | printk("lp->NextTxmPacketIndex = %x\n", lp->NextTxmPacketIndex); |
132 | printk("lp->PendingTxmBufferIndex = %x\n", | 131 | printk("lp->PendingTxmBufferIndex = %x\n", |
@@ -134,23 +133,23 @@ static void show_saa9730_regs(struct lan_saa9730_private *lp) | |||
134 | printk("lp->PendingTxmPacketIndex = %x\n", | 133 | printk("lp->PendingTxmPacketIndex = %x\n", |
135 | lp->PendingTxmPacketIndex); | 134 | lp->PendingTxmPacketIndex); |
136 | printk("lp->lan_saa9730_regs->LanDmaCtl = %x\n", | 135 | printk("lp->lan_saa9730_regs->LanDmaCtl = %x\n", |
137 | INL(&lp->lan_saa9730_regs->LanDmaCtl)); | 136 | readl(&lp->lan_saa9730_regs->LanDmaCtl)); |
138 | printk("lp->lan_saa9730_regs->DmaStatus = %x\n", | 137 | printk("lp->lan_saa9730_regs->DmaStatus = %x\n", |
139 | INL(&lp->lan_saa9730_regs->DmaStatus)); | 138 | readl(&lp->lan_saa9730_regs->DmaStatus)); |
140 | printk("lp->lan_saa9730_regs->CamCtl = %x\n", | 139 | printk("lp->lan_saa9730_regs->CamCtl = %x\n", |
141 | INL(&lp->lan_saa9730_regs->CamCtl)); | 140 | readl(&lp->lan_saa9730_regs->CamCtl)); |
142 | printk("lp->lan_saa9730_regs->TxCtl = %x\n", | 141 | printk("lp->lan_saa9730_regs->TxCtl = %x\n", |
143 | INL(&lp->lan_saa9730_regs->TxCtl)); | 142 | readl(&lp->lan_saa9730_regs->TxCtl)); |
144 | printk("lp->lan_saa9730_regs->TxStatus = %x\n", | 143 | printk("lp->lan_saa9730_regs->TxStatus = %x\n", |
145 | INL(&lp->lan_saa9730_regs->TxStatus)); | 144 | readl(&lp->lan_saa9730_regs->TxStatus)); |
146 | printk("lp->lan_saa9730_regs->RxCtl = %x\n", | 145 | printk("lp->lan_saa9730_regs->RxCtl = %x\n", |
147 | INL(&lp->lan_saa9730_regs->RxCtl)); | 146 | readl(&lp->lan_saa9730_regs->RxCtl)); |
148 | printk("lp->lan_saa9730_regs->RxStatus = %x\n", | 147 | printk("lp->lan_saa9730_regs->RxStatus = %x\n", |
149 | INL(&lp->lan_saa9730_regs->RxStatus)); | 148 | readl(&lp->lan_saa9730_regs->RxStatus)); |
150 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { | 149 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { |
151 | OUTL(i, &lp->lan_saa9730_regs->CamAddress); | 150 | outl(i, &lp->lan_saa9730_regs->CamAddress); |
152 | printk("lp->lan_saa9730_regs->CamData = %x\n", | 151 | printk("lp->lan_saa9730_regs->CamData = %x\n", |
153 | INL(&lp->lan_saa9730_regs->CamData)); | 152 | readl(&lp->lan_saa9730_regs->CamData)); |
154 | } | 153 | } |
155 | printk("lp->stats.tx_packets = %lx\n", lp->stats.tx_packets); | 154 | printk("lp->stats.tx_packets = %lx\n", lp->stats.tx_packets); |
156 | printk("lp->stats.tx_errors = %lx\n", lp->stats.tx_errors); | 155 | printk("lp->stats.tx_errors = %lx\n", lp->stats.tx_errors); |
@@ -178,17 +177,17 @@ static void show_saa9730_regs(struct lan_saa9730_private *lp) | |||
178 | lp->stats.rx_length_errors); | 177 | lp->stats.rx_length_errors); |
179 | 178 | ||
180 | printk("lp->lan_saa9730_regs->DebugPCIMasterAddr = %x\n", | 179 | printk("lp->lan_saa9730_regs->DebugPCIMasterAddr = %x\n", |
181 | INL(&lp->lan_saa9730_regs->DebugPCIMasterAddr)); | 180 | readl(&lp->lan_saa9730_regs->DebugPCIMasterAddr)); |
182 | printk("lp->lan_saa9730_regs->DebugLanTxStateMachine = %x\n", | 181 | printk("lp->lan_saa9730_regs->DebugLanTxStateMachine = %x\n", |
183 | INL(&lp->lan_saa9730_regs->DebugLanTxStateMachine)); | 182 | readl(&lp->lan_saa9730_regs->DebugLanTxStateMachine)); |
184 | printk("lp->lan_saa9730_regs->DebugLanRxStateMachine = %x\n", | 183 | printk("lp->lan_saa9730_regs->DebugLanRxStateMachine = %x\n", |
185 | INL(&lp->lan_saa9730_regs->DebugLanRxStateMachine)); | 184 | readl(&lp->lan_saa9730_regs->DebugLanRxStateMachine)); |
186 | printk("lp->lan_saa9730_regs->DebugLanTxFifoPointers = %x\n", | 185 | printk("lp->lan_saa9730_regs->DebugLanTxFifoPointers = %x\n", |
187 | INL(&lp->lan_saa9730_regs->DebugLanTxFifoPointers)); | 186 | readl(&lp->lan_saa9730_regs->DebugLanTxFifoPointers)); |
188 | printk("lp->lan_saa9730_regs->DebugLanRxFifoPointers = %x\n", | 187 | printk("lp->lan_saa9730_regs->DebugLanRxFifoPointers = %x\n", |
189 | INL(&lp->lan_saa9730_regs->DebugLanRxFifoPointers)); | 188 | readl(&lp->lan_saa9730_regs->DebugLanRxFifoPointers)); |
190 | printk("lp->lan_saa9730_regs->DebugLanCtlStateMachine = %x\n", | 189 | printk("lp->lan_saa9730_regs->DebugLanCtlStateMachine = %x\n", |
191 | INL(&lp->lan_saa9730_regs->DebugLanCtlStateMachine)); | 190 | readl(&lp->lan_saa9730_regs->DebugLanCtlStateMachine)); |
192 | } | 191 | } |
193 | 192 | ||
194 | static void lan_saa9730_buffer_init(struct lan_saa9730_private *lp) | 193 | static void lan_saa9730_buffer_init(struct lan_saa9730_private *lp) |
@@ -214,98 +213,108 @@ static void lan_saa9730_buffer_init(struct lan_saa9730_private *lp) | |||
214 | } | 213 | } |
215 | } | 214 | } |
216 | 215 | ||
217 | static int lan_saa9730_allocate_buffers(struct lan_saa9730_private *lp) | 216 | static void lan_saa9730_free_buffers(struct pci_dev *pdev, |
217 | struct lan_saa9730_private *lp) | ||
218 | { | 218 | { |
219 | unsigned int mem_size; | 219 | pci_free_consistent(pdev, lp->buffer_size, lp->buffer_start, |
220 | void *Pa; | 220 | lp->dma_addr); |
221 | unsigned int i, j, RcvBufferSize, TxmBufferSize; | 221 | } |
222 | unsigned int buffer_start; | ||
223 | 222 | ||
224 | /* | 223 | static int lan_saa9730_allocate_buffers(struct pci_dev *pdev, |
225 | * Allocate all RX and TX packets in one chunk. | 224 | struct lan_saa9730_private *lp) |
226 | * The Rx and Tx packets must be PACKET_SIZE aligned. | 225 | { |
227 | */ | 226 | void *Pa; |
228 | mem_size = ((LAN_SAA9730_RCV_Q_SIZE + LAN_SAA9730_TXM_Q_SIZE) * | 227 | unsigned int i, j, rxoffset, txoffset; |
229 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_BUFFERS) + | 228 | int ret; |
230 | LAN_SAA9730_PACKET_SIZE; | ||
231 | buffer_start = | ||
232 | (unsigned int) kmalloc(mem_size, GFP_DMA | GFP_KERNEL); | ||
233 | |||
234 | if (!buffer_start) | ||
235 | return -ENOMEM; | ||
236 | |||
237 | /* | ||
238 | * Set DMA buffer to kseg1 (uncached). | ||
239 | * Make sure to flush before using it uncached. | ||
240 | */ | ||
241 | Pa = (void *) KSEG1ADDR((buffer_start + LAN_SAA9730_PACKET_SIZE) & | ||
242 | ~(LAN_SAA9730_PACKET_SIZE - 1)); | ||
243 | dma_cache_wback_inv((unsigned long) Pa, mem_size); | ||
244 | 229 | ||
245 | /* Initialize buffer space */ | 230 | /* Initialize buffer space */ |
246 | RcvBufferSize = LAN_SAA9730_PACKET_SIZE; | ||
247 | TxmBufferSize = LAN_SAA9730_PACKET_SIZE; | ||
248 | lp->DmaRcvPackets = LAN_SAA9730_RCV_Q_SIZE; | 231 | lp->DmaRcvPackets = LAN_SAA9730_RCV_Q_SIZE; |
249 | lp->DmaTxmPackets = LAN_SAA9730_TXM_Q_SIZE; | 232 | lp->DmaTxmPackets = LAN_SAA9730_TXM_Q_SIZE; |
250 | 233 | ||
234 | /* Initialize Rx Buffer Index */ | ||
235 | lp->NextRcvPacketIndex = 0; | ||
236 | lp->NextRcvBufferIndex = 0; | ||
237 | |||
238 | /* Set current buffer index & next available packet index */ | ||
239 | lp->NextTxmPacketIndex = 0; | ||
240 | lp->NextTxmBufferIndex = 0; | ||
241 | lp->PendingTxmPacketIndex = 0; | ||
242 | lp->PendingTxmBufferIndex = 0; | ||
243 | |||
244 | /* | ||
245 | * Allocate all RX and TX packets in one chunk. | ||
246 | * The Rx and Tx packets must be PACKET_SIZE aligned. | ||
247 | */ | ||
248 | lp->buffer_size = ((LAN_SAA9730_RCV_Q_SIZE + LAN_SAA9730_TXM_Q_SIZE) * | ||
249 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_BUFFERS) + | ||
250 | LAN_SAA9730_PACKET_SIZE; | ||
251 | lp->buffer_start = pci_alloc_consistent(pdev, lp->buffer_size, | ||
252 | &lp->dma_addr); | ||
253 | if (!lp->buffer_start) { | ||
254 | ret = -ENOMEM; | ||
255 | goto out; | ||
256 | } | ||
257 | |||
258 | Pa = (void *)ALIGN((unsigned long)lp->buffer_start, | ||
259 | LAN_SAA9730_PACKET_SIZE); | ||
260 | |||
261 | rxoffset = Pa - lp->buffer_start; | ||
262 | |||
251 | /* Init RX buffers */ | 263 | /* Init RX buffers */ |
252 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { | 264 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { |
253 | for (j = 0; j < LAN_SAA9730_RCV_Q_SIZE; j++) { | 265 | for (j = 0; j < LAN_SAA9730_RCV_Q_SIZE; j++) { |
254 | *(unsigned int *) Pa = | 266 | *(unsigned int *) Pa = |
255 | cpu_to_le32(RXSF_READY << | 267 | cpu_to_le32(RXSF_READY << |
256 | RX_STAT_CTL_OWNER_SHF); | 268 | RX_STAT_CTL_OWNER_SHF); |
257 | lp->RcvBuffer[i][j] = (unsigned int) Pa; | 269 | lp->RcvBuffer[i][j] = Pa; |
258 | Pa += RcvBufferSize; | 270 | Pa += LAN_SAA9730_PACKET_SIZE; |
259 | } | 271 | } |
260 | } | 272 | } |
261 | 273 | ||
274 | txoffset = Pa - lp->buffer_start; | ||
275 | |||
262 | /* Init TX buffers */ | 276 | /* Init TX buffers */ |
263 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { | 277 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { |
264 | for (j = 0; j < LAN_SAA9730_TXM_Q_SIZE; j++) { | 278 | for (j = 0; j < LAN_SAA9730_TXM_Q_SIZE; j++) { |
265 | *(unsigned int *) Pa = | 279 | *(unsigned int *) Pa = |
266 | cpu_to_le32(TXSF_EMPTY << | 280 | cpu_to_le32(TXSF_EMPTY << |
267 | TX_STAT_CTL_OWNER_SHF); | 281 | TX_STAT_CTL_OWNER_SHF); |
268 | lp->TxmBuffer[i][j] = (unsigned int) Pa; | 282 | lp->TxmBuffer[i][j] = Pa; |
269 | Pa += TxmBufferSize; | 283 | Pa += LAN_SAA9730_PACKET_SIZE; |
270 | } | 284 | } |
271 | } | 285 | } |
272 | 286 | ||
273 | /* | 287 | /* |
274 | * Set rx buffer A and rx buffer B to point to the first two buffer | 288 | * Set rx buffer A and rx buffer B to point to the first two buffer |
275 | * spaces. | 289 | * spaces. |
276 | */ | 290 | */ |
277 | OUTL(PHYSADDR(lp->RcvBuffer[0][0]), | 291 | outl(lp->dma_addr + rxoffset, |
278 | &lp->lan_saa9730_regs->RxBuffA); | 292 | &lp->lan_saa9730_regs->RxBuffA); |
279 | OUTL(PHYSADDR(lp->RcvBuffer[1][0]), | 293 | outl(lp->dma_addr + rxoffset + |
294 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_RCV_Q_SIZE, | ||
280 | &lp->lan_saa9730_regs->RxBuffB); | 295 | &lp->lan_saa9730_regs->RxBuffB); |
281 | 296 | ||
282 | /* Initialize Buffer Index */ | 297 | /* |
283 | lp->NextRcvPacketIndex = 0; | ||
284 | lp->NextRcvToUseIsA = 1; | ||
285 | |||
286 | /* Set current buffer index & next availble packet index */ | ||
287 | lp->NextTxmPacketIndex = 0; | ||
288 | lp->NextTxmBufferIndex = 0; | ||
289 | lp->PendingTxmPacketIndex = 0; | ||
290 | lp->PendingTxmBufferIndex = 0; | ||
291 | |||
292 | /* | ||
293 | * Set txm_buf_a and txm_buf_b to point to the first two buffer | 298 | * Set txm_buf_a and txm_buf_b to point to the first two buffer |
294 | * space | 299 | * space |
295 | */ | 300 | */ |
296 | OUTL(PHYSADDR(lp->TxmBuffer[0][0]), | 301 | outl(lp->dma_addr + txoffset, |
297 | &lp->lan_saa9730_regs->TxBuffA); | 302 | &lp->lan_saa9730_regs->TxBuffA); |
298 | OUTL(PHYSADDR(lp->TxmBuffer[1][0]), | 303 | outl(lp->dma_addr + txoffset + |
304 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_TXM_Q_SIZE, | ||
299 | &lp->lan_saa9730_regs->TxBuffB); | 305 | &lp->lan_saa9730_regs->TxBuffB); |
300 | 306 | ||
301 | /* Set packet number */ | 307 | /* Set packet number */ |
302 | OUTL((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) | | 308 | outl((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) | |
303 | (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) | | 309 | (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) | |
304 | (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) | | 310 | (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) | |
305 | (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF), | 311 | (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF), |
306 | &lp->lan_saa9730_regs->PacketCount); | 312 | &lp->lan_saa9730_regs->PacketCount); |
307 | 313 | ||
308 | return 0; | 314 | return 0; |
315 | |||
316 | out: | ||
317 | return ret; | ||
309 | } | 318 | } |
310 | 319 | ||
311 | static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) | 320 | static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) |
@@ -317,8 +326,8 @@ static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) | |||
317 | 326 | ||
318 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { | 327 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { |
319 | /* First set address to where data is written */ | 328 | /* First set address to where data is written */ |
320 | OUTL(i, &lp->lan_saa9730_regs->CamAddress); | 329 | outl(i, &lp->lan_saa9730_regs->CamAddress); |
321 | OUTL((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) | 330 | outl((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) |
322 | | (NetworkAddress[2] << 8) | NetworkAddress[3], | 331 | | (NetworkAddress[2] << 8) | NetworkAddress[3], |
323 | &lp->lan_saa9730_regs->CamData); | 332 | &lp->lan_saa9730_regs->CamData); |
324 | NetworkAddress += 4; | 333 | NetworkAddress += 4; |
@@ -328,8 +337,7 @@ static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) | |||
328 | 337 | ||
329 | static int lan_saa9730_cam_init(struct net_device *dev) | 338 | static int lan_saa9730_cam_init(struct net_device *dev) |
330 | { | 339 | { |
331 | struct lan_saa9730_private *lp = | 340 | struct lan_saa9730_private *lp = netdev_priv(dev); |
332 | (struct lan_saa9730_private *) dev->priv; | ||
333 | unsigned int i; | 341 | unsigned int i; |
334 | 342 | ||
335 | /* Copy MAC-address into all entries. */ | 343 | /* Copy MAC-address into all entries. */ |
@@ -347,7 +355,7 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
347 | 355 | ||
348 | /* Check link status, spin here till station is not busy. */ | 356 | /* Check link status, spin here till station is not busy. */ |
349 | i = 0; | 357 | i = 0; |
350 | while (INL(&lp->lan_saa9730_regs->StationMgmtCtl) & MD_CA_BUSY) { | 358 | while (readl(&lp->lan_saa9730_regs->StationMgmtCtl) & MD_CA_BUSY) { |
351 | i++; | 359 | i++; |
352 | if (i > 100) { | 360 | if (i > 100) { |
353 | printk("Error: lan_saa9730_mii_init: timeout\n"); | 361 | printk("Error: lan_saa9730_mii_init: timeout\n"); |
@@ -357,12 +365,12 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
357 | } | 365 | } |
358 | 366 | ||
359 | /* Now set the control and address register. */ | 367 | /* Now set the control and address register. */ |
360 | OUTL(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF, | 368 | outl(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF, |
361 | &lp->lan_saa9730_regs->StationMgmtCtl); | 369 | &lp->lan_saa9730_regs->StationMgmtCtl); |
362 | 370 | ||
363 | /* check link status, spin here till station is not busy */ | 371 | /* check link status, spin here till station is not busy */ |
364 | i = 0; | 372 | i = 0; |
365 | while (INL(&lp->lan_saa9730_regs->StationMgmtCtl) & MD_CA_BUSY) { | 373 | while (readl(&lp->lan_saa9730_regs->StationMgmtCtl) & MD_CA_BUSY) { |
366 | i++; | 374 | i++; |
367 | if (i > 100) { | 375 | if (i > 100) { |
368 | printk("Error: lan_saa9730_mii_init: timeout\n"); | 376 | printk("Error: lan_saa9730_mii_init: timeout\n"); |
@@ -375,7 +383,7 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
375 | mdelay(1); | 383 | mdelay(1); |
376 | 384 | ||
377 | /* Check the link status. */ | 385 | /* Check the link status. */ |
378 | if (INL(&lp->lan_saa9730_regs->StationMgmtData) & | 386 | if (readl(&lp->lan_saa9730_regs->StationMgmtData) & |
379 | PHY_STATUS_LINK_UP) { | 387 | PHY_STATUS_LINK_UP) { |
380 | /* Link is up. */ | 388 | /* Link is up. */ |
381 | return 0; | 389 | return 0; |
@@ -383,14 +391,14 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
383 | /* Link is down, reset the PHY first. */ | 391 | /* Link is down, reset the PHY first. */ |
384 | 392 | ||
385 | /* set PHY address = 'CONTROL' */ | 393 | /* set PHY address = 'CONTROL' */ |
386 | OUTL(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL, | 394 | outl(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL, |
387 | &lp->lan_saa9730_regs->StationMgmtCtl); | 395 | &lp->lan_saa9730_regs->StationMgmtCtl); |
388 | 396 | ||
389 | /* Wait for 1 ms. */ | 397 | /* Wait for 1 ms. */ |
390 | mdelay(1); | 398 | mdelay(1); |
391 | 399 | ||
392 | /* set 'CONTROL' = force reset and renegotiate */ | 400 | /* set 'CONTROL' = force reset and renegotiate */ |
393 | OUTL(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG | | 401 | outl(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG | |
394 | PHY_CONTROL_RESTART_AUTO_NEG, | 402 | PHY_CONTROL_RESTART_AUTO_NEG, |
395 | &lp->lan_saa9730_regs->StationMgmtData); | 403 | &lp->lan_saa9730_regs->StationMgmtData); |
396 | 404 | ||
@@ -398,12 +406,12 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
398 | mdelay(50); | 406 | mdelay(50); |
399 | 407 | ||
400 | /* set 'BUSY' to start operation */ | 408 | /* set 'BUSY' to start operation */ |
401 | OUTL(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | | 409 | outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | |
402 | PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl); | 410 | PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl); |
403 | 411 | ||
404 | /* await completion */ | 412 | /* await completion */ |
405 | i = 0; | 413 | i = 0; |
406 | while (INL(&lp->lan_saa9730_regs->StationMgmtCtl) & | 414 | while (readl(&lp->lan_saa9730_regs->StationMgmtCtl) & |
407 | MD_CA_BUSY) { | 415 | MD_CA_BUSY) { |
408 | i++; | 416 | i++; |
409 | if (i > 100) { | 417 | if (i > 100) { |
@@ -419,13 +427,13 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
419 | 427 | ||
420 | for (l = 0; l < 2; l++) { | 428 | for (l = 0; l < 2; l++) { |
421 | /* set PHY address = 'STATUS' */ | 429 | /* set PHY address = 'STATUS' */ |
422 | OUTL(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | | 430 | outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | |
423 | PHY_STATUS, | 431 | PHY_STATUS, |
424 | &lp->lan_saa9730_regs->StationMgmtCtl); | 432 | &lp->lan_saa9730_regs->StationMgmtCtl); |
425 | 433 | ||
426 | /* await completion */ | 434 | /* await completion */ |
427 | i = 0; | 435 | i = 0; |
428 | while (INL(&lp->lan_saa9730_regs->StationMgmtCtl) & | 436 | while (readl(&lp->lan_saa9730_regs->StationMgmtCtl) & |
429 | MD_CA_BUSY) { | 437 | MD_CA_BUSY) { |
430 | i++; | 438 | i++; |
431 | if (i > 100) { | 439 | if (i > 100) { |
@@ -440,7 +448,7 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
440 | mdelay(3000); | 448 | mdelay(3000); |
441 | 449 | ||
442 | /* check the link status */ | 450 | /* check the link status */ |
443 | if (INL(&lp->lan_saa9730_regs->StationMgmtData) & | 451 | if (readl(&lp->lan_saa9730_regs->StationMgmtData) & |
444 | PHY_STATUS_LINK_UP) { | 452 | PHY_STATUS_LINK_UP) { |
445 | /* link is up */ | 453 | /* link is up */ |
446 | break; | 454 | break; |
@@ -454,7 +462,7 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
454 | static int lan_saa9730_control_init(struct lan_saa9730_private *lp) | 462 | static int lan_saa9730_control_init(struct lan_saa9730_private *lp) |
455 | { | 463 | { |
456 | /* Initialize DMA control register. */ | 464 | /* Initialize DMA control register. */ |
457 | OUTL((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) | | 465 | outl((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) | |
458 | (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) | | 466 | (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) | |
459 | (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF) | 467 | (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF) |
460 | | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN | | 468 | | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN | |
@@ -462,27 +470,27 @@ static int lan_saa9730_control_init(struct lan_saa9730_private *lp) | |||
462 | &lp->lan_saa9730_regs->LanDmaCtl); | 470 | &lp->lan_saa9730_regs->LanDmaCtl); |
463 | 471 | ||
464 | /* Initial MAC control register. */ | 472 | /* Initial MAC control register. */ |
465 | OUTL((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP, | 473 | outl((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP, |
466 | &lp->lan_saa9730_regs->MacCtl); | 474 | &lp->lan_saa9730_regs->MacCtl); |
467 | 475 | ||
468 | /* Initialize CAM control register. */ | 476 | /* Initialize CAM control register. */ |
469 | OUTL(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC, | 477 | outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC, |
470 | &lp->lan_saa9730_regs->CamCtl); | 478 | &lp->lan_saa9730_regs->CamCtl); |
471 | 479 | ||
472 | /* | 480 | /* |
473 | * Initialize CAM enable register, only turn on first entry, should | 481 | * Initialize CAM enable register, only turn on first entry, should |
474 | * contain own addr. | 482 | * contain own addr. |
475 | */ | 483 | */ |
476 | OUTL(0x0001, &lp->lan_saa9730_regs->CamEnable); | 484 | outl(0x0001, &lp->lan_saa9730_regs->CamEnable); |
477 | 485 | ||
478 | /* Initialize Tx control register */ | 486 | /* Initialize Tx control register */ |
479 | OUTL(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl); | 487 | outl(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl); |
480 | 488 | ||
481 | /* Initialize Rcv control register */ | 489 | /* Initialize Rcv control register */ |
482 | OUTL(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl); | 490 | outl(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl); |
483 | 491 | ||
484 | /* Reset DMA engine */ | 492 | /* Reset DMA engine */ |
485 | OUTL(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); | 493 | outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); |
486 | 494 | ||
487 | return 0; | 495 | return 0; |
488 | } | 496 | } |
@@ -492,21 +500,21 @@ static int lan_saa9730_stop(struct lan_saa9730_private *lp) | |||
492 | int i; | 500 | int i; |
493 | 501 | ||
494 | /* Stop DMA first */ | 502 | /* Stop DMA first */ |
495 | OUTL(INL(&lp->lan_saa9730_regs->LanDmaCtl) & | 503 | outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) & |
496 | ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA), | 504 | ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA), |
497 | &lp->lan_saa9730_regs->LanDmaCtl); | 505 | &lp->lan_saa9730_regs->LanDmaCtl); |
498 | 506 | ||
499 | /* Set the SW Reset bits in DMA and MAC control registers */ | 507 | /* Set the SW Reset bits in DMA and MAC control registers */ |
500 | OUTL(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); | 508 | outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); |
501 | OUTL(INL(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET, | 509 | outl(readl(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET, |
502 | &lp->lan_saa9730_regs->MacCtl); | 510 | &lp->lan_saa9730_regs->MacCtl); |
503 | 511 | ||
504 | /* | 512 | /* |
505 | * Wait for MAC reset to have finished. The reset bit is auto cleared | 513 | * Wait for MAC reset to have finished. The reset bit is auto cleared |
506 | * when the reset is done. | 514 | * when the reset is done. |
507 | */ | 515 | */ |
508 | i = 0; | 516 | i = 0; |
509 | while (INL(&lp->lan_saa9730_regs->MacCtl) & MAC_CONTROL_RESET) { | 517 | while (readl(&lp->lan_saa9730_regs->MacCtl) & MAC_CONTROL_RESET) { |
510 | i++; | 518 | i++; |
511 | if (i > 100) { | 519 | if (i > 100) { |
512 | printk | 520 | printk |
@@ -524,7 +532,7 @@ static int lan_saa9730_dma_init(struct lan_saa9730_private *lp) | |||
524 | /* Stop lan controller. */ | 532 | /* Stop lan controller. */ |
525 | lan_saa9730_stop(lp); | 533 | lan_saa9730_stop(lp); |
526 | 534 | ||
527 | OUTL(LAN_SAA9730_DEFAULT_TIME_OUT_CNT, | 535 | outl(LAN_SAA9730_DEFAULT_TIME_OUT_CNT, |
528 | &lp->lan_saa9730_regs->Timeout); | 536 | &lp->lan_saa9730_regs->Timeout); |
529 | 537 | ||
530 | return 0; | 538 | return 0; |
@@ -536,28 +544,27 @@ static int lan_saa9730_start(struct lan_saa9730_private *lp) | |||
536 | 544 | ||
537 | /* Initialize Rx Buffer Index */ | 545 | /* Initialize Rx Buffer Index */ |
538 | lp->NextRcvPacketIndex = 0; | 546 | lp->NextRcvPacketIndex = 0; |
539 | lp->NextRcvToUseIsA = 1; | 547 | lp->NextRcvBufferIndex = 0; |
540 | 548 | ||
541 | /* Set current buffer index & next availble packet index */ | 549 | /* Set current buffer index & next available packet index */ |
542 | lp->NextTxmPacketIndex = 0; | 550 | lp->NextTxmPacketIndex = 0; |
543 | lp->NextTxmBufferIndex = 0; | 551 | lp->NextTxmBufferIndex = 0; |
544 | lp->PendingTxmPacketIndex = 0; | 552 | lp->PendingTxmPacketIndex = 0; |
545 | lp->PendingTxmBufferIndex = 0; | 553 | lp->PendingTxmBufferIndex = 0; |
546 | 554 | ||
547 | OUTL(INL(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA | | 555 | outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA | |
548 | DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl); | 556 | DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl); |
549 | 557 | ||
550 | /* For Tx, turn on MAC then DMA */ | 558 | /* For Tx, turn on MAC then DMA */ |
551 | OUTL(INL(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN, | 559 | outl(readl(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN, |
552 | &lp->lan_saa9730_regs->TxCtl); | 560 | &lp->lan_saa9730_regs->TxCtl); |
553 | 561 | ||
554 | /* For Rx, turn on DMA then MAC */ | 562 | /* For Rx, turn on DMA then MAC */ |
555 | OUTL(INL(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN, | 563 | outl(readl(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN, |
556 | &lp->lan_saa9730_regs->RxCtl); | 564 | &lp->lan_saa9730_regs->RxCtl); |
557 | 565 | ||
558 | /* Set Ok2Use to let hardware owns the buffers */ | 566 | /* Set Ok2Use to let hardware own the buffers. */ |
559 | OUTL(OK2USE_RX_A | OK2USE_RX_B | OK2USE_TX_A | OK2USE_TX_B, | 567 | outl(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use); |
560 | &lp->lan_saa9730_regs->Ok2Use); | ||
561 | 568 | ||
562 | return 0; | 569 | return 0; |
563 | } | 570 | } |
@@ -572,8 +579,7 @@ static int lan_saa9730_restart(struct lan_saa9730_private *lp) | |||
572 | 579 | ||
573 | static int lan_saa9730_tx(struct net_device *dev) | 580 | static int lan_saa9730_tx(struct net_device *dev) |
574 | { | 581 | { |
575 | struct lan_saa9730_private *lp = | 582 | struct lan_saa9730_private *lp = netdev_priv(dev); |
576 | (struct lan_saa9730_private *) dev->priv; | ||
577 | unsigned int *pPacket; | 583 | unsigned int *pPacket; |
578 | unsigned int tx_status; | 584 | unsigned int tx_status; |
579 | 585 | ||
@@ -581,13 +587,11 @@ static int lan_saa9730_tx(struct net_device *dev) | |||
581 | printk("lan_saa9730_tx interrupt\n"); | 587 | printk("lan_saa9730_tx interrupt\n"); |
582 | 588 | ||
583 | /* Clear interrupt. */ | 589 | /* Clear interrupt. */ |
584 | OUTL(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus); | 590 | outl(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus); |
585 | 591 | ||
586 | while (1) { | 592 | while (1) { |
587 | pPacket = | 593 | pPacket = lp->TxmBuffer[lp->PendingTxmBufferIndex] |
588 | (unsigned int *) lp->TxmBuffer[lp-> | 594 | [lp->PendingTxmPacketIndex]; |
589 | PendingTxmBufferIndex] | ||
590 | [lp->PendingTxmPacketIndex]; | ||
591 | 595 | ||
592 | /* Get status of first packet transmitted. */ | 596 | /* Get status of first packet transmitted. */ |
593 | tx_status = le32_to_cpu(*pPacket); | 597 | tx_status = le32_to_cpu(*pPacket); |
@@ -605,23 +609,22 @@ static int lan_saa9730_tx(struct net_device *dev) | |||
605 | lp->stats.tx_errors++; | 609 | lp->stats.tx_errors++; |
606 | if (tx_status & | 610 | if (tx_status & |
607 | (TX_STATUS_EX_COLL << TX_STAT_CTL_STATUS_SHF)) | 611 | (TX_STATUS_EX_COLL << TX_STAT_CTL_STATUS_SHF)) |
608 | lp->stats.tx_aborted_errors++; | 612 | lp->stats.tx_aborted_errors++; |
609 | if (tx_status & | 613 | if (tx_status & |
610 | (TX_STATUS_LATE_COLL << | 614 | (TX_STATUS_LATE_COLL << TX_STAT_CTL_STATUS_SHF)) |
611 | TX_STAT_CTL_STATUS_SHF)) lp->stats. | 615 | lp->stats.tx_window_errors++; |
612 | tx_window_errors++; | ||
613 | if (tx_status & | 616 | if (tx_status & |
614 | (TX_STATUS_L_CARR << TX_STAT_CTL_STATUS_SHF)) | 617 | (TX_STATUS_L_CARR << TX_STAT_CTL_STATUS_SHF)) |
615 | lp->stats.tx_carrier_errors++; | 618 | lp->stats.tx_carrier_errors++; |
616 | if (tx_status & | 619 | if (tx_status & |
617 | (TX_STATUS_UNDER << TX_STAT_CTL_STATUS_SHF)) | 620 | (TX_STATUS_UNDER << TX_STAT_CTL_STATUS_SHF)) |
618 | lp->stats.tx_fifo_errors++; | 621 | lp->stats.tx_fifo_errors++; |
619 | if (tx_status & | 622 | if (tx_status & |
620 | (TX_STATUS_SQ_ERR << TX_STAT_CTL_STATUS_SHF)) | 623 | (TX_STATUS_SQ_ERR << TX_STAT_CTL_STATUS_SHF)) |
621 | lp->stats.tx_heartbeat_errors++; | 624 | lp->stats.tx_heartbeat_errors++; |
622 | 625 | ||
623 | lp->stats.collisions += | 626 | lp->stats.collisions += |
624 | tx_status & TX_STATUS_TX_COLL_MSK; | 627 | tx_status & TX_STATUS_TX_COLL_MSK; |
625 | } | 628 | } |
626 | 629 | ||
627 | /* Free buffer. */ | 630 | /* Free buffer. */ |
@@ -636,21 +639,15 @@ static int lan_saa9730_tx(struct net_device *dev) | |||
636 | } | 639 | } |
637 | } | 640 | } |
638 | 641 | ||
639 | /* Make sure A and B are available to hardware. */ | 642 | /* The tx buffer is no longer full. */ |
640 | OUTL(OK2USE_TX_A | OK2USE_TX_B, &lp->lan_saa9730_regs->Ok2Use); | 643 | netif_wake_queue(dev); |
641 | |||
642 | if (netif_queue_stopped(dev)) { | ||
643 | /* The tx buffer is no longer full. */ | ||
644 | netif_wake_queue(dev); | ||
645 | } | ||
646 | 644 | ||
647 | return 0; | 645 | return 0; |
648 | } | 646 | } |
649 | 647 | ||
650 | static int lan_saa9730_rx(struct net_device *dev) | 648 | static int lan_saa9730_rx(struct net_device *dev) |
651 | { | 649 | { |
652 | struct lan_saa9730_private *lp = | 650 | struct lan_saa9730_private *lp = netdev_priv(dev); |
653 | (struct lan_saa9730_private *) dev->priv; | ||
654 | int len = 0; | 651 | int len = 0; |
655 | struct sk_buff *skb = 0; | 652 | struct sk_buff *skb = 0; |
656 | unsigned int rx_status; | 653 | unsigned int rx_status; |
@@ -663,16 +660,13 @@ static int lan_saa9730_rx(struct net_device *dev) | |||
663 | printk("lan_saa9730_rx interrupt\n"); | 660 | printk("lan_saa9730_rx interrupt\n"); |
664 | 661 | ||
665 | /* Clear receive interrupts. */ | 662 | /* Clear receive interrupts. */ |
666 | OUTL(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | | 663 | outl(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | |
667 | DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus); | 664 | DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus); |
668 | 665 | ||
669 | /* Address next packet */ | 666 | /* Address next packet */ |
670 | if (lp->NextRcvToUseIsA) | 667 | BufferIndex = lp->NextRcvBufferIndex; |
671 | BufferIndex = 0; | ||
672 | else | ||
673 | BufferIndex = 1; | ||
674 | PacketIndex = lp->NextRcvPacketIndex; | 668 | PacketIndex = lp->NextRcvPacketIndex; |
675 | pPacket = (unsigned int *) lp->RcvBuffer[BufferIndex][PacketIndex]; | 669 | pPacket = lp->RcvBuffer[BufferIndex][PacketIndex]; |
676 | rx_status = le32_to_cpu(*pPacket); | 670 | rx_status = le32_to_cpu(*pPacket); |
677 | 671 | ||
678 | /* Process each packet. */ | 672 | /* Process each packet. */ |
@@ -715,51 +709,39 @@ static int lan_saa9730_rx(struct net_device *dev) | |||
715 | lp->stats.rx_errors++; | 709 | lp->stats.rx_errors++; |
716 | if (rx_status & | 710 | if (rx_status & |
717 | (RX_STATUS_CRC_ERR << RX_STAT_CTL_STATUS_SHF)) | 711 | (RX_STATUS_CRC_ERR << RX_STAT_CTL_STATUS_SHF)) |
718 | lp->stats.rx_crc_errors++; | 712 | lp->stats.rx_crc_errors++; |
719 | if (rx_status & | 713 | if (rx_status & |
720 | (RX_STATUS_ALIGN_ERR << | 714 | (RX_STATUS_ALIGN_ERR << RX_STAT_CTL_STATUS_SHF)) |
721 | RX_STAT_CTL_STATUS_SHF)) lp->stats. | 715 | lp->stats.rx_frame_errors++; |
722 | rx_frame_errors++; | ||
723 | if (rx_status & | 716 | if (rx_status & |
724 | (RX_STATUS_OVERFLOW << RX_STAT_CTL_STATUS_SHF)) | 717 | (RX_STATUS_OVERFLOW << RX_STAT_CTL_STATUS_SHF)) |
725 | lp->stats.rx_fifo_errors++; | 718 | lp->stats.rx_fifo_errors++; |
726 | if (rx_status & | 719 | if (rx_status & |
727 | (RX_STATUS_LONG_ERR << RX_STAT_CTL_STATUS_SHF)) | 720 | (RX_STATUS_LONG_ERR << RX_STAT_CTL_STATUS_SHF)) |
728 | lp->stats.rx_length_errors++; | 721 | lp->stats.rx_length_errors++; |
729 | } | 722 | } |
730 | 723 | ||
731 | /* Indicate we have processed the buffer. */ | 724 | /* Indicate we have processed the buffer. */ |
732 | *pPacket = | 725 | *pPacket = cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF); |
733 | cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF); | 726 | |
727 | /* Make sure A or B is available to hardware as appropriate. */ | ||
728 | outl(BufferIndex ? OK2USE_RX_B : OK2USE_RX_A, | ||
729 | &lp->lan_saa9730_regs->Ok2Use); | ||
734 | 730 | ||
735 | /* Go to next packet in sequence. */ | 731 | /* Go to next packet in sequence. */ |
736 | lp->NextRcvPacketIndex++; | 732 | lp->NextRcvPacketIndex++; |
737 | if (lp->NextRcvPacketIndex >= LAN_SAA9730_RCV_Q_SIZE) { | 733 | if (lp->NextRcvPacketIndex >= LAN_SAA9730_RCV_Q_SIZE) { |
738 | lp->NextRcvPacketIndex = 0; | 734 | lp->NextRcvPacketIndex = 0; |
739 | if (BufferIndex) { | 735 | lp->NextRcvBufferIndex ^= 1; |
740 | lp->NextRcvToUseIsA = 1; | ||
741 | } else { | ||
742 | lp->NextRcvToUseIsA = 0; | ||
743 | } | ||
744 | } | 736 | } |
745 | OUTL(OK2USE_RX_A | OK2USE_RX_B, | ||
746 | &lp->lan_saa9730_regs->Ok2Use); | ||
747 | 737 | ||
748 | /* Address next packet */ | 738 | /* Address next packet */ |
749 | if (lp->NextRcvToUseIsA) | 739 | BufferIndex = lp->NextRcvBufferIndex; |
750 | BufferIndex = 0; | ||
751 | else | ||
752 | BufferIndex = 1; | ||
753 | PacketIndex = lp->NextRcvPacketIndex; | 740 | PacketIndex = lp->NextRcvPacketIndex; |
754 | pPacket = | 741 | pPacket = lp->RcvBuffer[BufferIndex][PacketIndex]; |
755 | (unsigned int *) lp-> | ||
756 | RcvBuffer[BufferIndex][PacketIndex]; | ||
757 | rx_status = le32_to_cpu(*pPacket); | 742 | rx_status = le32_to_cpu(*pPacket); |
758 | } | 743 | } |
759 | 744 | ||
760 | /* Make sure A and B are available to hardware. */ | ||
761 | OUTL(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use); | ||
762 | |||
763 | return 0; | 745 | return 0; |
764 | } | 746 | } |
765 | 747 | ||
@@ -767,8 +749,7 @@ static irqreturn_t lan_saa9730_interrupt(const int irq, void *dev_id, | |||
767 | struct pt_regs *regs) | 749 | struct pt_regs *regs) |
768 | { | 750 | { |
769 | struct net_device *dev = (struct net_device *) dev_id; | 751 | struct net_device *dev = (struct net_device *) dev_id; |
770 | struct lan_saa9730_private *lp = | 752 | struct lan_saa9730_private *lp = netdev_priv(dev); |
771 | (struct lan_saa9730_private *) dev->priv; | ||
772 | 753 | ||
773 | if (lan_saa9730_debug > 5) | 754 | if (lan_saa9730_debug > 5) |
774 | printk("lan_saa9730_interrupt\n"); | 755 | printk("lan_saa9730_interrupt\n"); |
@@ -780,11 +761,11 @@ static irqreturn_t lan_saa9730_interrupt(const int irq, void *dev_id, | |||
780 | evm_saa9730_clear_lan_int(lp); | 761 | evm_saa9730_clear_lan_int(lp); |
781 | 762 | ||
782 | /* Service pending transmit interrupts. */ | 763 | /* Service pending transmit interrupts. */ |
783 | if (INL(&lp->lan_saa9730_regs->DmaStatus) & DMA_STATUS_MAC_TX_INT) | 764 | if (readl(&lp->lan_saa9730_regs->DmaStatus) & DMA_STATUS_MAC_TX_INT) |
784 | lan_saa9730_tx(dev); | 765 | lan_saa9730_tx(dev); |
785 | 766 | ||
786 | /* Service pending receive interrupts. */ | 767 | /* Service pending receive interrupts. */ |
787 | if (INL(&lp->lan_saa9730_regs->DmaStatus) & | 768 | if (readl(&lp->lan_saa9730_regs->DmaStatus) & |
788 | (DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | | 769 | (DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | |
789 | DMA_STATUS_RX_TO_INT)) lan_saa9730_rx(dev); | 770 | DMA_STATUS_RX_TO_INT)) lan_saa9730_rx(dev); |
790 | 771 | ||
@@ -794,15 +775,9 @@ static irqreturn_t lan_saa9730_interrupt(const int irq, void *dev_id, | |||
794 | return IRQ_HANDLED; | 775 | return IRQ_HANDLED; |
795 | } | 776 | } |
796 | 777 | ||
797 | static int lan_saa9730_open_fail(struct net_device *dev) | ||
798 | { | ||
799 | return -ENODEV; | ||
800 | } | ||
801 | |||
802 | static int lan_saa9730_open(struct net_device *dev) | 778 | static int lan_saa9730_open(struct net_device *dev) |
803 | { | 779 | { |
804 | struct lan_saa9730_private *lp = | 780 | struct lan_saa9730_private *lp = netdev_priv(dev); |
805 | (struct lan_saa9730_private *) dev->priv; | ||
806 | 781 | ||
807 | /* Associate IRQ with lan_saa9730_interrupt */ | 782 | /* Associate IRQ with lan_saa9730_interrupt */ |
808 | if (request_irq(dev->irq, &lan_saa9730_interrupt, 0, "SAA9730 Eth", | 783 | if (request_irq(dev->irq, &lan_saa9730_interrupt, 0, "SAA9730 Eth", |
@@ -834,15 +809,13 @@ static int lan_saa9730_write(struct lan_saa9730_private *lp, | |||
834 | int PacketIndex; | 809 | int PacketIndex; |
835 | 810 | ||
836 | if (lan_saa9730_debug > 5) | 811 | if (lan_saa9730_debug > 5) |
837 | printk("lan_saa9730_write: skb=%08x\n", | 812 | printk("lan_saa9730_write: skb=%p\n", skb); |
838 | (unsigned int) skb); | ||
839 | 813 | ||
840 | BufferIndex = lp->NextTxmBufferIndex; | 814 | BufferIndex = lp->NextTxmBufferIndex; |
841 | PacketIndex = lp->NextTxmPacketIndex; | 815 | PacketIndex = lp->NextTxmPacketIndex; |
842 | 816 | ||
843 | tx_status = | 817 | tx_status = le32_to_cpu(*(unsigned int *)lp->TxmBuffer[BufferIndex] |
844 | le32_to_cpu(*(unsigned int *) lp-> | 818 | [PacketIndex]); |
845 | TxmBuffer[BufferIndex][PacketIndex]); | ||
846 | if ((tx_status & TX_STAT_CTL_OWNER_MSK) != | 819 | if ((tx_status & TX_STAT_CTL_OWNER_MSK) != |
847 | (TXSF_EMPTY << TX_STAT_CTL_OWNER_SHF)) { | 820 | (TXSF_EMPTY << TX_STAT_CTL_OWNER_SHF)) { |
848 | if (lan_saa9730_debug > 4) | 821 | if (lan_saa9730_debug > 4) |
@@ -858,29 +831,29 @@ static int lan_saa9730_write(struct lan_saa9730_private *lp, | |||
858 | lp->NextTxmBufferIndex ^= 1; | 831 | lp->NextTxmBufferIndex ^= 1; |
859 | } | 832 | } |
860 | 833 | ||
861 | pbPacketData = | 834 | pbPacketData = lp->TxmBuffer[BufferIndex][PacketIndex]; |
862 | (unsigned char *) lp->TxmBuffer[BufferIndex][PacketIndex]; | ||
863 | pbPacketData += 4; | 835 | pbPacketData += 4; |
864 | 836 | ||
865 | /* copy the bits */ | 837 | /* copy the bits */ |
866 | memcpy(pbPacketData, pbData, len); | 838 | memcpy(pbPacketData, pbData, len); |
867 | 839 | ||
868 | /* Set transmit status for hardware */ | 840 | /* Set transmit status for hardware */ |
869 | *(unsigned int *) lp->TxmBuffer[BufferIndex][PacketIndex] = | 841 | *(unsigned int *)lp->TxmBuffer[BufferIndex][PacketIndex] = |
870 | cpu_to_le32((TXSF_READY << TX_STAT_CTL_OWNER_SHF) | | 842 | cpu_to_le32((TXSF_READY << TX_STAT_CTL_OWNER_SHF) | |
871 | (TX_STAT_CTL_INT_AFTER_TX << TX_STAT_CTL_FRAME_SHF) | 843 | (TX_STAT_CTL_INT_AFTER_TX << |
872 | | (len << TX_STAT_CTL_LENGTH_SHF)); | 844 | TX_STAT_CTL_FRAME_SHF) | |
873 | 845 | (len << TX_STAT_CTL_LENGTH_SHF)); | |
874 | /* Set hardware tx buffer. */ | 846 | |
875 | OUTL(OK2USE_TX_A | OK2USE_TX_B, &lp->lan_saa9730_regs->Ok2Use); | 847 | /* Make sure A or B is available to hardware as appropriate. */ |
848 | outl(BufferIndex ? OK2USE_TX_B : OK2USE_TX_A, | ||
849 | &lp->lan_saa9730_regs->Ok2Use); | ||
876 | 850 | ||
877 | return 0; | 851 | return 0; |
878 | } | 852 | } |
879 | 853 | ||
880 | static void lan_saa9730_tx_timeout(struct net_device *dev) | 854 | static void lan_saa9730_tx_timeout(struct net_device *dev) |
881 | { | 855 | { |
882 | struct lan_saa9730_private *lp = | 856 | struct lan_saa9730_private *lp = netdev_priv(dev); |
883 | (struct lan_saa9730_private *) dev->priv; | ||
884 | 857 | ||
885 | /* Transmitter timeout, serious problems */ | 858 | /* Transmitter timeout, serious problems */ |
886 | lp->stats.tx_errors++; | 859 | lp->stats.tx_errors++; |
@@ -889,20 +862,19 @@ static void lan_saa9730_tx_timeout(struct net_device *dev) | |||
889 | lan_saa9730_restart(lp); | 862 | lan_saa9730_restart(lp); |
890 | 863 | ||
891 | dev->trans_start = jiffies; | 864 | dev->trans_start = jiffies; |
892 | netif_start_queue(dev); | 865 | netif_wake_queue(dev); |
893 | } | 866 | } |
894 | 867 | ||
895 | static int lan_saa9730_start_xmit(struct sk_buff *skb, | 868 | static int lan_saa9730_start_xmit(struct sk_buff *skb, |
896 | struct net_device *dev) | 869 | struct net_device *dev) |
897 | { | 870 | { |
898 | struct lan_saa9730_private *lp = | 871 | struct lan_saa9730_private *lp = netdev_priv(dev); |
899 | (struct lan_saa9730_private *) dev->priv; | ||
900 | unsigned long flags; | 872 | unsigned long flags; |
901 | int skblen; | 873 | int skblen; |
902 | int len; | 874 | int len; |
903 | 875 | ||
904 | if (lan_saa9730_debug > 4) | 876 | if (lan_saa9730_debug > 4) |
905 | printk("Send packet: skb=%08x\n", (unsigned int) skb); | 877 | printk("Send packet: skb=%p\n", skb); |
906 | 878 | ||
907 | skblen = skb->len; | 879 | skblen = skb->len; |
908 | 880 | ||
@@ -912,8 +884,7 @@ static int lan_saa9730_start_xmit(struct sk_buff *skb, | |||
912 | 884 | ||
913 | if (lan_saa9730_write(lp, skb, skblen)) { | 885 | if (lan_saa9730_write(lp, skb, skblen)) { |
914 | spin_unlock_irqrestore(&lp->lock, flags); | 886 | spin_unlock_irqrestore(&lp->lock, flags); |
915 | printk("Error when writing packet to controller: skb=%08x\n", | 887 | printk("Error when writing packet to controller: skb=%p\n", skb); |
916 | (unsigned int) skb); | ||
917 | netif_stop_queue(dev); | 888 | netif_stop_queue(dev); |
918 | return -1; | 889 | return -1; |
919 | } | 890 | } |
@@ -922,7 +893,7 @@ static int lan_saa9730_start_xmit(struct sk_buff *skb, | |||
922 | lp->stats.tx_packets++; | 893 | lp->stats.tx_packets++; |
923 | 894 | ||
924 | dev->trans_start = jiffies; | 895 | dev->trans_start = jiffies; |
925 | netif_start_queue(dev); | 896 | netif_wake_queue(dev); |
926 | dev_kfree_skb(skb); | 897 | dev_kfree_skb(skb); |
927 | 898 | ||
928 | spin_unlock_irqrestore(&lp->lock, flags); | 899 | spin_unlock_irqrestore(&lp->lock, flags); |
@@ -932,8 +903,7 @@ static int lan_saa9730_start_xmit(struct sk_buff *skb, | |||
932 | 903 | ||
933 | static int lan_saa9730_close(struct net_device *dev) | 904 | static int lan_saa9730_close(struct net_device *dev) |
934 | { | 905 | { |
935 | struct lan_saa9730_private *lp = | 906 | struct lan_saa9730_private *lp = netdev_priv(dev); |
936 | (struct lan_saa9730_private *) dev->priv; | ||
937 | 907 | ||
938 | if (lan_saa9730_debug > 1) | 908 | if (lan_saa9730_debug > 1) |
939 | printk("lan_saa9730_close:\n"); | 909 | printk("lan_saa9730_close:\n"); |
@@ -955,33 +925,31 @@ static int lan_saa9730_close(struct net_device *dev) | |||
955 | static struct net_device_stats *lan_saa9730_get_stats(struct net_device | 925 | static struct net_device_stats *lan_saa9730_get_stats(struct net_device |
956 | *dev) | 926 | *dev) |
957 | { | 927 | { |
958 | struct lan_saa9730_private *lp = | 928 | struct lan_saa9730_private *lp = netdev_priv(dev); |
959 | (struct lan_saa9730_private *) dev->priv; | ||
960 | 929 | ||
961 | return &lp->stats; | 930 | return &lp->stats; |
962 | } | 931 | } |
963 | 932 | ||
964 | static void lan_saa9730_set_multicast(struct net_device *dev) | 933 | static void lan_saa9730_set_multicast(struct net_device *dev) |
965 | { | 934 | { |
966 | struct lan_saa9730_private *lp = | 935 | struct lan_saa9730_private *lp = netdev_priv(dev); |
967 | (struct lan_saa9730_private *) dev->priv; | ||
968 | 936 | ||
969 | /* Stop the controller */ | 937 | /* Stop the controller */ |
970 | lan_saa9730_stop(lp); | 938 | lan_saa9730_stop(lp); |
971 | 939 | ||
972 | if (dev->flags & IFF_PROMISC) { | 940 | if (dev->flags & IFF_PROMISC) { |
973 | /* accept all packets */ | 941 | /* accept all packets */ |
974 | OUTL(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC | | 942 | outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC | |
975 | CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC, | 943 | CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC, |
976 | &lp->lan_saa9730_regs->CamCtl); | 944 | &lp->lan_saa9730_regs->CamCtl); |
977 | } else { | 945 | } else { |
978 | if (dev->flags & IFF_ALLMULTI) { | 946 | if (dev->flags & IFF_ALLMULTI) { |
979 | /* accept all multicast packets */ | 947 | /* accept all multicast packets */ |
980 | OUTL(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC | | 948 | outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC | |
981 | CAM_CONTROL_BROAD_ACC, | 949 | CAM_CONTROL_BROAD_ACC, |
982 | &lp->lan_saa9730_regs->CamCtl); | 950 | &lp->lan_saa9730_regs->CamCtl); |
983 | } else { | 951 | } else { |
984 | /* | 952 | /* |
985 | * Will handle the multicast stuff later. -carstenl | 953 | * Will handle the multicast stuff later. -carstenl |
986 | */ | 954 | */ |
987 | } | 955 | } |
@@ -993,91 +961,86 @@ static void lan_saa9730_set_multicast(struct net_device *dev) | |||
993 | 961 | ||
994 | static void __devexit saa9730_remove_one(struct pci_dev *pdev) | 962 | static void __devexit saa9730_remove_one(struct pci_dev *pdev) |
995 | { | 963 | { |
996 | struct net_device *dev = pci_get_drvdata(pdev); | 964 | struct net_device *dev = pci_get_drvdata(pdev); |
997 | 965 | struct lan_saa9730_private *lp = netdev_priv(dev); | |
998 | if (dev) { | 966 | |
999 | unregister_netdev(dev); | 967 | if (dev) { |
1000 | kfree(dev->priv); | 968 | unregister_netdev(dev); |
1001 | free_netdev(dev); | 969 | lan_saa9730_free_buffers(pdev, lp); |
1002 | pci_release_regions(pdev); | 970 | iounmap(lp->lan_saa9730_regs); |
1003 | pci_disable_device(pdev); | 971 | iounmap(lp->evm_saa9730_regs); |
1004 | pci_set_drvdata(pdev, NULL); | 972 | free_netdev(dev); |
1005 | } | 973 | pci_release_regions(pdev); |
974 | pci_disable_device(pdev); | ||
975 | pci_set_drvdata(pdev, NULL); | ||
976 | } | ||
1006 | } | 977 | } |
1007 | 978 | ||
1008 | 979 | ||
1009 | static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq) | 980 | static int lan_saa9730_init(struct net_device *dev, struct pci_dev *pdev, |
981 | unsigned long ioaddr, int irq) | ||
1010 | { | 982 | { |
1011 | struct lan_saa9730_private *lp; | 983 | struct lan_saa9730_private *lp = netdev_priv(dev); |
1012 | unsigned char ethernet_addr[6]; | 984 | unsigned char ethernet_addr[6]; |
1013 | int ret = 0; | 985 | int ret; |
1014 | 986 | ||
1015 | dev->open = lan_saa9730_open_fail; | 987 | if (get_ethernet_addr(ethernet_addr)) { |
988 | ret = -ENODEV; | ||
989 | goto out; | ||
990 | } | ||
1016 | 991 | ||
1017 | if (get_ethernet_addr(ethernet_addr)) | ||
1018 | return -ENODEV; | ||
1019 | |||
1020 | memcpy(dev->dev_addr, ethernet_addr, 6); | 992 | memcpy(dev->dev_addr, ethernet_addr, 6); |
1021 | dev->base_addr = ioaddr; | 993 | dev->base_addr = ioaddr; |
1022 | dev->irq = irq; | 994 | dev->irq = irq; |
1023 | |||
1024 | /* | ||
1025 | * Make certain the data structures used by the controller are aligned | ||
1026 | * and DMAble. | ||
1027 | */ | ||
1028 | /* | ||
1029 | * XXX: that is obviously broken - kfree() won't be happy with us. | ||
1030 | */ | ||
1031 | lp = (struct lan_saa9730_private *) (((unsigned long) | ||
1032 | kmalloc(sizeof(*lp) + 7, | ||
1033 | GFP_DMA | GFP_KERNEL) | ||
1034 | + 7) & ~7); | ||
1035 | 995 | ||
1036 | if (!lp) | 996 | lp->pci_dev = pdev; |
1037 | return -ENOMEM; | ||
1038 | |||
1039 | dev->priv = lp; | ||
1040 | memset(lp, 0, sizeof(*lp)); | ||
1041 | 997 | ||
1042 | /* Set SAA9730 LAN base address. */ | 998 | /* Set SAA9730 LAN base address. */ |
1043 | lp->lan_saa9730_regs = (t_lan_saa9730_regmap *) (ioaddr + | 999 | lp->lan_saa9730_regs = ioremap(ioaddr + SAA9730_LAN_REGS_ADDR, |
1044 | SAA9730_LAN_REGS_ADDR); | 1000 | SAA9730_LAN_REGS_SIZE); |
1001 | if (!lp->lan_saa9730_regs) { | ||
1002 | ret = -ENOMEM; | ||
1003 | goto out; | ||
1004 | } | ||
1045 | 1005 | ||
1046 | /* Set SAA9730 EVM base address. */ | 1006 | /* Set SAA9730 EVM base address. */ |
1047 | lp->evm_saa9730_regs = (t_evm_saa9730_regmap *) (ioaddr + | 1007 | lp->evm_saa9730_regs = ioremap(ioaddr + SAA9730_EVM_REGS_ADDR, |
1048 | SAA9730_EVM_REGS_ADDR); | 1008 | SAA9730_EVM_REGS_SIZE); |
1009 | if (!lp->evm_saa9730_regs) { | ||
1010 | ret = -ENOMEM; | ||
1011 | goto out_iounmap_lan; | ||
1012 | } | ||
1049 | 1013 | ||
1050 | /* Allocate LAN RX/TX frame buffer space. */ | 1014 | /* Allocate LAN RX/TX frame buffer space. */ |
1051 | /* FIXME: a leak */ | 1015 | if ((ret = lan_saa9730_allocate_buffers(pdev, lp))) |
1052 | if ((ret = lan_saa9730_allocate_buffers(lp))) | 1016 | goto out_iounmap; |
1053 | goto out; | ||
1054 | 1017 | ||
1055 | /* Stop LAN controller. */ | 1018 | /* Stop LAN controller. */ |
1056 | if ((ret = lan_saa9730_stop(lp))) | 1019 | if ((ret = lan_saa9730_stop(lp))) |
1057 | goto out; | 1020 | goto out_free_consistent; |
1058 | 1021 | ||
1059 | /* Initialize CAM registers. */ | 1022 | /* Initialize CAM registers. */ |
1060 | if ((ret = lan_saa9730_cam_init(dev))) | 1023 | if ((ret = lan_saa9730_cam_init(dev))) |
1061 | goto out; | 1024 | goto out_free_consistent; |
1062 | 1025 | ||
1063 | /* Initialize MII registers. */ | 1026 | /* Initialize MII registers. */ |
1064 | if ((ret = lan_saa9730_mii_init(lp))) | 1027 | if ((ret = lan_saa9730_mii_init(lp))) |
1065 | goto out; | 1028 | goto out_free_consistent; |
1066 | 1029 | ||
1067 | /* Initialize control registers. */ | 1030 | /* Initialize control registers. */ |
1068 | if ((ret = lan_saa9730_control_init(lp))) | 1031 | if ((ret = lan_saa9730_control_init(lp))) |
1069 | goto out; | 1032 | goto out_free_consistent; |
1070 | 1033 | ||
1071 | /* Load CAM registers. */ | 1034 | /* Load CAM registers. */ |
1072 | if ((ret = lan_saa9730_cam_load(lp))) | 1035 | if ((ret = lan_saa9730_cam_load(lp))) |
1073 | goto out; | 1036 | goto out_free_consistent; |
1074 | 1037 | ||
1075 | /* Initialize DMA context registers. */ | 1038 | /* Initialize DMA context registers. */ |
1076 | if ((ret = lan_saa9730_dma_init(lp))) | 1039 | if ((ret = lan_saa9730_dma_init(lp))) |
1077 | goto out; | 1040 | goto out_free_consistent; |
1078 | 1041 | ||
1079 | spin_lock_init(&lp->lock); | 1042 | spin_lock_init(&lp->lock); |
1080 | 1043 | ||
1081 | dev->open = lan_saa9730_open; | 1044 | dev->open = lan_saa9730_open; |
1082 | dev->hard_start_xmit = lan_saa9730_start_xmit; | 1045 | dev->hard_start_xmit = lan_saa9730_start_xmit; |
1083 | dev->stop = lan_saa9730_close; | 1046 | dev->stop = lan_saa9730_close; |
@@ -1086,44 +1049,43 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq) | |||
1086 | dev->tx_timeout = lan_saa9730_tx_timeout; | 1049 | dev->tx_timeout = lan_saa9730_tx_timeout; |
1087 | dev->watchdog_timeo = (HZ >> 1); | 1050 | dev->watchdog_timeo = (HZ >> 1); |
1088 | dev->dma = 0; | 1051 | dev->dma = 0; |
1089 | 1052 | ||
1090 | ret = register_netdev(dev); | 1053 | ret = register_netdev (dev); |
1091 | if (ret) | 1054 | if (ret) |
1092 | goto out; | 1055 | goto out_free_consistent; |
1056 | |||
1093 | return 0; | 1057 | return 0; |
1094 | 1058 | ||
1095 | out: | 1059 | out_free_consistent: |
1096 | kfree(dev->priv); | 1060 | lan_saa9730_free_buffers(pdev, lp); |
1061 | out_iounmap: | ||
1062 | iounmap(lp->evm_saa9730_regs); | ||
1063 | out_iounmap_lan: | ||
1064 | iounmap(lp->lan_saa9730_regs); | ||
1065 | out: | ||
1097 | return ret; | 1066 | return ret; |
1098 | } | 1067 | } |
1099 | 1068 | ||
1100 | 1069 | ||
1101 | static int __devinit saa9730_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 1070 | static int __devinit saa9730_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1102 | { | 1071 | { |
1103 | struct net_device *dev; | 1072 | struct net_device *dev = NULL; |
1104 | unsigned int pci_ioaddr; | 1073 | unsigned long pci_ioaddr; |
1105 | int err; | 1074 | int err; |
1106 | 1075 | ||
1107 | if (lan_saa9730_debug > 1) | 1076 | if (lan_saa9730_debug > 1) |
1108 | printk("saa9730.c: PCI bios is present, checking for devices...\n"); | 1077 | printk("saa9730.c: PCI bios is present, checking for devices...\n"); |
1109 | 1078 | ||
1110 | err = -ENOMEM; | ||
1111 | dev = alloc_etherdev(0); | ||
1112 | if (!dev) | ||
1113 | goto out; | ||
1114 | |||
1115 | SET_MODULE_OWNER(dev); | ||
1116 | |||
1117 | err = pci_enable_device(pdev); | 1079 | err = pci_enable_device(pdev); |
1118 | if (err) { | 1080 | if (err) { |
1119 | printk(KERN_ERR "Cannot enable PCI device, aborting.\n"); | 1081 | printk(KERN_ERR "Cannot enable PCI device, aborting.\n"); |
1120 | goto out1; | 1082 | goto out; |
1121 | } | 1083 | } |
1122 | 1084 | ||
1123 | err = pci_request_regions(pdev, DRV_MODULE_NAME); | 1085 | err = pci_request_regions(pdev, DRV_MODULE_NAME); |
1124 | if (err) { | 1086 | if (err) { |
1125 | printk(KERN_ERR "Cannot obtain PCI resources, aborting.\n"); | 1087 | printk(KERN_ERR "Cannot obtain PCI resources, aborting.\n"); |
1126 | goto out2; | 1088 | goto out_disable_pdev; |
1127 | } | 1089 | } |
1128 | 1090 | ||
1129 | pci_irq_line = pdev->irq; | 1091 | pci_irq_line = pdev->irq; |
@@ -1132,49 +1094,54 @@ static int __devinit saa9730_init_one(struct pci_dev *pdev, const struct pci_dev | |||
1132 | pci_ioaddr = pci_resource_start(pdev, 1); | 1094 | pci_ioaddr = pci_resource_start(pdev, 1); |
1133 | pci_set_master(pdev); | 1095 | pci_set_master(pdev); |
1134 | 1096 | ||
1135 | printk("Found SAA9730 (PCI) at %#x, irq %d.\n", | 1097 | printk("Found SAA9730 (PCI) at %lx, irq %d.\n", |
1136 | pci_ioaddr, pci_irq_line); | 1098 | pci_ioaddr, pci_irq_line); |
1137 | 1099 | ||
1138 | err = lan_saa9730_init(dev, pci_ioaddr, pci_irq_line); | 1100 | dev = alloc_etherdev(sizeof(struct lan_saa9730_private)); |
1101 | if (!dev) | ||
1102 | goto out_disable_pdev; | ||
1103 | |||
1104 | err = lan_saa9730_init(dev, pdev, pci_ioaddr, pci_irq_line); | ||
1139 | if (err) { | 1105 | if (err) { |
1140 | printk("Lan init failed"); | 1106 | printk("LAN init failed"); |
1141 | goto out2; | 1107 | goto out_free_netdev; |
1142 | } | 1108 | } |
1143 | 1109 | ||
1144 | pci_set_drvdata(pdev, dev); | 1110 | pci_set_drvdata(pdev, dev); |
1145 | SET_NETDEV_DEV(dev, &pdev->dev); | 1111 | SET_NETDEV_DEV(dev, &pdev->dev); |
1146 | return 0; | 1112 | return 0; |
1147 | 1113 | ||
1148 | out2: | 1114 | out_free_netdev: |
1149 | pci_disable_device(pdev); | ||
1150 | out1: | ||
1151 | free_netdev(dev); | 1115 | free_netdev(dev); |
1116 | out_disable_pdev: | ||
1117 | pci_disable_device(pdev); | ||
1152 | out: | 1118 | out: |
1119 | pci_set_drvdata(pdev, NULL); | ||
1153 | return err; | 1120 | return err; |
1154 | } | 1121 | } |
1155 | 1122 | ||
1156 | 1123 | ||
1157 | static struct pci_driver saa9730_driver = { | 1124 | static struct pci_driver saa9730_driver = { |
1158 | .name = DRV_MODULE_NAME, | 1125 | .name = DRV_MODULE_NAME, |
1159 | .id_table = saa9730_pci_tbl, | 1126 | .id_table = saa9730_pci_tbl, |
1160 | .probe = saa9730_init_one, | 1127 | .probe = saa9730_init_one, |
1161 | .remove = __devexit_p(saa9730_remove_one), | 1128 | .remove = __devexit_p(saa9730_remove_one), |
1162 | }; | 1129 | }; |
1163 | 1130 | ||
1164 | 1131 | ||
1165 | static int __init saa9730_init(void) | 1132 | static int __init saa9730_init(void) |
1166 | { | 1133 | { |
1167 | return pci_module_init(&saa9730_driver); | 1134 | return pci_module_init(&saa9730_driver); |
1168 | } | 1135 | } |
1169 | 1136 | ||
1170 | static void __exit saa9730_cleanup(void) | 1137 | static void __exit saa9730_cleanup(void) |
1171 | { | 1138 | { |
1172 | pci_unregister_driver(&saa9730_driver); | 1139 | pci_unregister_driver(&saa9730_driver); |
1173 | } | 1140 | } |
1174 | 1141 | ||
1175 | module_init(saa9730_init); | 1142 | module_init(saa9730_init); |
1176 | module_exit(saa9730_cleanup); | 1143 | module_exit(saa9730_cleanup); |
1177 | 1144 | ||
1178 | 1145 | MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>"); | |
1179 | 1146 | MODULE_DESCRIPTION("Philips SAA9730 ethernet driver"); | |
1180 | MODULE_LICENSE("GPL"); | 1147 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 74d5f1a6fdea..c91e2e81f131 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -2183,9 +2183,8 @@ static void smc_release_datacs(struct platform_device *pdev, struct net_device * | |||
2183 | * 0 --> there is a device | 2183 | * 0 --> there is a device |
2184 | * anything else, error | 2184 | * anything else, error |
2185 | */ | 2185 | */ |
2186 | static int smc_drv_probe(struct device *dev) | 2186 | static int smc_drv_probe(struct platform_device *pdev) |
2187 | { | 2187 | { |
2188 | struct platform_device *pdev = to_platform_device(dev); | ||
2189 | struct net_device *ndev; | 2188 | struct net_device *ndev; |
2190 | struct resource *res; | 2189 | struct resource *res; |
2191 | unsigned int __iomem *addr; | 2190 | unsigned int __iomem *addr; |
@@ -2212,7 +2211,7 @@ static int smc_drv_probe(struct device *dev) | |||
2212 | goto out_release_io; | 2211 | goto out_release_io; |
2213 | } | 2212 | } |
2214 | SET_MODULE_OWNER(ndev); | 2213 | SET_MODULE_OWNER(ndev); |
2215 | SET_NETDEV_DEV(ndev, dev); | 2214 | SET_NETDEV_DEV(ndev, &pdev->dev); |
2216 | 2215 | ||
2217 | ndev->dma = (unsigned char)-1; | 2216 | ndev->dma = (unsigned char)-1; |
2218 | ndev->irq = platform_get_irq(pdev, 0); | 2217 | ndev->irq = platform_get_irq(pdev, 0); |
@@ -2233,7 +2232,7 @@ static int smc_drv_probe(struct device *dev) | |||
2233 | goto out_release_attrib; | 2232 | goto out_release_attrib; |
2234 | } | 2233 | } |
2235 | 2234 | ||
2236 | dev_set_drvdata(dev, ndev); | 2235 | platform_set_drvdata(pdev, ndev); |
2237 | ret = smc_probe(ndev, addr); | 2236 | ret = smc_probe(ndev, addr); |
2238 | if (ret != 0) | 2237 | if (ret != 0) |
2239 | goto out_iounmap; | 2238 | goto out_iounmap; |
@@ -2249,7 +2248,7 @@ static int smc_drv_probe(struct device *dev) | |||
2249 | return 0; | 2248 | return 0; |
2250 | 2249 | ||
2251 | out_iounmap: | 2250 | out_iounmap: |
2252 | dev_set_drvdata(dev, NULL); | 2251 | platform_set_drvdata(pdev, NULL); |
2253 | iounmap(addr); | 2252 | iounmap(addr); |
2254 | out_release_attrib: | 2253 | out_release_attrib: |
2255 | smc_release_attrib(pdev); | 2254 | smc_release_attrib(pdev); |
@@ -2263,14 +2262,13 @@ static int smc_drv_probe(struct device *dev) | |||
2263 | return ret; | 2262 | return ret; |
2264 | } | 2263 | } |
2265 | 2264 | ||
2266 | static int smc_drv_remove(struct device *dev) | 2265 | static int smc_drv_remove(struct platform_device *pdev) |
2267 | { | 2266 | { |
2268 | struct platform_device *pdev = to_platform_device(dev); | 2267 | struct net_device *ndev = platform_get_drvdata(pdev); |
2269 | struct net_device *ndev = dev_get_drvdata(dev); | ||
2270 | struct smc_local *lp = netdev_priv(ndev); | 2268 | struct smc_local *lp = netdev_priv(ndev); |
2271 | struct resource *res; | 2269 | struct resource *res; |
2272 | 2270 | ||
2273 | dev_set_drvdata(dev, NULL); | 2271 | platform_set_drvdata(pdev, NULL); |
2274 | 2272 | ||
2275 | unregister_netdev(ndev); | 2273 | unregister_netdev(ndev); |
2276 | 2274 | ||
@@ -2295,9 +2293,9 @@ static int smc_drv_remove(struct device *dev) | |||
2295 | return 0; | 2293 | return 0; |
2296 | } | 2294 | } |
2297 | 2295 | ||
2298 | static int smc_drv_suspend(struct device *dev, pm_message_t state) | 2296 | static int smc_drv_suspend(struct platform_device *dev, pm_message_t state) |
2299 | { | 2297 | { |
2300 | struct net_device *ndev = dev_get_drvdata(dev); | 2298 | struct net_device *ndev = platform_get_drvdata(dev); |
2301 | 2299 | ||
2302 | if (ndev) { | 2300 | if (ndev) { |
2303 | if (netif_running(ndev)) { | 2301 | if (netif_running(ndev)) { |
@@ -2309,14 +2307,13 @@ static int smc_drv_suspend(struct device *dev, pm_message_t state) | |||
2309 | return 0; | 2307 | return 0; |
2310 | } | 2308 | } |
2311 | 2309 | ||
2312 | static int smc_drv_resume(struct device *dev) | 2310 | static int smc_drv_resume(struct platform_device *dev) |
2313 | { | 2311 | { |
2314 | struct platform_device *pdev = to_platform_device(dev); | 2312 | struct net_device *ndev = platform_get_drvdata(dev); |
2315 | struct net_device *ndev = dev_get_drvdata(dev); | ||
2316 | 2313 | ||
2317 | if (ndev) { | 2314 | if (ndev) { |
2318 | struct smc_local *lp = netdev_priv(ndev); | 2315 | struct smc_local *lp = netdev_priv(ndev); |
2319 | smc_enable_device(pdev); | 2316 | smc_enable_device(dev); |
2320 | if (netif_running(ndev)) { | 2317 | if (netif_running(ndev)) { |
2321 | smc_reset(ndev); | 2318 | smc_reset(ndev); |
2322 | smc_enable(ndev); | 2319 | smc_enable(ndev); |
@@ -2328,13 +2325,14 @@ static int smc_drv_resume(struct device *dev) | |||
2328 | return 0; | 2325 | return 0; |
2329 | } | 2326 | } |
2330 | 2327 | ||
2331 | static struct device_driver smc_driver = { | 2328 | static struct platform_driver smc_driver = { |
2332 | .name = CARDNAME, | ||
2333 | .bus = &platform_bus_type, | ||
2334 | .probe = smc_drv_probe, | 2329 | .probe = smc_drv_probe, |
2335 | .remove = smc_drv_remove, | 2330 | .remove = smc_drv_remove, |
2336 | .suspend = smc_drv_suspend, | 2331 | .suspend = smc_drv_suspend, |
2337 | .resume = smc_drv_resume, | 2332 | .resume = smc_drv_resume, |
2333 | .driver = { | ||
2334 | .name = CARDNAME, | ||
2335 | }, | ||
2338 | }; | 2336 | }; |
2339 | 2337 | ||
2340 | static int __init smc_init(void) | 2338 | static int __init smc_init(void) |
@@ -2348,12 +2346,12 @@ static int __init smc_init(void) | |||
2348 | #endif | 2346 | #endif |
2349 | #endif | 2347 | #endif |
2350 | 2348 | ||
2351 | return driver_register(&smc_driver); | 2349 | return platform_driver_register(&smc_driver); |
2352 | } | 2350 | } |
2353 | 2351 | ||
2354 | static void __exit smc_cleanup(void) | 2352 | static void __exit smc_cleanup(void) |
2355 | { | 2353 | { |
2356 | driver_unregister(&smc_driver); | 2354 | platform_driver_unregister(&smc_driver); |
2357 | } | 2355 | } |
2358 | 2356 | ||
2359 | module_init(smc_init); | 2357 | module_init(smc_init); |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 817f200742c3..a10cd184d597 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -289,6 +289,38 @@ static inline void SMC_outsw (unsigned long a, int r, unsigned char* p, int l) | |||
289 | #define RPC_LSA_DEFAULT RPC_LED_TX_RX | 289 | #define RPC_LSA_DEFAULT RPC_LED_TX_RX |
290 | #define RPC_LSB_DEFAULT RPC_LED_100_10 | 290 | #define RPC_LSB_DEFAULT RPC_LED_100_10 |
291 | 291 | ||
292 | #elif defined(CONFIG_SOC_AU1X00) | ||
293 | |||
294 | #include <au1xxx.h> | ||
295 | |||
296 | /* We can only do 16-bit reads and writes in the static memory space. */ | ||
297 | #define SMC_CAN_USE_8BIT 0 | ||
298 | #define SMC_CAN_USE_16BIT 1 | ||
299 | #define SMC_CAN_USE_32BIT 0 | ||
300 | #define SMC_IO_SHIFT 0 | ||
301 | #define SMC_NOWAIT 1 | ||
302 | |||
303 | #define SMC_inw(a, r) au_readw((unsigned long)((a) + (r))) | ||
304 | #define SMC_insw(a, r, p, l) \ | ||
305 | do { \ | ||
306 | unsigned long _a = (unsigned long)((a) + (r)); \ | ||
307 | int _l = (l); \ | ||
308 | u16 *_p = (u16 *)(p); \ | ||
309 | while (_l-- > 0) \ | ||
310 | *_p++ = au_readw(_a); \ | ||
311 | } while(0) | ||
312 | #define SMC_outw(v, a, r) au_writew(v, (unsigned long)((a) + (r))) | ||
313 | #define SMC_outsw(a, r, p, l) \ | ||
314 | do { \ | ||
315 | unsigned long _a = (unsigned long)((a) + (r)); \ | ||
316 | int _l = (l); \ | ||
317 | const u16 *_p = (const u16 *)(p); \ | ||
318 | while (_l-- > 0) \ | ||
319 | au_writew(*_p++ , _a); \ | ||
320 | } while(0) | ||
321 | |||
322 | #define set_irq_type(irq, type) do {} while (0) | ||
323 | |||
292 | #else | 324 | #else |
293 | 325 | ||
294 | #define SMC_CAN_USE_8BIT 1 | 326 | #define SMC_CAN_USE_8BIT 1 |
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index c796f41b4a52..0d765f1733b5 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
@@ -2290,7 +2290,6 @@ spider_net_remove(struct pci_dev *pdev) | |||
2290 | } | 2290 | } |
2291 | 2291 | ||
2292 | static struct pci_driver spider_net_driver = { | 2292 | static struct pci_driver spider_net_driver = { |
2293 | .owner = THIS_MODULE, | ||
2294 | .name = spider_net_driver_name, | 2293 | .name = spider_net_driver_name, |
2295 | .id_table = spider_net_pci_tbl, | 2294 | .id_table = spider_net_pci_tbl, |
2296 | .probe = spider_net_probe, | 2295 | .probe = spider_net_probe, |
diff --git a/drivers/net/tokenring/proteon.c b/drivers/net/tokenring/proteon.c index d04c918ebef8..4f756960db2a 100644 --- a/drivers/net/tokenring/proteon.c +++ b/drivers/net/tokenring/proteon.c | |||
@@ -344,9 +344,10 @@ module_param_array(dma, int, NULL, 0); | |||
344 | 344 | ||
345 | static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS]; | 345 | static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS]; |
346 | 346 | ||
347 | static struct device_driver proteon_driver = { | 347 | static struct platform_driver proteon_driver = { |
348 | .name = "proteon", | 348 | .driver = { |
349 | .bus = &platform_bus_type, | 349 | .name = "proteon", |
350 | }, | ||
350 | }; | 351 | }; |
351 | 352 | ||
352 | static int __init proteon_init(void) | 353 | static int __init proteon_init(void) |
@@ -355,7 +356,7 @@ static int __init proteon_init(void) | |||
355 | struct platform_device *pdev; | 356 | struct platform_device *pdev; |
356 | int i, num = 0, err = 0; | 357 | int i, num = 0, err = 0; |
357 | 358 | ||
358 | err = driver_register(&proteon_driver); | 359 | err = platform_driver_register(&proteon_driver); |
359 | if (err) | 360 | if (err) |
360 | return err; | 361 | return err; |
361 | 362 | ||
@@ -372,7 +373,7 @@ static int __init proteon_init(void) | |||
372 | err = setup_card(dev, &pdev->dev); | 373 | err = setup_card(dev, &pdev->dev); |
373 | if (!err) { | 374 | if (!err) { |
374 | proteon_dev[i] = pdev; | 375 | proteon_dev[i] = pdev; |
375 | dev_set_drvdata(&pdev->dev, dev); | 376 | platform_set_drvdata(pdev, dev); |
376 | ++num; | 377 | ++num; |
377 | } else { | 378 | } else { |
378 | platform_device_unregister(pdev); | 379 | platform_device_unregister(pdev); |
@@ -399,17 +400,17 @@ static void __exit proteon_cleanup(void) | |||
399 | 400 | ||
400 | if (!pdev) | 401 | if (!pdev) |
401 | continue; | 402 | continue; |
402 | dev = dev_get_drvdata(&pdev->dev); | 403 | dev = platform_get_drvdata(pdev); |
403 | unregister_netdev(dev); | 404 | unregister_netdev(dev); |
404 | release_region(dev->base_addr, PROTEON_IO_EXTENT); | 405 | release_region(dev->base_addr, PROTEON_IO_EXTENT); |
405 | free_irq(dev->irq, dev); | 406 | free_irq(dev->irq, dev); |
406 | free_dma(dev->dma); | 407 | free_dma(dev->dma); |
407 | tmsdev_term(dev); | 408 | tmsdev_term(dev); |
408 | free_netdev(dev); | 409 | free_netdev(dev); |
409 | dev_set_drvdata(&pdev->dev, NULL); | 410 | platform_set_drvdata(pdev, NULL); |
410 | platform_device_unregister(pdev); | 411 | platform_device_unregister(pdev); |
411 | } | 412 | } |
412 | driver_unregister(&proteon_driver); | 413 | platform_driver_unregister(&proteon_driver); |
413 | } | 414 | } |
414 | 415 | ||
415 | module_init(proteon_init); | 416 | module_init(proteon_init); |
diff --git a/drivers/net/tokenring/skisa.c b/drivers/net/tokenring/skisa.c index 72cf708396be..d6ba41cf3110 100644 --- a/drivers/net/tokenring/skisa.c +++ b/drivers/net/tokenring/skisa.c | |||
@@ -354,9 +354,10 @@ module_param_array(dma, int, NULL, 0); | |||
354 | 354 | ||
355 | static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS]; | 355 | static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS]; |
356 | 356 | ||
357 | static struct device_driver sk_isa_driver = { | 357 | static struct platform_driver sk_isa_driver = { |
358 | .name = "skisa", | 358 | .driver = { |
359 | .bus = &platform_bus_type, | 359 | .name = "skisa", |
360 | }, | ||
360 | }; | 361 | }; |
361 | 362 | ||
362 | static int __init sk_isa_init(void) | 363 | static int __init sk_isa_init(void) |
@@ -365,7 +366,7 @@ static int __init sk_isa_init(void) | |||
365 | struct platform_device *pdev; | 366 | struct platform_device *pdev; |
366 | int i, num = 0, err = 0; | 367 | int i, num = 0, err = 0; |
367 | 368 | ||
368 | err = driver_register(&sk_isa_driver); | 369 | err = platform_driver_register(&sk_isa_driver); |
369 | if (err) | 370 | if (err) |
370 | return err; | 371 | return err; |
371 | 372 | ||
@@ -382,7 +383,7 @@ static int __init sk_isa_init(void) | |||
382 | err = setup_card(dev, &pdev->dev); | 383 | err = setup_card(dev, &pdev->dev); |
383 | if (!err) { | 384 | if (!err) { |
384 | sk_isa_dev[i] = pdev; | 385 | sk_isa_dev[i] = pdev; |
385 | dev_set_drvdata(&sk_isa_dev[i]->dev, dev); | 386 | platform_set_drvdata(sk_isa_dev[i], dev); |
386 | ++num; | 387 | ++num; |
387 | } else { | 388 | } else { |
388 | platform_device_unregister(pdev); | 389 | platform_device_unregister(pdev); |
@@ -409,17 +410,17 @@ static void __exit sk_isa_cleanup(void) | |||
409 | 410 | ||
410 | if (!pdev) | 411 | if (!pdev) |
411 | continue; | 412 | continue; |
412 | dev = dev_get_drvdata(&pdev->dev); | 413 | dev = platform_get_drvdata(pdev); |
413 | unregister_netdev(dev); | 414 | unregister_netdev(dev); |
414 | release_region(dev->base_addr, SK_ISA_IO_EXTENT); | 415 | release_region(dev->base_addr, SK_ISA_IO_EXTENT); |
415 | free_irq(dev->irq, dev); | 416 | free_irq(dev->irq, dev); |
416 | free_dma(dev->dma); | 417 | free_dma(dev->dma); |
417 | tmsdev_term(dev); | 418 | tmsdev_term(dev); |
418 | free_netdev(dev); | 419 | free_netdev(dev); |
419 | dev_set_drvdata(&pdev->dev, NULL); | 420 | platform_set_drvdata(pdev, NULL); |
420 | platform_device_unregister(pdev); | 421 | platform_device_unregister(pdev); |
421 | } | 422 | } |
422 | driver_unregister(&sk_isa_driver); | 423 | platform_driver_unregister(&sk_isa_driver); |
423 | } | 424 | } |
424 | 425 | ||
425 | module_init(sk_isa_init); | 426 | module_init(sk_isa_init); |
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 7187958e40ca..00e55165b760 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -330,7 +330,7 @@ config PCI_HERMES | |||
330 | 330 | ||
331 | config ATMEL | 331 | config ATMEL |
332 | tristate "Atmel at76c50x chipset 802.11b support" | 332 | tristate "Atmel at76c50x chipset 802.11b support" |
333 | depends on NET_RADIO && EXPERIMENTAL | 333 | depends on NET_RADIO |
334 | select FW_LOADER | 334 | select FW_LOADER |
335 | select CRC32 | 335 | select CRC32 |
336 | ---help--- | 336 | ---help--- |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index a3e23527fe7f..5e53c5258a33 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -72,7 +72,7 @@ | |||
72 | #include "atmel.h" | 72 | #include "atmel.h" |
73 | 73 | ||
74 | #define DRIVER_MAJOR 0 | 74 | #define DRIVER_MAJOR 0 |
75 | #define DRIVER_MINOR 96 | 75 | #define DRIVER_MINOR 98 |
76 | 76 | ||
77 | MODULE_AUTHOR("Simon Kelley"); | 77 | MODULE_AUTHOR("Simon Kelley"); |
78 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); | 78 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); |
@@ -1504,7 +1504,7 @@ static int atmel_read_proc(char *page, char **start, off_t off, | |||
1504 | return len; | 1504 | return len; |
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWType fw_type, | 1507 | struct net_device *init_atmel_card( unsigned short irq, unsigned long port, const AtmelFWType fw_type, |
1508 | struct device *sys_dev, int (*card_present)(void *), void *card) | 1508 | struct device *sys_dev, int (*card_present)(void *), void *card) |
1509 | { | 1509 | { |
1510 | struct net_device *dev; | 1510 | struct net_device *dev; |
@@ -1605,8 +1605,8 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT | |||
1605 | goto err_out_free; | 1605 | goto err_out_free; |
1606 | } | 1606 | } |
1607 | 1607 | ||
1608 | if (priv->bus_type == BUS_TYPE_PCI && | 1608 | if (!request_region(dev->base_addr, 32, |
1609 | !request_region( dev->base_addr, 64, dev->name )) { | 1609 | priv->bus_type == BUS_TYPE_PCCARD ? "atmel_cs" : "atmel_pci")) { |
1610 | goto err_out_irq; | 1610 | goto err_out_irq; |
1611 | } | 1611 | } |
1612 | 1612 | ||
@@ -1622,15 +1622,16 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT | |||
1622 | 1622 | ||
1623 | create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); | 1623 | create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); |
1624 | 1624 | ||
1625 | printk(KERN_INFO "%s: Atmel at76c50x wireless. Version %d.%d simon@thekelleys.org.uk\n", | 1625 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", |
1626 | dev->name, DRIVER_MAJOR, DRIVER_MINOR); | 1626 | dev->name, DRIVER_MAJOR, DRIVER_MINOR, |
1627 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], | ||
1628 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] ); | ||
1627 | 1629 | ||
1628 | SET_MODULE_OWNER(dev); | 1630 | SET_MODULE_OWNER(dev); |
1629 | return dev; | 1631 | return dev; |
1630 | 1632 | ||
1631 | err_out_res: | 1633 | err_out_res: |
1632 | if (priv->bus_type == BUS_TYPE_PCI) | 1634 | release_region( dev->base_addr, 32); |
1633 | release_region( dev->base_addr, 64 ); | ||
1634 | err_out_irq: | 1635 | err_out_irq: |
1635 | free_irq(dev->irq, dev); | 1636 | free_irq(dev->irq, dev); |
1636 | err_out_free: | 1637 | err_out_free: |
@@ -1640,7 +1641,7 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT | |||
1640 | 1641 | ||
1641 | EXPORT_SYMBOL(init_atmel_card); | 1642 | EXPORT_SYMBOL(init_atmel_card); |
1642 | 1643 | ||
1643 | void stop_atmel_card(struct net_device *dev, int freeres) | 1644 | void stop_atmel_card(struct net_device *dev) |
1644 | { | 1645 | { |
1645 | struct atmel_private *priv = netdev_priv(dev); | 1646 | struct atmel_private *priv = netdev_priv(dev); |
1646 | 1647 | ||
@@ -1654,10 +1655,7 @@ void stop_atmel_card(struct net_device *dev, int freeres) | |||
1654 | remove_proc_entry("driver/atmel", NULL); | 1655 | remove_proc_entry("driver/atmel", NULL); |
1655 | free_irq(dev->irq, dev); | 1656 | free_irq(dev->irq, dev); |
1656 | kfree(priv->firmware); | 1657 | kfree(priv->firmware); |
1657 | if (freeres) { | 1658 | release_region(dev->base_addr, 32); |
1658 | /* PCMCIA frees this stuff, so only for PCI */ | ||
1659 | release_region(dev->base_addr, 64); | ||
1660 | } | ||
1661 | free_netdev(dev); | 1659 | free_netdev(dev); |
1662 | } | 1660 | } |
1663 | 1661 | ||
@@ -1810,9 +1808,9 @@ static int atmel_set_encode(struct net_device *dev, | |||
1810 | } | 1808 | } |
1811 | if(dwrq->flags & IW_ENCODE_RESTRICTED) | 1809 | if(dwrq->flags & IW_ENCODE_RESTRICTED) |
1812 | priv->exclude_unencrypted = 1; | 1810 | priv->exclude_unencrypted = 1; |
1813 | if(dwrq->flags & IW_ENCODE_OPEN) | 1811 | if(dwrq->flags & IW_ENCODE_OPEN) |
1814 | priv->exclude_unencrypted = 0; | 1812 | priv->exclude_unencrypted = 0; |
1815 | 1813 | ||
1816 | return -EINPROGRESS; /* Call commit handler */ | 1814 | return -EINPROGRESS; /* Call commit handler */ |
1817 | } | 1815 | } |
1818 | 1816 | ||
@@ -1827,11 +1825,12 @@ static int atmel_get_encode(struct net_device *dev, | |||
1827 | 1825 | ||
1828 | if (!priv->wep_is_on) | 1826 | if (!priv->wep_is_on) |
1829 | dwrq->flags = IW_ENCODE_DISABLED; | 1827 | dwrq->flags = IW_ENCODE_DISABLED; |
1830 | else if (priv->exclude_unencrypted) | 1828 | else { |
1831 | dwrq->flags = IW_ENCODE_RESTRICTED; | 1829 | if (priv->exclude_unencrypted) |
1832 | else | 1830 | dwrq->flags = IW_ENCODE_RESTRICTED; |
1833 | dwrq->flags = IW_ENCODE_OPEN; | 1831 | else |
1834 | 1832 | dwrq->flags = IW_ENCODE_OPEN; | |
1833 | } | ||
1835 | /* Which key do we want ? -1 -> tx index */ | 1834 | /* Which key do we want ? -1 -> tx index */ |
1836 | if (index < 0 || index >= 4) | 1835 | if (index < 0 || index >= 4) |
1837 | index = priv->default_key; | 1836 | index = priv->default_key; |
@@ -2645,8 +2644,8 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 c | |||
2645 | } | 2644 | } |
2646 | } | 2645 | } |
2647 | 2646 | ||
2648 | 2647 | ||
2649 | static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len) | 2648 | static void send_authentication_request(struct atmel_private *priv, u16 system, u8 *challenge, int challenge_len) |
2650 | { | 2649 | { |
2651 | struct ieee80211_hdr_4addr header; | 2650 | struct ieee80211_hdr_4addr header; |
2652 | struct auth_body auth; | 2651 | struct auth_body auth; |
@@ -2658,14 +2657,11 @@ static void send_authentication_request(struct atmel_private *priv, u8 *challeng | |||
2658 | memcpy(header.addr2, priv->dev->dev_addr, 6); | 2657 | memcpy(header.addr2, priv->dev->dev_addr, 6); |
2659 | memcpy(header.addr3, priv->CurrentBSSID, 6); | 2658 | memcpy(header.addr3, priv->CurrentBSSID, 6); |
2660 | 2659 | ||
2661 | if (priv->wep_is_on) { | 2660 | if (priv->wep_is_on && priv->CurrentAuthentTransactionSeqNum != 1) |
2662 | auth.alg = cpu_to_le16(C80211_MGMT_AAN_SHAREDKEY); | ||
2663 | /* no WEP for authentication frames with TrSeqNo 1 */ | 2661 | /* no WEP for authentication frames with TrSeqNo 1 */ |
2664 | if (priv->CurrentAuthentTransactionSeqNum != 1) | 2662 | header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
2665 | header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | 2663 | |
2666 | } else { | 2664 | auth.alg = cpu_to_le16(system); |
2667 | auth.alg = cpu_to_le16(C80211_MGMT_AAN_OPENSYSTEM); | ||
2668 | } | ||
2669 | 2665 | ||
2670 | auth.status = 0; | 2666 | auth.status = 0; |
2671 | auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); | 2667 | auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); |
@@ -2834,6 +2830,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2834 | struct auth_body *auth = (struct auth_body *)priv->rx_buf; | 2830 | struct auth_body *auth = (struct auth_body *)priv->rx_buf; |
2835 | u16 status = le16_to_cpu(auth->status); | 2831 | u16 status = le16_to_cpu(auth->status); |
2836 | u16 trans_seq_no = le16_to_cpu(auth->trans_seq); | 2832 | u16 trans_seq_no = le16_to_cpu(auth->trans_seq); |
2833 | u16 system = le16_to_cpu(auth->alg); | ||
2837 | 2834 | ||
2838 | if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { | 2835 | if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { |
2839 | /* no WEP */ | 2836 | /* no WEP */ |
@@ -2855,7 +2852,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2855 | 2852 | ||
2856 | if (trans_seq_no == 0x0002 && | 2853 | if (trans_seq_no == 0x0002 && |
2857 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { | 2854 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { |
2858 | send_authentication_request(priv, auth->chall_text, auth->chall_text_len); | 2855 | send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); |
2859 | return; | 2856 | return; |
2860 | } | 2857 | } |
2861 | 2858 | ||
@@ -2872,14 +2869,20 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2872 | } | 2869 | } |
2873 | } | 2870 | } |
2874 | 2871 | ||
2875 | if (status == C80211_MGMT_SC_AuthAlgNotSupported && priv->connect_to_any_BSS) { | 2872 | if (status == C80211_MGMT_SC_AuthAlgNotSupported) { |
2876 | int bss_index; | 2873 | /* Do opensystem first, then try sharedkey */ |
2877 | 2874 | if (system == C80211_MGMT_AAN_OPENSYSTEM) { | |
2878 | priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; | 2875 | priv->CurrentAuthentTransactionSeqNum = 0x001; |
2879 | 2876 | send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); | |
2880 | if ((bss_index = retrieve_bss(priv)) != -1) { | 2877 | } else if (priv->connect_to_any_BSS) { |
2881 | atmel_join_bss(priv, bss_index); | 2878 | int bss_index; |
2882 | return; | 2879 | |
2880 | priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; | ||
2881 | |||
2882 | if ((bss_index = retrieve_bss(priv)) != -1) { | ||
2883 | atmel_join_bss(priv, bss_index); | ||
2884 | return; | ||
2885 | } | ||
2883 | } | 2886 | } |
2884 | } | 2887 | } |
2885 | 2888 | ||
@@ -3205,7 +3208,7 @@ static void atmel_management_timer(u_long a) | |||
3205 | priv->AuthenticationRequestRetryCnt++; | 3208 | priv->AuthenticationRequestRetryCnt++; |
3206 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3209 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
3207 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3210 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
3208 | send_authentication_request(priv, NULL, 0); | 3211 | send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0); |
3209 | } | 3212 | } |
3210 | 3213 | ||
3211 | break; | 3214 | break; |
@@ -3312,7 +3315,7 @@ static void atmel_command_irq(struct atmel_private *priv) | |||
3312 | 3315 | ||
3313 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3316 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
3314 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3317 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
3315 | send_authentication_request(priv, NULL, 0); | 3318 | send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); |
3316 | } | 3319 | } |
3317 | return; | 3320 | return; |
3318 | } | 3321 | } |
@@ -3482,11 +3485,6 @@ static int probe_atmel_card(struct net_device *dev) | |||
3482 | printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); | 3485 | printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); |
3483 | memcpy(dev->dev_addr, default_mac, 6); | 3486 | memcpy(dev->dev_addr, default_mac, 6); |
3484 | } | 3487 | } |
3485 | printk(KERN_INFO "%s: MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", | ||
3486 | dev->name, | ||
3487 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], | ||
3488 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] ); | ||
3489 | |||
3490 | } | 3488 | } |
3491 | 3489 | ||
3492 | return rc; | 3490 | return rc; |
diff --git a/drivers/net/wireless/atmel.h b/drivers/net/wireless/atmel.h index 825000edfc2c..b9b3e5b76544 100644 --- a/drivers/net/wireless/atmel.h +++ b/drivers/net/wireless/atmel.h | |||
@@ -35,9 +35,9 @@ typedef enum { | |||
35 | ATMEL_FW_TYPE_506 | 35 | ATMEL_FW_TYPE_506 |
36 | } AtmelFWType; | 36 | } AtmelFWType; |
37 | 37 | ||
38 | struct net_device *init_atmel_card(unsigned short, int, const AtmelFWType, struct device *, | 38 | struct net_device *init_atmel_card(unsigned short, unsigned long, const AtmelFWType, struct device *, |
39 | int (*present_func)(void *), void * ); | 39 | int (*present_func)(void *), void * ); |
40 | void stop_atmel_card( struct net_device *, int ); | 40 | void stop_atmel_card( struct net_device *); |
41 | int atmel_open( struct net_device * ); | 41 | int atmel_open( struct net_device * ); |
42 | 42 | ||
43 | #endif | 43 | #endif |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 1bd13146c644..17d1fd90f832 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -63,6 +63,7 @@ | |||
63 | be present but disabled -- but it can then be enabled for specific | 63 | be present but disabled -- but it can then be enabled for specific |
64 | modules at load time with a 'pc_debug=#' option to insmod. | 64 | modules at load time with a 'pc_debug=#' option to insmod. |
65 | */ | 65 | */ |
66 | |||
66 | #ifdef PCMCIA_DEBUG | 67 | #ifdef PCMCIA_DEBUG |
67 | static int pc_debug = PCMCIA_DEBUG; | 68 | static int pc_debug = PCMCIA_DEBUG; |
68 | module_param(pc_debug, int, 0); | 69 | module_param(pc_debug, int, 0); |
@@ -285,41 +286,6 @@ static int card_present(void *arg) | |||
285 | return 0; | 286 | return 0; |
286 | } | 287 | } |
287 | 288 | ||
288 | /* list of cards we know about and their firmware requirements. | ||
289 | Go either by Manfid or version strings. | ||
290 | Cards not in this list will need a firmware parameter to the module | ||
291 | in all probability. Note that the SMC 2632 V2 and V3 have the same | ||
292 | manfids, so we ignore those and use the version1 strings. */ | ||
293 | |||
294 | static struct { | ||
295 | int manf, card; | ||
296 | char *ver1; | ||
297 | AtmelFWType firmware; | ||
298 | char *name; | ||
299 | } card_table[] = { | ||
300 | { 0, 0, "WLAN/802.11b PC CARD", ATMEL_FW_TYPE_502D, "Actiontec 802CAT1" }, | ||
301 | { 0, 0, "ATMEL/AT76C502AR", ATMEL_FW_TYPE_502, "NoName-RFMD" }, | ||
302 | { 0, 0, "ATMEL/AT76C502AR_D", ATMEL_FW_TYPE_502D, "NoName-revD" }, | ||
303 | { 0, 0, "ATMEL/AT76C502AR_E", ATMEL_FW_TYPE_502E, "NoName-revE" }, | ||
304 | { 0, 0, "ATMEL/AT76C504", ATMEL_FW_TYPE_504, "NoName-504" }, | ||
305 | { 0, 0, "ATMEL/AT76C504A", ATMEL_FW_TYPE_504A_2958, "NoName-504a-2958" }, | ||
306 | { 0, 0, "ATMEL/AT76C504_R", ATMEL_FW_TYPE_504_2958, "NoName-504-2958" }, | ||
307 | { MANFID_3COM, 0x0620, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRWE62092B" }, | ||
308 | { MANFID_3COM, 0x0696, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRSHPW196" }, | ||
309 | { 0, 0, "SMC/2632W-V2", ATMEL_FW_TYPE_502, "SMC 2632W-V2" }, | ||
310 | { 0, 0, "SMC/2632W", ATMEL_FW_TYPE_502D, "SMC 2632W-V3" }, | ||
311 | { 0xd601, 0x0007, NULL, ATMEL_FW_TYPE_502, "Sitecom WLAN-011" }, | ||
312 | { 0x01bf, 0x3302, NULL, ATMEL_FW_TYPE_502E, "Belkin F5D6020-V2" }, | ||
313 | { 0, 0, "BT/Voyager 1020 Laptop Adapter", ATMEL_FW_TYPE_502, "BT Voyager 1020" }, | ||
314 | { 0, 0, "IEEE 802.11b/Wireless LAN PC Card", ATMEL_FW_TYPE_502, "Siemens Gigaset PC Card II" }, | ||
315 | { 0, 0, "IEEE 802.11b/Wireless LAN Card S", ATMEL_FW_TYPE_504_2958, "Siemens Gigaset PC Card II" }, | ||
316 | { 0, 0, "CNet/CNWLC 11Mbps Wireless PC Card V-5", ATMEL_FW_TYPE_502E, "CNet CNWLC-811ARL" }, | ||
317 | { 0, 0, "Wireless/PC_CARD", ATMEL_FW_TYPE_502D, "Planet WL-3552" }, | ||
318 | { 0, 0, "OEM/11Mbps Wireless LAN PC Card V-3", ATMEL_FW_TYPE_502, "OEM 11Mbps WLAN PCMCIA Card" }, | ||
319 | { 0, 0, "11WAVE/11WP611AL-E", ATMEL_FW_TYPE_502E, "11WAVE WaveBuddy" }, | ||
320 | { 0, 0, "LG/LW2100N", ATMEL_FW_TYPE_502E, "LG LW2100N 11Mbps WLAN PCMCIA Card" }, | ||
321 | }; | ||
322 | |||
323 | static void atmel_config(dev_link_t *link) | 289 | static void atmel_config(dev_link_t *link) |
324 | { | 290 | { |
325 | client_handle_t handle; | 291 | client_handle_t handle; |
@@ -328,10 +294,11 @@ static void atmel_config(dev_link_t *link) | |||
328 | local_info_t *dev; | 294 | local_info_t *dev; |
329 | int last_fn, last_ret; | 295 | int last_fn, last_ret; |
330 | u_char buf[64]; | 296 | u_char buf[64]; |
331 | int card_index = -1, done = 0; | 297 | struct pcmcia_device_id *did; |
332 | 298 | ||
333 | handle = link->handle; | 299 | handle = link->handle; |
334 | dev = link->priv; | 300 | dev = link->priv; |
301 | did = handle_to_dev(handle).driver_data; | ||
335 | 302 | ||
336 | DEBUG(0, "atmel_config(0x%p)\n", link); | 303 | DEBUG(0, "atmel_config(0x%p)\n", link); |
337 | 304 | ||
@@ -340,59 +307,6 @@ static void atmel_config(dev_link_t *link) | |||
340 | tuple.TupleDataMax = sizeof(buf); | 307 | tuple.TupleDataMax = sizeof(buf); |
341 | tuple.TupleOffset = 0; | 308 | tuple.TupleOffset = 0; |
342 | 309 | ||
343 | tuple.DesiredTuple = CISTPL_MANFID; | ||
344 | if (pcmcia_get_first_tuple(handle, &tuple) == 0) { | ||
345 | int i; | ||
346 | cistpl_manfid_t *manfid; | ||
347 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
348 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | ||
349 | manfid = &(parse.manfid); | ||
350 | for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) { | ||
351 | if (!card_table[i].ver1 && | ||
352 | manfid->manf == card_table[i].manf && | ||
353 | manfid->card == card_table[i].card) { | ||
354 | card_index = i; | ||
355 | done = 1; | ||
356 | } | ||
357 | } | ||
358 | } | ||
359 | |||
360 | tuple.DesiredTuple = CISTPL_VERS_1; | ||
361 | if (!done && (pcmcia_get_first_tuple(handle, &tuple) == 0)) { | ||
362 | int i, j, k; | ||
363 | cistpl_vers_1_t *ver1; | ||
364 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
365 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | ||
366 | ver1 = &(parse.version_1); | ||
367 | |||
368 | for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) { | ||
369 | for (j = 0; j < ver1->ns; j++) { | ||
370 | char *p = card_table[i].ver1; | ||
371 | char *q = &ver1->str[ver1->ofs[j]]; | ||
372 | if (!p) | ||
373 | goto mismatch; | ||
374 | for (k = 0; k < j; k++) { | ||
375 | while ((*p != '\0') && (*p != '/')) p++; | ||
376 | if (*p == '\0') { | ||
377 | if (*q != '\0') | ||
378 | goto mismatch; | ||
379 | } else { | ||
380 | p++; | ||
381 | } | ||
382 | } | ||
383 | while((*q != '\0') && (*p != '\0') && | ||
384 | (*p != '/') && (*p == *q)) p++, q++; | ||
385 | if (((*p != '\0') && *p != '/') || *q != '\0') | ||
386 | goto mismatch; | ||
387 | } | ||
388 | card_index = i; | ||
389 | break; /* done */ | ||
390 | |||
391 | mismatch: | ||
392 | j = 0; /* dummy stmt to shut up compiler */ | ||
393 | } | ||
394 | } | ||
395 | |||
396 | /* | 310 | /* |
397 | This reads the card's CONFIG tuple to find its configuration | 311 | This reads the card's CONFIG tuple to find its configuration |
398 | registers. | 312 | registers. |
@@ -509,12 +423,13 @@ static void atmel_config(dev_link_t *link) | |||
509 | ((local_info_t*)link->priv)->eth_dev = | 423 | ((local_info_t*)link->priv)->eth_dev = |
510 | init_atmel_card(link->irq.AssignedIRQ, | 424 | init_atmel_card(link->irq.AssignedIRQ, |
511 | link->io.BasePort1, | 425 | link->io.BasePort1, |
512 | card_index == -1 ? ATMEL_FW_TYPE_NONE : card_table[card_index].firmware, | 426 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, |
513 | &handle_to_dev(handle), | 427 | &handle_to_dev(handle), |
514 | card_present, | 428 | card_present, |
515 | link); | 429 | link); |
516 | if (!((local_info_t*)link->priv)->eth_dev) | 430 | if (!((local_info_t*)link->priv)->eth_dev) |
517 | goto cs_failed; | 431 | goto cs_failed; |
432 | |||
518 | 433 | ||
519 | /* | 434 | /* |
520 | At this point, the dev_node_t structure(s) need to be | 435 | At this point, the dev_node_t structure(s) need to be |
@@ -523,26 +438,7 @@ static void atmel_config(dev_link_t *link) | |||
523 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); | 438 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); |
524 | dev->node.major = dev->node.minor = 0; | 439 | dev->node.major = dev->node.minor = 0; |
525 | link->dev = &dev->node; | 440 | link->dev = &dev->node; |
526 | 441 | ||
527 | /* Finally, report what we've done */ | ||
528 | printk(KERN_INFO "%s: %s%sindex 0x%02x: Vcc %d.%d", | ||
529 | dev->node.dev_name, | ||
530 | card_index == -1 ? "" : card_table[card_index].name, | ||
531 | card_index == -1 ? "" : " ", | ||
532 | link->conf.ConfigIndex, | ||
533 | link->conf.Vcc/10, link->conf.Vcc%10); | ||
534 | if (link->conf.Vpp1) | ||
535 | printk(", Vpp %d.%d", link->conf.Vpp1/10, link->conf.Vpp1%10); | ||
536 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | ||
537 | printk(", irq %d", link->irq.AssignedIRQ); | ||
538 | if (link->io.NumPorts1) | ||
539 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | ||
540 | link->io.BasePort1+link->io.NumPorts1-1); | ||
541 | if (link->io.NumPorts2) | ||
542 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
543 | link->io.BasePort2+link->io.NumPorts2-1); | ||
544 | printk("\n"); | ||
545 | |||
546 | link->state &= ~DEV_CONFIG_PENDING; | 442 | link->state &= ~DEV_CONFIG_PENDING; |
547 | return; | 443 | return; |
548 | 444 | ||
@@ -569,7 +465,7 @@ static void atmel_release(dev_link_t *link) | |||
569 | link->dev = NULL; | 465 | link->dev = NULL; |
570 | 466 | ||
571 | if (dev) | 467 | if (dev) |
572 | stop_atmel_card(dev, 0); | 468 | stop_atmel_card(dev); |
573 | ((local_info_t*)link->priv)->eth_dev = NULL; | 469 | ((local_info_t*)link->priv)->eth_dev = NULL; |
574 | 470 | ||
575 | /* Don't bother checking to see if these succeed or not */ | 471 | /* Don't bother checking to see if these succeed or not */ |
@@ -637,25 +533,47 @@ static int atmel_event(event_t event, int priority, | |||
637 | } /* atmel_event */ | 533 | } /* atmel_event */ |
638 | 534 | ||
639 | /*====================================================================*/ | 535 | /*====================================================================*/ |
536 | /* We use the driver_info field to store the correct firmware type for a card. */ | ||
537 | |||
538 | #define PCMCIA_DEVICE_MANF_CARD_INFO(manf, card, info) { \ | ||
539 | .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ | ||
540 | PCMCIA_DEV_ID_MATCH_CARD_ID, \ | ||
541 | .manf_id = (manf), \ | ||
542 | .card_id = (card), \ | ||
543 | .driver_info = (kernel_ulong_t)(info), } | ||
544 | |||
545 | #define PCMCIA_DEVICE_PROD_ID12_INFO(v1, v2, vh1, vh2, info) { \ | ||
546 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
547 | PCMCIA_DEV_ID_MATCH_PROD_ID2, \ | ||
548 | .prod_id = { (v1), (v2), NULL, NULL }, \ | ||
549 | .prod_id_hash = { (vh1), (vh2), 0, 0 }, \ | ||
550 | .driver_info = (kernel_ulong_t)(info), } | ||
551 | |||
640 | static struct pcmcia_device_id atmel_ids[] = { | 552 | static struct pcmcia_device_id atmel_ids[] = { |
641 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0620), | 553 | PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0620, ATMEL_FW_TYPE_502_3COM), |
642 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0696), | 554 | PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0696, ATMEL_FW_TYPE_502_3COM), |
643 | PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x3302), | 555 | PCMCIA_DEVICE_MANF_CARD_INFO(0x01bf, 0x3302, ATMEL_FW_TYPE_502E), |
644 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0007), | 556 | PCMCIA_DEVICE_MANF_CARD_INFO(0xd601, 0x0007, ATMEL_FW_TYPE_502), |
645 | PCMCIA_DEVICE_PROD_ID12("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9), | 557 | PCMCIA_DEVICE_PROD_ID12_INFO("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9, ATMEL_FW_TYPE_502E), |
646 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f), | 558 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f, ATMEL_FW_TYPE_502), |
647 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504", 0xabda4164, 0x5040670a), | 559 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_D", 0xabda4164, 0x3675d704, ATMEL_FW_TYPE_502D), |
648 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f), | 560 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_E", 0xabda4164, 0x4172e792, ATMEL_FW_TYPE_502E), |
649 | PCMCIA_DEVICE_PROD_ID12("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5), | 561 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504_R", 0xabda4164, 0x917f3d72, ATMEL_FW_TYPE_504_2958), |
650 | PCMCIA_DEVICE_PROD_ID12("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b), | 562 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504", 0xabda4164, 0x5040670a, ATMEL_FW_TYPE_504), |
651 | PCMCIA_DEVICE_PROD_ID12("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6), | 563 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f, ATMEL_FW_TYPE_504A_2958), |
652 | PCMCIA_DEVICE_PROD_ID12("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68), | 564 | PCMCIA_DEVICE_PROD_ID12_INFO("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5, ATMEL_FW_TYPE_502), |
653 | PCMCIA_DEVICE_PROD_ID12("SMC", "2632W", 0xc4f8b18b, 0x30f38774), | 565 | PCMCIA_DEVICE_PROD_ID12_INFO("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b, ATMEL_FW_TYPE_502E), |
654 | PCMCIA_DEVICE_PROD_ID12("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377), | 566 | PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6, ATMEL_FW_TYPE_502), |
655 | PCMCIA_DEVICE_PROD_ID12("Wireless", "PC", 0xa407ecdd, 0x556e4d7e), | 567 | PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN Card S", 0x5b878724, 0x5fba533a, ATMEL_FW_TYPE_504_2958), |
656 | PCMCIA_DEVICE_PROD_ID12("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4), | 568 | PCMCIA_DEVICE_PROD_ID12_INFO("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68, ATMEL_FW_TYPE_502), |
569 | PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W", 0xc4f8b18b, 0x30f38774, ATMEL_FW_TYPE_502D), | ||
570 | PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377, ATMEL_FW_TYPE_502), | ||
571 | PCMCIA_DEVICE_PROD_ID12_INFO("Wireless", "PC_CARD", 0xa407ecdd, 0x119f6314, ATMEL_FW_TYPE_502D), | ||
572 | PCMCIA_DEVICE_PROD_ID12_INFO("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4, ATMEL_FW_TYPE_502D), | ||
573 | PCMCIA_DEVICE_PROD_ID12_INFO("LG", "LW2100N", 0xb474d43a, 0x6b1fec94, ATMEL_FW_TYPE_502E), | ||
657 | PCMCIA_DEVICE_NULL | 574 | PCMCIA_DEVICE_NULL |
658 | }; | 575 | }; |
576 | |||
659 | MODULE_DEVICE_TABLE(pcmcia, atmel_ids); | 577 | MODULE_DEVICE_TABLE(pcmcia, atmel_ids); |
660 | 578 | ||
661 | static struct pcmcia_driver atmel_driver = { | 579 | static struct pcmcia_driver atmel_driver = { |
diff --git a/drivers/net/wireless/atmel_pci.c b/drivers/net/wireless/atmel_pci.c index 2eb00a957bbe..a61b3bc6cccf 100644 --- a/drivers/net/wireless/atmel_pci.c +++ b/drivers/net/wireless/atmel_pci.c | |||
@@ -72,7 +72,7 @@ static int __devinit atmel_pci_probe(struct pci_dev *pdev, | |||
72 | 72 | ||
73 | static void __devexit atmel_pci_remove(struct pci_dev *pdev) | 73 | static void __devexit atmel_pci_remove(struct pci_dev *pdev) |
74 | { | 74 | { |
75 | stop_atmel_card(pci_get_drvdata(pdev), 1); | 75 | stop_atmel_card(pci_get_drvdata(pdev)); |
76 | } | 76 | } |
77 | 77 | ||
78 | static int __init atmel_init_module(void) | 78 | static int __init atmel_init_module(void) |
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index 2a42add7f563..ea16805a153c 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -2,6 +2,8 @@ | |||
2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
3 | #include <linux/ioport.h> | 3 | #include <linux/ioport.h> |
4 | 4 | ||
5 | #include "pci.h" | ||
6 | |||
5 | /* | 7 | /* |
6 | * This interrupt-safe spinlock protects all accesses to PCI | 8 | * This interrupt-safe spinlock protects all accesses to PCI |
7 | * configuration space. | 9 | * configuration space. |
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 061ead21ef14..c42b68d3aa24 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -32,8 +32,6 @@ | |||
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <asm/semaphore.h> | ||
36 | #include <asm/io.h> | ||
37 | #include <linux/pcieport_if.h> | 35 | #include <linux/pcieport_if.h> |
38 | #include "pci_hotplug.h" | 36 | #include "pci_hotplug.h" |
39 | 37 | ||
@@ -42,6 +40,7 @@ | |||
42 | extern int pciehp_poll_mode; | 40 | extern int pciehp_poll_mode; |
43 | extern int pciehp_poll_time; | 41 | extern int pciehp_poll_time; |
44 | extern int pciehp_debug; | 42 | extern int pciehp_debug; |
43 | extern int pciehp_force; | ||
45 | 44 | ||
46 | /*#define dbg(format, arg...) do { if (pciehp_debug) printk(KERN_DEBUG "%s: " format, MY_NAME , ## arg); } while (0)*/ | 45 | /*#define dbg(format, arg...) do { if (pciehp_debug) printk(KERN_DEBUG "%s: " format, MY_NAME , ## arg); } while (0)*/ |
47 | #define dbg(format, arg...) do { if (pciehp_debug) printk("%s: " format, MY_NAME , ## arg); } while (0) | 46 | #define dbg(format, arg...) do { if (pciehp_debug) printk("%s: " format, MY_NAME , ## arg); } while (0) |
@@ -49,39 +48,20 @@ extern int pciehp_debug; | |||
49 | #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg) | 48 | #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg) |
50 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) | 49 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) |
51 | 50 | ||
52 | struct pci_func { | 51 | struct hotplug_params { |
53 | struct pci_func *next; | 52 | u8 cache_line_size; |
54 | u8 bus; | 53 | u8 latency_timer; |
55 | u8 device; | 54 | u8 enable_serr; |
56 | u8 function; | 55 | u8 enable_perr; |
57 | u8 is_a_board; | ||
58 | u16 status; | ||
59 | u8 configured; | ||
60 | u8 switch_save; | ||
61 | u8 presence_save; | ||
62 | u32 base_length[0x06]; | ||
63 | u8 base_type[0x06]; | ||
64 | u16 reserved2; | ||
65 | u32 config_space[0x20]; | ||
66 | struct pci_resource *mem_head; | ||
67 | struct pci_resource *p_mem_head; | ||
68 | struct pci_resource *io_head; | ||
69 | struct pci_resource *bus_head; | ||
70 | struct pci_dev* pci_dev; | ||
71 | }; | 56 | }; |
72 | 57 | ||
73 | struct slot { | 58 | struct slot { |
74 | struct slot *next; | 59 | struct slot *next; |
75 | u8 bus; | 60 | u8 bus; |
76 | u8 device; | 61 | u8 device; |
62 | u16 status; | ||
77 | u32 number; | 63 | u32 number; |
78 | u8 is_a_board; | ||
79 | u8 configured; | ||
80 | u8 state; | 64 | u8 state; |
81 | u8 switch_save; | ||
82 | u8 presence_save; | ||
83 | u32 capabilities; | ||
84 | u16 reserved2; | ||
85 | struct timer_list task_event; | 65 | struct timer_list task_event; |
86 | u8 hp_slot; | 66 | u8 hp_slot; |
87 | struct controller *ctrl; | 67 | struct controller *ctrl; |
@@ -90,42 +70,47 @@ struct slot { | |||
90 | struct list_head slot_list; | 70 | struct list_head slot_list; |
91 | }; | 71 | }; |
92 | 72 | ||
93 | struct pci_resource { | ||
94 | struct pci_resource * next; | ||
95 | u32 base; | ||
96 | u32 length; | ||
97 | }; | ||
98 | |||
99 | struct event_info { | 73 | struct event_info { |
100 | u32 event_type; | 74 | u32 event_type; |
101 | u8 hp_slot; | 75 | u8 hp_slot; |
102 | }; | 76 | }; |
103 | 77 | ||
78 | typedef u8(*php_intr_callback_t) (u8 hp_slot, void *instance_id); | ||
79 | |||
80 | struct php_ctlr_state_s { | ||
81 | struct php_ctlr_state_s *pnext; | ||
82 | struct pci_dev *pci_dev; | ||
83 | unsigned int irq; | ||
84 | unsigned long flags; /* spinlock's */ | ||
85 | u32 slot_device_offset; | ||
86 | u32 num_slots; | ||
87 | struct timer_list int_poll_timer; /* Added for poll event */ | ||
88 | php_intr_callback_t attention_button_callback; | ||
89 | php_intr_callback_t switch_change_callback; | ||
90 | php_intr_callback_t presence_change_callback; | ||
91 | php_intr_callback_t power_fault_callback; | ||
92 | void *callback_instance_id; | ||
93 | struct ctrl_reg *creg; /* Ptr to controller register space */ | ||
94 | }; | ||
95 | |||
96 | #define MAX_EVENTS 10 | ||
104 | struct controller { | 97 | struct controller { |
105 | struct controller *next; | 98 | struct controller *next; |
106 | struct semaphore crit_sect; /* critical section semaphore */ | 99 | struct semaphore crit_sect; /* critical section semaphore */ |
107 | void *hpc_ctlr_handle; /* HPC controller handle */ | 100 | struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */ |
108 | int num_slots; /* Number of slots on ctlr */ | 101 | int num_slots; /* Number of slots on ctlr */ |
109 | int slot_num_inc; /* 1 or -1 */ | 102 | int slot_num_inc; /* 1 or -1 */ |
110 | struct pci_resource *mem_head; | ||
111 | struct pci_resource *p_mem_head; | ||
112 | struct pci_resource *io_head; | ||
113 | struct pci_resource *bus_head; | ||
114 | struct pci_dev *pci_dev; | 103 | struct pci_dev *pci_dev; |
115 | struct pci_bus *pci_bus; | 104 | struct pci_bus *pci_bus; |
116 | struct event_info event_queue[10]; | 105 | struct event_info event_queue[MAX_EVENTS]; |
117 | struct slot *slot; | 106 | struct slot *slot; |
118 | struct hpc_ops *hpc_ops; | 107 | struct hpc_ops *hpc_ops; |
119 | wait_queue_head_t queue; /* sleep & wake process */ | 108 | wait_queue_head_t queue; /* sleep & wake process */ |
120 | u8 next_event; | 109 | u8 next_event; |
121 | u8 seg; | ||
122 | u8 bus; | 110 | u8 bus; |
123 | u8 device; | 111 | u8 device; |
124 | u8 function; | 112 | u8 function; |
125 | u8 rev; | ||
126 | u8 slot_device_offset; | 113 | u8 slot_device_offset; |
127 | u8 add_support; | ||
128 | enum pci_bus_speed speed; | ||
129 | u32 first_slot; /* First physical slot number */ /* PCIE only has 1 slot */ | 114 | u32 first_slot; /* First physical slot number */ /* PCIE only has 1 slot */ |
130 | u8 slot_bus; /* Bus where the slots handled by this controller sit */ | 115 | u8 slot_bus; /* Bus where the slots handled by this controller sit */ |
131 | u8 ctrlcap; | 116 | u8 ctrlcap; |
@@ -133,20 +118,6 @@ struct controller { | |||
133 | u8 cap_base; | 118 | u8 cap_base; |
134 | }; | 119 | }; |
135 | 120 | ||
136 | struct irq_mapping { | ||
137 | u8 barber_pole; | ||
138 | u8 valid_INT; | ||
139 | u8 interrupt[4]; | ||
140 | }; | ||
141 | |||
142 | struct resource_lists { | ||
143 | struct pci_resource *mem_head; | ||
144 | struct pci_resource *p_mem_head; | ||
145 | struct pci_resource *io_head; | ||
146 | struct pci_resource *bus_head; | ||
147 | struct irq_mapping *irqs; | ||
148 | }; | ||
149 | |||
150 | #define INT_BUTTON_IGNORE 0 | 121 | #define INT_BUTTON_IGNORE 0 |
151 | #define INT_PRESENCE_ON 1 | 122 | #define INT_PRESENCE_ON 1 |
152 | #define INT_PRESENCE_OFF 2 | 123 | #define INT_PRESENCE_OFF 2 |
@@ -200,21 +171,14 @@ struct resource_lists { | |||
200 | * error Messages | 171 | * error Messages |
201 | */ | 172 | */ |
202 | #define msg_initialization_err "Initialization failure, error=%d\n" | 173 | #define msg_initialization_err "Initialization failure, error=%d\n" |
203 | #define msg_HPC_rev_error "Unsupported revision of the PCI hot plug controller found.\n" | ||
204 | #define msg_HPC_non_pcie "The PCI hot plug controller is not supported by this driver.\n" | ||
205 | #define msg_HPC_not_supported "This system is not supported by this version of pciephd module. Upgrade to a newer version of pciehpd\n" | ||
206 | #define msg_unable_to_save "Unable to store PCI hot plug add resource information. This system must be rebooted before adding any PCI devices.\n" | ||
207 | #define msg_button_on "PCI slot #%d - powering on due to button press.\n" | 174 | #define msg_button_on "PCI slot #%d - powering on due to button press.\n" |
208 | #define msg_button_off "PCI slot #%d - powering off due to button press.\n" | 175 | #define msg_button_off "PCI slot #%d - powering off due to button press.\n" |
209 | #define msg_button_cancel "PCI slot #%d - action canceled due to button press.\n" | 176 | #define msg_button_cancel "PCI slot #%d - action canceled due to button press.\n" |
210 | #define msg_button_ignore "PCI slot #%d - button press ignored. (action in progress...)\n" | 177 | #define msg_button_ignore "PCI slot #%d - button press ignored. (action in progress...)\n" |
211 | 178 | ||
212 | /* controller functions */ | 179 | /* controller functions */ |
213 | extern int pciehprm_find_available_resources (struct controller *ctrl); | ||
214 | extern int pciehp_event_start_thread (void); | 180 | extern int pciehp_event_start_thread (void); |
215 | extern void pciehp_event_stop_thread (void); | 181 | extern void pciehp_event_stop_thread (void); |
216 | extern struct pci_func *pciehp_slot_create (unsigned char busnumber); | ||
217 | extern struct pci_func *pciehp_slot_find (unsigned char bus, unsigned char device, unsigned char index); | ||
218 | extern int pciehp_enable_slot (struct slot *slot); | 182 | extern int pciehp_enable_slot (struct slot *slot); |
219 | extern int pciehp_disable_slot (struct slot *slot); | 183 | extern int pciehp_disable_slot (struct slot *slot); |
220 | 184 | ||
@@ -224,25 +188,17 @@ extern u8 pciehp_handle_presence_change (u8 hp_slot, void *inst_id); | |||
224 | extern u8 pciehp_handle_power_fault (u8 hp_slot, void *inst_id); | 188 | extern u8 pciehp_handle_power_fault (u8 hp_slot, void *inst_id); |
225 | /* extern void long_delay (int delay); */ | 189 | /* extern void long_delay (int delay); */ |
226 | 190 | ||
227 | /* resource functions */ | ||
228 | extern int pciehp_resource_sort_and_combine (struct pci_resource **head); | ||
229 | |||
230 | /* pci functions */ | 191 | /* pci functions */ |
231 | extern int pciehp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num); | 192 | extern int pciehp_configure_device (struct slot *p_slot); |
232 | /*extern int pciehp_get_bus_dev (struct controller *ctrl, u8 *bus_num, u8 *dev_num, struct slot *slot);*/ | 193 | extern int pciehp_unconfigure_device (struct slot *p_slot); |
233 | extern int pciehp_save_config (struct controller *ctrl, int busnumber, int num_ctlr_slots, int first_device_num); | 194 | extern int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev); |
234 | extern int pciehp_save_used_resources (struct controller *ctrl, struct pci_func * func, int flag); | 195 | extern void pciehp_get_hp_params_from_firmware(struct pci_dev *dev, |
235 | extern int pciehp_save_slot_config (struct controller *ctrl, struct pci_func * new_slot); | 196 | struct hotplug_params *hpp); |
236 | extern void pciehp_destroy_board_resources (struct pci_func * func); | 197 | |
237 | extern int pciehp_return_board_resources (struct pci_func * func, struct resource_lists * resources); | ||
238 | extern void pciehp_destroy_resource_list (struct resource_lists * resources); | ||
239 | extern int pciehp_configure_device (struct controller* ctrl, struct pci_func* func); | ||
240 | extern int pciehp_unconfigure_device (struct pci_func* func); | ||
241 | 198 | ||
242 | 199 | ||
243 | /* Global variables */ | 200 | /* Global variables */ |
244 | extern struct controller *pciehp_ctrl_list; | 201 | extern struct controller *pciehp_ctrl_list; |
245 | extern struct pci_func *pciehp_slot_list[256]; | ||
246 | 202 | ||
247 | /* Inline functions */ | 203 | /* Inline functions */ |
248 | 204 | ||
@@ -252,12 +208,9 @@ static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) | |||
252 | 208 | ||
253 | p_slot = ctrl->slot; | 209 | p_slot = ctrl->slot; |
254 | 210 | ||
255 | dbg("p_slot = %p\n", p_slot); | ||
256 | |||
257 | while (p_slot && (p_slot->device != device)) { | 211 | while (p_slot && (p_slot->device != device)) { |
258 | tmp_slot = p_slot; | 212 | tmp_slot = p_slot; |
259 | p_slot = p_slot->next; | 213 | p_slot = p_slot->next; |
260 | dbg("In while loop, p_slot = %p\n", p_slot); | ||
261 | } | 214 | } |
262 | if (p_slot == NULL) { | 215 | if (p_slot == NULL) { |
263 | err("ERROR: pciehp_find_slot device=0x%x\n", device); | 216 | err("ERROR: pciehp_find_slot device=0x%x\n", device); |
@@ -273,7 +226,6 @@ static inline int wait_for_ctrl_irq(struct controller *ctrl) | |||
273 | 226 | ||
274 | DECLARE_WAITQUEUE(wait, current); | 227 | DECLARE_WAITQUEUE(wait, current); |
275 | 228 | ||
276 | dbg("%s : start\n", __FUNCTION__); | ||
277 | add_wait_queue(&ctrl->queue, &wait); | 229 | add_wait_queue(&ctrl->queue, &wait); |
278 | if (!pciehp_poll_mode) | 230 | if (!pciehp_poll_mode) |
279 | /* Sleep for up to 1 second */ | 231 | /* Sleep for up to 1 second */ |
@@ -285,19 +237,9 @@ static inline int wait_for_ctrl_irq(struct controller *ctrl) | |||
285 | if (signal_pending(current)) | 237 | if (signal_pending(current)) |
286 | retval = -EINTR; | 238 | retval = -EINTR; |
287 | 239 | ||
288 | dbg("%s : end\n", __FUNCTION__); | ||
289 | return retval; | 240 | return retval; |
290 | } | 241 | } |
291 | 242 | ||
292 | /* Puts node back in the resource list pointed to by head */ | ||
293 | static inline void return_resource(struct pci_resource **head, struct pci_resource *node) | ||
294 | { | ||
295 | if (!node || !head) | ||
296 | return; | ||
297 | node->next = *head; | ||
298 | *head = node; | ||
299 | } | ||
300 | |||
301 | #define SLOT_NAME_SIZE 10 | 243 | #define SLOT_NAME_SIZE 10 |
302 | 244 | ||
303 | static inline void make_slot_name(char *buffer, int buffer_size, struct slot *slot) | 245 | static inline void make_slot_name(char *buffer, int buffer_size, struct slot *slot) |
@@ -311,14 +253,7 @@ enum php_ctlr_type { | |||
311 | ACPI | 253 | ACPI |
312 | }; | 254 | }; |
313 | 255 | ||
314 | typedef u8(*php_intr_callback_t) (unsigned int change_id, void *instance_id); | 256 | int pcie_init(struct controller *ctrl, struct pcie_device *dev); |
315 | |||
316 | int pcie_init(struct controller *ctrl, struct pcie_device *dev, | ||
317 | php_intr_callback_t attention_button_callback, | ||
318 | php_intr_callback_t switch_change_callback, | ||
319 | php_intr_callback_t presence_change_callback, | ||
320 | php_intr_callback_t power_fault_callback); | ||
321 | |||
322 | 257 | ||
323 | /* This has no meaning for PCI Express, as there is only 1 slot per port */ | 258 | /* This has no meaning for PCI Express, as there is only 1 slot per port */ |
324 | int pcie_get_ctlr_slot_config(struct controller *ctrl, | 259 | int pcie_get_ctlr_slot_config(struct controller *ctrl, |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index cafc7eadcf80..8df704860348 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -27,27 +27,20 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/moduleparam.h> | 31 | #include <linux/moduleparam.h> |
33 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
34 | #include <linux/types.h> | 33 | #include <linux/types.h> |
35 | #include <linux/proc_fs.h> | ||
36 | #include <linux/slab.h> | ||
37 | #include <linux/workqueue.h> | ||
38 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
39 | #include <linux/init.h> | ||
40 | #include <asm/uaccess.h> | ||
41 | #include "pciehp.h" | 35 | #include "pciehp.h" |
42 | #include "pciehprm.h" | ||
43 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
44 | 37 | ||
45 | /* Global variables */ | 38 | /* Global variables */ |
46 | int pciehp_debug; | 39 | int pciehp_debug; |
47 | int pciehp_poll_mode; | 40 | int pciehp_poll_mode; |
48 | int pciehp_poll_time; | 41 | int pciehp_poll_time; |
42 | int pciehp_force; | ||
49 | struct controller *pciehp_ctrl_list; | 43 | struct controller *pciehp_ctrl_list; |
50 | struct pci_func *pciehp_slot_list[256]; | ||
51 | 44 | ||
52 | #define DRIVER_VERSION "0.4" | 45 | #define DRIVER_VERSION "0.4" |
53 | #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" | 46 | #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" |
@@ -60,9 +53,11 @@ MODULE_LICENSE("GPL"); | |||
60 | module_param(pciehp_debug, bool, 0644); | 53 | module_param(pciehp_debug, bool, 0644); |
61 | module_param(pciehp_poll_mode, bool, 0644); | 54 | module_param(pciehp_poll_mode, bool, 0644); |
62 | module_param(pciehp_poll_time, int, 0644); | 55 | module_param(pciehp_poll_time, int, 0644); |
56 | module_param(pciehp_force, bool, 0644); | ||
63 | MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not"); | 57 | MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not"); |
64 | MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not"); | 58 | MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not"); |
65 | MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds"); | 59 | MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds"); |
60 | MODULE_PARM_DESC(pciehp_force, "Force pciehp, even if _OSC and OSHP are missing"); | ||
66 | 61 | ||
67 | #define PCIE_MODULE_NAME "pciehp" | 62 | #define PCIE_MODULE_NAME "pciehp" |
68 | 63 | ||
@@ -114,8 +109,6 @@ static int init_slots(struct controller *ctrl) | |||
114 | u32 slot_number; | 109 | u32 slot_number; |
115 | int result = -ENOMEM; | 110 | int result = -ENOMEM; |
116 | 111 | ||
117 | dbg("%s\n",__FUNCTION__); | ||
118 | |||
119 | number_of_slots = ctrl->num_slots; | 112 | number_of_slots = ctrl->num_slots; |
120 | slot_device = ctrl->slot_device_offset; | 113 | slot_device = ctrl->slot_device_offset; |
121 | slot_number = ctrl->first_slot; | 114 | slot_number = ctrl->first_slot; |
@@ -370,7 +363,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
370 | u8 value; | 363 | u8 value; |
371 | struct pci_dev *pdev; | 364 | struct pci_dev *pdev; |
372 | 365 | ||
373 | dbg("%s: Called by hp_drv\n", __FUNCTION__); | ||
374 | ctrl = kmalloc(sizeof(*ctrl), GFP_KERNEL); | 366 | ctrl = kmalloc(sizeof(*ctrl), GFP_KERNEL); |
375 | if (!ctrl) { | 367 | if (!ctrl) { |
376 | err("%s : out of memory\n", __FUNCTION__); | 368 | err("%s : out of memory\n", __FUNCTION__); |
@@ -378,22 +370,15 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
378 | } | 370 | } |
379 | memset(ctrl, 0, sizeof(struct controller)); | 371 | memset(ctrl, 0, sizeof(struct controller)); |
380 | 372 | ||
381 | dbg("%s: DRV_thread pid = %d\n", __FUNCTION__, current->pid); | ||
382 | |||
383 | pdev = dev->port; | 373 | pdev = dev->port; |
374 | ctrl->pci_dev = pdev; | ||
384 | 375 | ||
385 | rc = pcie_init(ctrl, dev, | 376 | rc = pcie_init(ctrl, dev); |
386 | (php_intr_callback_t) pciehp_handle_attention_button, | ||
387 | (php_intr_callback_t) pciehp_handle_switch_change, | ||
388 | (php_intr_callback_t) pciehp_handle_presence_change, | ||
389 | (php_intr_callback_t) pciehp_handle_power_fault); | ||
390 | if (rc) { | 377 | if (rc) { |
391 | dbg("%s: controller initialization failed\n", PCIE_MODULE_NAME); | 378 | dbg("%s: controller initialization failed\n", PCIE_MODULE_NAME); |
392 | goto err_out_free_ctrl; | 379 | goto err_out_free_ctrl; |
393 | } | 380 | } |
394 | 381 | ||
395 | ctrl->pci_dev = pdev; | ||
396 | |||
397 | pci_set_drvdata(pdev, ctrl); | 382 | pci_set_drvdata(pdev, ctrl); |
398 | 383 | ||
399 | ctrl->pci_bus = kmalloc(sizeof(*ctrl->pci_bus), GFP_KERNEL); | 384 | ctrl->pci_bus = kmalloc(sizeof(*ctrl->pci_bus), GFP_KERNEL); |
@@ -402,7 +387,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
402 | rc = -ENOMEM; | 387 | rc = -ENOMEM; |
403 | goto err_out_unmap_mmio_region; | 388 | goto err_out_unmap_mmio_region; |
404 | } | 389 | } |
405 | dbg("%s: ctrl->pci_bus %p\n", __FUNCTION__, ctrl->pci_bus); | ||
406 | memcpy (ctrl->pci_bus, pdev->bus, sizeof (*ctrl->pci_bus)); | 390 | memcpy (ctrl->pci_bus, pdev->bus, sizeof (*ctrl->pci_bus)); |
407 | ctrl->bus = pdev->bus->number; /* ctrl bus */ | 391 | ctrl->bus = pdev->bus->number; /* ctrl bus */ |
408 | ctrl->slot_bus = pdev->subordinate->number; /* bus controlled by this HPC */ | 392 | ctrl->slot_bus = pdev->subordinate->number; /* bus controlled by this HPC */ |
@@ -424,25 +408,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
424 | first_device_num = ctrl->slot_device_offset; | 408 | first_device_num = ctrl->slot_device_offset; |
425 | num_ctlr_slots = ctrl->num_slots; | 409 | num_ctlr_slots = ctrl->num_slots; |
426 | 410 | ||
427 | /* Store PCI Config Space for all devices on this bus */ | ||
428 | dbg("%s: Before calling pciehp_save_config, ctrl->bus %x,ctrl->slot_bus %x\n", | ||
429 | __FUNCTION__,ctrl->bus, ctrl->slot_bus); | ||
430 | rc = pciehp_save_config(ctrl, ctrl->slot_bus, num_ctlr_slots, first_device_num); | ||
431 | if (rc) { | ||
432 | err("%s: unable to save PCI configuration data, error %d\n", __FUNCTION__, rc); | ||
433 | goto err_out_free_ctrl_bus; | ||
434 | } | ||
435 | |||
436 | /* Get IO, memory, and IRQ resources for new devices */ | ||
437 | rc = pciehprm_find_available_resources(ctrl); | ||
438 | ctrl->add_support = !rc; | ||
439 | |||
440 | if (rc) { | ||
441 | dbg("pciehprm_find_available_resources = %#x\n", rc); | ||
442 | err("unable to locate PCI configuration resources for hot plug add.\n"); | ||
443 | goto err_out_free_ctrl_bus; | ||
444 | } | ||
445 | |||
446 | /* Setup the slot information structures */ | 411 | /* Setup the slot information structures */ |
447 | rc = init_slots(ctrl); | 412 | rc = init_slots(ctrl); |
448 | if (rc) { | 413 | if (rc) { |
@@ -451,7 +416,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
451 | } | 416 | } |
452 | 417 | ||
453 | t_slot = pciehp_find_slot(ctrl, first_device_num); | 418 | t_slot = pciehp_find_slot(ctrl, first_device_num); |
454 | dbg("%s: t_slot %p\n", __FUNCTION__, t_slot); | ||
455 | 419 | ||
456 | /* Finish setting up the hot plug ctrl device */ | 420 | /* Finish setting up the hot plug ctrl device */ |
457 | ctrl->next_event = 0; | 421 | ctrl->next_event = 0; |
@@ -468,7 +432,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
468 | down(&ctrl->crit_sect); | 432 | down(&ctrl->crit_sect); |
469 | 433 | ||
470 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ | 434 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ |
471 | dbg("%s: adpater value %x\n", __FUNCTION__, value); | ||
472 | 435 | ||
473 | if ((POWER_CTRL(ctrl->ctrlcap)) && !value) { | 436 | if ((POWER_CTRL(ctrl->ctrlcap)) && !value) { |
474 | rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/ | 437 | rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/ |
@@ -501,7 +464,6 @@ err_out_none: | |||
501 | 464 | ||
502 | static int pcie_start_thread(void) | 465 | static int pcie_start_thread(void) |
503 | { | 466 | { |
504 | int loop; | ||
505 | int retval = 0; | 467 | int retval = 0; |
506 | 468 | ||
507 | dbg("Initialize + Start the notification/polling mechanism \n"); | 469 | dbg("Initialize + Start the notification/polling mechanism \n"); |
@@ -512,32 +474,11 @@ static int pcie_start_thread(void) | |||
512 | return retval; | 474 | return retval; |
513 | } | 475 | } |
514 | 476 | ||
515 | dbg("Initialize slot lists\n"); | ||
516 | /* One slot list for each bus in the system */ | ||
517 | for (loop = 0; loop < 256; loop++) { | ||
518 | pciehp_slot_list[loop] = NULL; | ||
519 | } | ||
520 | |||
521 | return retval; | 477 | return retval; |
522 | } | 478 | } |
523 | 479 | ||
524 | static inline void __exit | ||
525 | free_pciehp_res(struct pci_resource *res) | ||
526 | { | ||
527 | struct pci_resource *tres; | ||
528 | |||
529 | while (res) { | ||
530 | tres = res; | ||
531 | res = res->next; | ||
532 | kfree(tres); | ||
533 | } | ||
534 | } | ||
535 | |||
536 | static void __exit unload_pciehpd(void) | 480 | static void __exit unload_pciehpd(void) |
537 | { | 481 | { |
538 | struct pci_func *next; | ||
539 | struct pci_func *TempSlot; | ||
540 | int loop; | ||
541 | struct controller *ctrl; | 482 | struct controller *ctrl; |
542 | struct controller *tctrl; | 483 | struct controller *tctrl; |
543 | 484 | ||
@@ -546,11 +487,6 @@ static void __exit unload_pciehpd(void) | |||
546 | while (ctrl) { | 487 | while (ctrl) { |
547 | cleanup_slots(ctrl); | 488 | cleanup_slots(ctrl); |
548 | 489 | ||
549 | free_pciehp_res(ctrl->io_head); | ||
550 | free_pciehp_res(ctrl->mem_head); | ||
551 | free_pciehp_res(ctrl->p_mem_head); | ||
552 | free_pciehp_res(ctrl->bus_head); | ||
553 | |||
554 | kfree (ctrl->pci_bus); | 490 | kfree (ctrl->pci_bus); |
555 | 491 | ||
556 | ctrl->hpc_ops->release_ctlr(ctrl); | 492 | ctrl->hpc_ops->release_ctlr(ctrl); |
@@ -561,20 +497,6 @@ static void __exit unload_pciehpd(void) | |||
561 | kfree(tctrl); | 497 | kfree(tctrl); |
562 | } | 498 | } |
563 | 499 | ||
564 | for (loop = 0; loop < 256; loop++) { | ||
565 | next = pciehp_slot_list[loop]; | ||
566 | while (next != NULL) { | ||
567 | free_pciehp_res(next->io_head); | ||
568 | free_pciehp_res(next->mem_head); | ||
569 | free_pciehp_res(next->p_mem_head); | ||
570 | free_pciehp_res(next->bus_head); | ||
571 | |||
572 | TempSlot = next; | ||
573 | next = next->next; | ||
574 | kfree(TempSlot); | ||
575 | } | ||
576 | } | ||
577 | |||
578 | /* Stop the notification mechanism */ | 500 | /* Stop the notification mechanism */ |
579 | pciehp_event_stop_thread(); | 501 | pciehp_event_stop_thread(); |
580 | 502 | ||
@@ -639,21 +561,16 @@ static int __init pcied_init(void) | |||
639 | if (retval) | 561 | if (retval) |
640 | goto error_hpc_init; | 562 | goto error_hpc_init; |
641 | 563 | ||
642 | retval = pciehprm_init(PCI); | 564 | retval = pcie_port_service_register(&hpdriver_portdrv); |
643 | if (!retval) { | 565 | dbg("pcie_port_service_register = %d\n", retval); |
644 | retval = pcie_port_service_register(&hpdriver_portdrv); | 566 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); |
645 | dbg("pcie_port_service_register = %d\n", retval); | 567 | if (retval) |
646 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); | 568 | dbg("%s: Failure to register service\n", __FUNCTION__); |
647 | if (retval) | ||
648 | dbg("%s: Failure to register service\n", __FUNCTION__); | ||
649 | } | ||
650 | 569 | ||
651 | error_hpc_init: | 570 | error_hpc_init: |
652 | if (retval) { | 571 | if (retval) { |
653 | pciehprm_cleanup(); | ||
654 | pciehp_event_stop_thread(); | 572 | pciehp_event_stop_thread(); |
655 | } else | 573 | }; |
656 | pciehprm_print_pirt(); | ||
657 | 574 | ||
658 | return retval; | 575 | return retval; |
659 | } | 576 | } |
@@ -663,9 +580,6 @@ static void __exit pcied_cleanup(void) | |||
663 | dbg("unload_pciehpd()\n"); | 580 | dbg("unload_pciehpd()\n"); |
664 | unload_pciehpd(); | 581 | unload_pciehpd(); |
665 | 582 | ||
666 | pciehprm_cleanup(); | ||
667 | |||
668 | dbg("pcie_port_service_unregister\n"); | ||
669 | pcie_port_service_unregister(&hpdriver_portdrv); | 583 | pcie_port_service_unregister(&hpdriver_portdrv); |
670 | 584 | ||
671 | info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); | 585 | info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); |
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 898f6da6f0de..5e582eca21d8 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -27,25 +27,14 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
33 | #include <linux/types.h> | 32 | #include <linux/types.h> |
34 | #include <linux/slab.h> | ||
35 | #include <linux/workqueue.h> | ||
36 | #include <linux/interrupt.h> | ||
37 | #include <linux/delay.h> | ||
38 | #include <linux/wait.h> | ||
39 | #include <linux/smp_lock.h> | 33 | #include <linux/smp_lock.h> |
40 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
41 | #include "../pci.h" | 35 | #include "../pci.h" |
42 | #include "pciehp.h" | 36 | #include "pciehp.h" |
43 | #include "pciehprm.h" | ||
44 | 37 | ||
45 | static u32 configure_new_device(struct controller *ctrl, struct pci_func *func, | ||
46 | u8 behind_bridge, struct resource_lists *resources, u8 bridge_bus, u8 bridge_dev); | ||
47 | static int configure_new_function( struct controller *ctrl, struct pci_func *func, | ||
48 | u8 behind_bridge, struct resource_lists *resources, u8 bridge_bus, u8 bridge_dev); | ||
49 | static void interrupt_event_handler(struct controller *ctrl); | 38 | static void interrupt_event_handler(struct controller *ctrl); |
50 | 39 | ||
51 | static struct semaphore event_semaphore; /* mutex for process loop (up if something to process) */ | 40 | static struct semaphore event_semaphore; /* mutex for process loop (up if something to process) */ |
@@ -60,22 +49,18 @@ u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id) | |||
60 | struct slot *p_slot; | 49 | struct slot *p_slot; |
61 | u8 rc = 0; | 50 | u8 rc = 0; |
62 | u8 getstatus; | 51 | u8 getstatus; |
63 | struct pci_func *func; | ||
64 | struct event_info *taskInfo; | 52 | struct event_info *taskInfo; |
65 | 53 | ||
66 | /* Attention Button Change */ | 54 | /* Attention Button Change */ |
67 | dbg("pciehp: Attention button interrupt received.\n"); | 55 | dbg("pciehp: Attention button interrupt received.\n"); |
68 | 56 | ||
69 | func = pciehp_slot_find(ctrl->slot_bus, (hp_slot + ctrl->slot_device_offset), 0); | ||
70 | |||
71 | /* This is the structure that tells the worker thread what to do */ | 57 | /* This is the structure that tells the worker thread what to do */ |
72 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); | 58 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); |
73 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | 59 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); |
74 | 60 | ||
75 | p_slot->hpc_ops->get_adapter_status(p_slot, &(func->presence_save)); | ||
76 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 61 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
77 | 62 | ||
78 | ctrl->next_event = (ctrl->next_event + 1) % 10; | 63 | ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS; |
79 | taskInfo->hp_slot = hp_slot; | 64 | taskInfo->hp_slot = hp_slot; |
80 | 65 | ||
81 | rc++; | 66 | rc++; |
@@ -117,24 +102,20 @@ u8 pciehp_handle_switch_change(u8 hp_slot, void *inst_id) | |||
117 | struct slot *p_slot; | 102 | struct slot *p_slot; |
118 | u8 rc = 0; | 103 | u8 rc = 0; |
119 | u8 getstatus; | 104 | u8 getstatus; |
120 | struct pci_func *func; | ||
121 | struct event_info *taskInfo; | 105 | struct event_info *taskInfo; |
122 | 106 | ||
123 | /* Switch Change */ | 107 | /* Switch Change */ |
124 | dbg("pciehp: Switch interrupt received.\n"); | 108 | dbg("pciehp: Switch interrupt received.\n"); |
125 | 109 | ||
126 | func = pciehp_slot_find(ctrl->slot_bus, (hp_slot + ctrl->slot_device_offset), 0); | ||
127 | |||
128 | /* This is the structure that tells the worker thread | 110 | /* This is the structure that tells the worker thread |
129 | * what to do | 111 | * what to do |
130 | */ | 112 | */ |
131 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); | 113 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); |
132 | ctrl->next_event = (ctrl->next_event + 1) % 10; | 114 | ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS; |
133 | taskInfo->hp_slot = hp_slot; | 115 | taskInfo->hp_slot = hp_slot; |
134 | 116 | ||
135 | rc++; | 117 | rc++; |
136 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | 118 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); |
137 | p_slot->hpc_ops->get_adapter_status(p_slot, &(func->presence_save)); | ||
138 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 119 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
139 | 120 | ||
140 | if (getstatus) { | 121 | if (getstatus) { |
@@ -142,14 +123,12 @@ u8 pciehp_handle_switch_change(u8 hp_slot, void *inst_id) | |||
142 | * Switch opened | 123 | * Switch opened |
143 | */ | 124 | */ |
144 | info("Latch open on Slot(%d)\n", ctrl->first_slot + hp_slot); | 125 | info("Latch open on Slot(%d)\n", ctrl->first_slot + hp_slot); |
145 | func->switch_save = 0; | ||
146 | taskInfo->event_type = INT_SWITCH_OPEN; | 126 | taskInfo->event_type = INT_SWITCH_OPEN; |
147 | } else { | 127 | } else { |
148 | /* | 128 | /* |
149 | * Switch closed | 129 | * Switch closed |
150 | */ | 130 | */ |
151 | info("Latch close on Slot(%d)\n", ctrl->first_slot + hp_slot); | 131 | info("Latch close on Slot(%d)\n", ctrl->first_slot + hp_slot); |
152 | func->switch_save = 0x10; | ||
153 | taskInfo->event_type = INT_SWITCH_CLOSE; | 132 | taskInfo->event_type = INT_SWITCH_CLOSE; |
154 | } | 133 | } |
155 | 134 | ||
@@ -163,20 +142,17 @@ u8 pciehp_handle_presence_change(u8 hp_slot, void *inst_id) | |||
163 | { | 142 | { |
164 | struct controller *ctrl = (struct controller *) inst_id; | 143 | struct controller *ctrl = (struct controller *) inst_id; |
165 | struct slot *p_slot; | 144 | struct slot *p_slot; |
166 | u8 rc = 0; | 145 | u8 presence_save, rc = 0; |
167 | struct pci_func *func; | ||
168 | struct event_info *taskInfo; | 146 | struct event_info *taskInfo; |
169 | 147 | ||
170 | /* Presence Change */ | 148 | /* Presence Change */ |
171 | dbg("pciehp: Presence/Notify input change.\n"); | 149 | dbg("pciehp: Presence/Notify input change.\n"); |
172 | 150 | ||
173 | func = pciehp_slot_find(ctrl->slot_bus, (hp_slot + ctrl->slot_device_offset), 0); | ||
174 | |||
175 | /* This is the structure that tells the worker thread | 151 | /* This is the structure that tells the worker thread |
176 | * what to do | 152 | * what to do |
177 | */ | 153 | */ |
178 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); | 154 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); |
179 | ctrl->next_event = (ctrl->next_event + 1) % 10; | 155 | ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS; |
180 | taskInfo->hp_slot = hp_slot; | 156 | taskInfo->hp_slot = hp_slot; |
181 | 157 | ||
182 | rc++; | 158 | rc++; |
@@ -185,8 +161,8 @@ u8 pciehp_handle_presence_change(u8 hp_slot, void *inst_id) | |||
185 | /* Switch is open, assume a presence change | 161 | /* Switch is open, assume a presence change |
186 | * Save the presence state | 162 | * Save the presence state |
187 | */ | 163 | */ |
188 | p_slot->hpc_ops->get_adapter_status(p_slot, &(func->presence_save)); | 164 | p_slot->hpc_ops->get_adapter_status(p_slot, &presence_save); |
189 | if (func->presence_save) { | 165 | if (presence_save) { |
190 | /* | 166 | /* |
191 | * Card Present | 167 | * Card Present |
192 | */ | 168 | */ |
@@ -211,19 +187,16 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) | |||
211 | struct controller *ctrl = (struct controller *) inst_id; | 187 | struct controller *ctrl = (struct controller *) inst_id; |
212 | struct slot *p_slot; | 188 | struct slot *p_slot; |
213 | u8 rc = 0; | 189 | u8 rc = 0; |
214 | struct pci_func *func; | ||
215 | struct event_info *taskInfo; | 190 | struct event_info *taskInfo; |
216 | 191 | ||
217 | /* power fault */ | 192 | /* power fault */ |
218 | dbg("pciehp: Power fault interrupt received.\n"); | 193 | dbg("pciehp: Power fault interrupt received.\n"); |
219 | 194 | ||
220 | func = pciehp_slot_find(ctrl->slot_bus, (hp_slot + ctrl->slot_device_offset), 0); | ||
221 | |||
222 | /* this is the structure that tells the worker thread | 195 | /* this is the structure that tells the worker thread |
223 | * what to do | 196 | * what to do |
224 | */ | 197 | */ |
225 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); | 198 | taskInfo = &(ctrl->event_queue[ctrl->next_event]); |
226 | ctrl->next_event = (ctrl->next_event + 1) % 10; | 199 | ctrl->next_event = (ctrl->next_event + 1) % MAX_EVENTS; |
227 | taskInfo->hp_slot = hp_slot; | 200 | taskInfo->hp_slot = hp_slot; |
228 | 201 | ||
229 | rc++; | 202 | rc++; |
@@ -234,7 +207,7 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) | |||
234 | * power fault Cleared | 207 | * power fault Cleared |
235 | */ | 208 | */ |
236 | info("Power fault cleared on Slot(%d)\n", ctrl->first_slot + hp_slot); | 209 | info("Power fault cleared on Slot(%d)\n", ctrl->first_slot + hp_slot); |
237 | func->status = 0x00; | 210 | p_slot->status = 0x00; |
238 | taskInfo->event_type = INT_POWER_FAULT_CLEAR; | 211 | taskInfo->event_type = INT_POWER_FAULT_CLEAR; |
239 | } else { | 212 | } else { |
240 | /* | 213 | /* |
@@ -243,7 +216,7 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) | |||
243 | info("Power fault on Slot(%d)\n", ctrl->first_slot + hp_slot); | 216 | info("Power fault on Slot(%d)\n", ctrl->first_slot + hp_slot); |
244 | taskInfo->event_type = INT_POWER_FAULT; | 217 | taskInfo->event_type = INT_POWER_FAULT; |
245 | /* set power fault status for this board */ | 218 | /* set power fault status for this board */ |
246 | func->status = 0xFF; | 219 | p_slot->status = 0xFF; |
247 | info("power fault bit %x set\n", hp_slot); | 220 | info("power fault bit %x set\n", hp_slot); |
248 | } | 221 | } |
249 | if (rc) | 222 | if (rc) |
@@ -252,810 +225,6 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) | |||
252 | return rc; | 225 | return rc; |
253 | } | 226 | } |
254 | 227 | ||
255 | |||
256 | /** | ||
257 | * sort_by_size: sort nodes by their length, smallest first. | ||
258 | * | ||
259 | * @head: list to sort | ||
260 | */ | ||
261 | static int sort_by_size(struct pci_resource **head) | ||
262 | { | ||
263 | struct pci_resource *current_res; | ||
264 | struct pci_resource *next_res; | ||
265 | int out_of_order = 1; | ||
266 | |||
267 | if (!(*head)) | ||
268 | return 1; | ||
269 | |||
270 | if (!((*head)->next)) | ||
271 | return 0; | ||
272 | |||
273 | while (out_of_order) { | ||
274 | out_of_order = 0; | ||
275 | |||
276 | /* Special case for swapping list head */ | ||
277 | if (((*head)->next) && | ||
278 | ((*head)->length > (*head)->next->length)) { | ||
279 | out_of_order++; | ||
280 | current_res = *head; | ||
281 | *head = (*head)->next; | ||
282 | current_res->next = (*head)->next; | ||
283 | (*head)->next = current_res; | ||
284 | } | ||
285 | |||
286 | current_res = *head; | ||
287 | |||
288 | while (current_res->next && current_res->next->next) { | ||
289 | if (current_res->next->length > current_res->next->next->length) { | ||
290 | out_of_order++; | ||
291 | next_res = current_res->next; | ||
292 | current_res->next = current_res->next->next; | ||
293 | current_res = current_res->next; | ||
294 | next_res->next = current_res->next; | ||
295 | current_res->next = next_res; | ||
296 | } else | ||
297 | current_res = current_res->next; | ||
298 | } | ||
299 | } /* End of out_of_order loop */ | ||
300 | |||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | |||
305 | /* | ||
306 | * sort_by_max_size | ||
307 | * | ||
308 | * Sorts nodes on the list by their length. | ||
309 | * Largest first. | ||
310 | * | ||
311 | */ | ||
312 | static int sort_by_max_size(struct pci_resource **head) | ||
313 | { | ||
314 | struct pci_resource *current_res; | ||
315 | struct pci_resource *next_res; | ||
316 | int out_of_order = 1; | ||
317 | |||
318 | if (!(*head)) | ||
319 | return 1; | ||
320 | |||
321 | if (!((*head)->next)) | ||
322 | return 0; | ||
323 | |||
324 | while (out_of_order) { | ||
325 | out_of_order = 0; | ||
326 | |||
327 | /* Special case for swapping list head */ | ||
328 | if (((*head)->next) && | ||
329 | ((*head)->length < (*head)->next->length)) { | ||
330 | out_of_order++; | ||
331 | current_res = *head; | ||
332 | *head = (*head)->next; | ||
333 | current_res->next = (*head)->next; | ||
334 | (*head)->next = current_res; | ||
335 | } | ||
336 | |||
337 | current_res = *head; | ||
338 | |||
339 | while (current_res->next && current_res->next->next) { | ||
340 | if (current_res->next->length < current_res->next->next->length) { | ||
341 | out_of_order++; | ||
342 | next_res = current_res->next; | ||
343 | current_res->next = current_res->next->next; | ||
344 | current_res = current_res->next; | ||
345 | next_res->next = current_res->next; | ||
346 | current_res->next = next_res; | ||
347 | } else | ||
348 | current_res = current_res->next; | ||
349 | } | ||
350 | } /* End of out_of_order loop */ | ||
351 | |||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | |||
356 | /** | ||
357 | * do_pre_bridge_resource_split: return one unused resource node | ||
358 | * @head: list to scan | ||
359 | * | ||
360 | */ | ||
361 | static struct pci_resource * | ||
362 | do_pre_bridge_resource_split(struct pci_resource **head, | ||
363 | struct pci_resource **orig_head, u32 alignment) | ||
364 | { | ||
365 | struct pci_resource *prevnode = NULL; | ||
366 | struct pci_resource *node; | ||
367 | struct pci_resource *split_node; | ||
368 | u32 rc; | ||
369 | u32 temp_dword; | ||
370 | dbg("do_pre_bridge_resource_split\n"); | ||
371 | |||
372 | if (!(*head) || !(*orig_head)) | ||
373 | return NULL; | ||
374 | |||
375 | rc = pciehp_resource_sort_and_combine(head); | ||
376 | |||
377 | if (rc) | ||
378 | return NULL; | ||
379 | |||
380 | if ((*head)->base != (*orig_head)->base) | ||
381 | return NULL; | ||
382 | |||
383 | if ((*head)->length == (*orig_head)->length) | ||
384 | return NULL; | ||
385 | |||
386 | |||
387 | /* If we got here, there the bridge requires some of the resource, but | ||
388 | * we may be able to split some off of the front | ||
389 | */ | ||
390 | node = *head; | ||
391 | |||
392 | if (node->length & (alignment -1)) { | ||
393 | /* this one isn't an aligned length, so we'll make a new entry | ||
394 | * and split it up. | ||
395 | */ | ||
396 | split_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
397 | |||
398 | if (!split_node) | ||
399 | return NULL; | ||
400 | |||
401 | temp_dword = (node->length | (alignment-1)) + 1 - alignment; | ||
402 | |||
403 | split_node->base = node->base; | ||
404 | split_node->length = temp_dword; | ||
405 | |||
406 | node->length -= temp_dword; | ||
407 | node->base += split_node->length; | ||
408 | |||
409 | /* Put it in the list */ | ||
410 | *head = split_node; | ||
411 | split_node->next = node; | ||
412 | } | ||
413 | |||
414 | if (node->length < alignment) | ||
415 | return NULL; | ||
416 | |||
417 | /* Now unlink it */ | ||
418 | if (*head == node) { | ||
419 | *head = node->next; | ||
420 | } else { | ||
421 | prevnode = *head; | ||
422 | while (prevnode->next != node) | ||
423 | prevnode = prevnode->next; | ||
424 | |||
425 | prevnode->next = node->next; | ||
426 | } | ||
427 | node->next = NULL; | ||
428 | |||
429 | return node; | ||
430 | } | ||
431 | |||
432 | |||
433 | /** | ||
434 | * do_bridge_resource_split: return one unused resource node | ||
435 | * @head: list to scan | ||
436 | * | ||
437 | */ | ||
438 | static struct pci_resource * | ||
439 | do_bridge_resource_split(struct pci_resource **head, u32 alignment) | ||
440 | { | ||
441 | struct pci_resource *prevnode = NULL; | ||
442 | struct pci_resource *node; | ||
443 | u32 rc; | ||
444 | u32 temp_dword; | ||
445 | |||
446 | if (!(*head)) | ||
447 | return NULL; | ||
448 | |||
449 | rc = pciehp_resource_sort_and_combine(head); | ||
450 | |||
451 | if (rc) | ||
452 | return NULL; | ||
453 | |||
454 | node = *head; | ||
455 | |||
456 | while (node->next) { | ||
457 | prevnode = node; | ||
458 | node = node->next; | ||
459 | kfree(prevnode); | ||
460 | } | ||
461 | |||
462 | if (node->length < alignment) { | ||
463 | kfree(node); | ||
464 | return NULL; | ||
465 | } | ||
466 | |||
467 | if (node->base & (alignment - 1)) { | ||
468 | /* Short circuit if adjusted size is too small */ | ||
469 | temp_dword = (node->base | (alignment-1)) + 1; | ||
470 | if ((node->length - (temp_dword - node->base)) < alignment) { | ||
471 | kfree(node); | ||
472 | return NULL; | ||
473 | } | ||
474 | |||
475 | node->length -= (temp_dword - node->base); | ||
476 | node->base = temp_dword; | ||
477 | } | ||
478 | |||
479 | if (node->length & (alignment - 1)) { | ||
480 | /* There's stuff in use after this node */ | ||
481 | kfree(node); | ||
482 | return NULL; | ||
483 | } | ||
484 | |||
485 | return node; | ||
486 | } | ||
487 | |||
488 | |||
489 | /* | ||
490 | * get_io_resource | ||
491 | * | ||
492 | * this function sorts the resource list by size and then | ||
493 | * returns the first node of "size" length that is not in the | ||
494 | * ISA aliasing window. If it finds a node larger than "size" | ||
495 | * it will split it up. | ||
496 | * | ||
497 | * size must be a power of two. | ||
498 | */ | ||
499 | static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size) | ||
500 | { | ||
501 | struct pci_resource *prevnode; | ||
502 | struct pci_resource *node; | ||
503 | struct pci_resource *split_node = NULL; | ||
504 | u32 temp_dword; | ||
505 | |||
506 | if (!(*head)) | ||
507 | return NULL; | ||
508 | |||
509 | if ( pciehp_resource_sort_and_combine(head) ) | ||
510 | return NULL; | ||
511 | |||
512 | if ( sort_by_size(head) ) | ||
513 | return NULL; | ||
514 | |||
515 | for (node = *head; node; node = node->next) { | ||
516 | if (node->length < size) | ||
517 | continue; | ||
518 | |||
519 | if (node->base & (size - 1)) { | ||
520 | /* this one isn't base aligned properly | ||
521 | so we'll make a new entry and split it up */ | ||
522 | temp_dword = (node->base | (size-1)) + 1; | ||
523 | |||
524 | /*/ Short circuit if adjusted size is too small */ | ||
525 | if ((node->length - (temp_dword - node->base)) < size) | ||
526 | continue; | ||
527 | |||
528 | split_node = kmalloc(sizeof(struct pci_resource), | ||
529 | GFP_KERNEL); | ||
530 | |||
531 | if (!split_node) | ||
532 | return NULL; | ||
533 | |||
534 | split_node->base = node->base; | ||
535 | split_node->length = temp_dword - node->base; | ||
536 | node->base = temp_dword; | ||
537 | node->length -= split_node->length; | ||
538 | |||
539 | /* Put it in the list */ | ||
540 | split_node->next = node->next; | ||
541 | node->next = split_node; | ||
542 | } /* End of non-aligned base */ | ||
543 | |||
544 | /* Don't need to check if too small since we already did */ | ||
545 | if (node->length > size) { | ||
546 | /* this one is longer than we need | ||
547 | so we'll make a new entry and split it up */ | ||
548 | split_node = kmalloc(sizeof(struct pci_resource), | ||
549 | GFP_KERNEL); | ||
550 | |||
551 | if (!split_node) | ||
552 | return NULL; | ||
553 | |||
554 | split_node->base = node->base + size; | ||
555 | split_node->length = node->length - size; | ||
556 | node->length = size; | ||
557 | |||
558 | /* Put it in the list */ | ||
559 | split_node->next = node->next; | ||
560 | node->next = split_node; | ||
561 | } /* End of too big on top end */ | ||
562 | |||
563 | /* For IO make sure it's not in the ISA aliasing space */ | ||
564 | if (node->base & 0x300L) | ||
565 | continue; | ||
566 | |||
567 | /* If we got here, then it is the right size | ||
568 | Now take it out of the list */ | ||
569 | if (*head == node) { | ||
570 | *head = node->next; | ||
571 | } else { | ||
572 | prevnode = *head; | ||
573 | while (prevnode->next != node) | ||
574 | prevnode = prevnode->next; | ||
575 | |||
576 | prevnode->next = node->next; | ||
577 | } | ||
578 | node->next = NULL; | ||
579 | /* Stop looping */ | ||
580 | break; | ||
581 | } | ||
582 | |||
583 | return node; | ||
584 | } | ||
585 | |||
586 | |||
587 | /* | ||
588 | * get_max_resource | ||
589 | * | ||
590 | * Gets the largest node that is at least "size" big from the | ||
591 | * list pointed to by head. It aligns the node on top and bottom | ||
592 | * to "size" alignment before returning it. | ||
593 | * J.I. modified to put max size limits of; 64M->32M->16M->8M->4M->1M | ||
594 | * This is needed to avoid allocating entire ACPI _CRS res to one child bridge/slot. | ||
595 | */ | ||
596 | static struct pci_resource *get_max_resource(struct pci_resource **head, u32 size) | ||
597 | { | ||
598 | struct pci_resource *max; | ||
599 | struct pci_resource *temp; | ||
600 | struct pci_resource *split_node; | ||
601 | u32 temp_dword; | ||
602 | u32 max_size[] = { 0x4000000, 0x2000000, 0x1000000, 0x0800000, 0x0400000, 0x0200000, 0x0100000, 0x00 }; | ||
603 | int i; | ||
604 | |||
605 | if (!(*head)) | ||
606 | return NULL; | ||
607 | |||
608 | if (pciehp_resource_sort_and_combine(head)) | ||
609 | return NULL; | ||
610 | |||
611 | if (sort_by_max_size(head)) | ||
612 | return NULL; | ||
613 | |||
614 | for (max = *head;max; max = max->next) { | ||
615 | |||
616 | /* If not big enough we could probably just bail, | ||
617 | instead we'll continue to the next. */ | ||
618 | if (max->length < size) | ||
619 | continue; | ||
620 | |||
621 | if (max->base & (size - 1)) { | ||
622 | /* this one isn't base aligned properly | ||
623 | so we'll make a new entry and split it up */ | ||
624 | temp_dword = (max->base | (size-1)) + 1; | ||
625 | |||
626 | /* Short circuit if adjusted size is too small */ | ||
627 | if ((max->length - (temp_dword - max->base)) < size) | ||
628 | continue; | ||
629 | |||
630 | split_node = kmalloc(sizeof(struct pci_resource), | ||
631 | GFP_KERNEL); | ||
632 | |||
633 | if (!split_node) | ||
634 | return NULL; | ||
635 | |||
636 | split_node->base = max->base; | ||
637 | split_node->length = temp_dword - max->base; | ||
638 | max->base = temp_dword; | ||
639 | max->length -= split_node->length; | ||
640 | |||
641 | /* Put it next in the list */ | ||
642 | split_node->next = max->next; | ||
643 | max->next = split_node; | ||
644 | } | ||
645 | |||
646 | if ((max->base + max->length) & (size - 1)) { | ||
647 | /* this one isn't end aligned properly at the top | ||
648 | so we'll make a new entry and split it up */ | ||
649 | split_node = kmalloc(sizeof(struct pci_resource), | ||
650 | GFP_KERNEL); | ||
651 | |||
652 | if (!split_node) | ||
653 | return NULL; | ||
654 | temp_dword = ((max->base + max->length) & ~(size - 1)); | ||
655 | split_node->base = temp_dword; | ||
656 | split_node->length = max->length + max->base | ||
657 | - split_node->base; | ||
658 | max->length -= split_node->length; | ||
659 | |||
660 | /* Put it in the list */ | ||
661 | split_node->next = max->next; | ||
662 | max->next = split_node; | ||
663 | } | ||
664 | |||
665 | /* Make sure it didn't shrink too much when we aligned it */ | ||
666 | if (max->length < size) | ||
667 | continue; | ||
668 | |||
669 | for ( i = 0; max_size[i] > size; i++) { | ||
670 | if (max->length > max_size[i]) { | ||
671 | split_node = kmalloc(sizeof(struct pci_resource), | ||
672 | GFP_KERNEL); | ||
673 | if (!split_node) | ||
674 | break; /* return NULL; */ | ||
675 | split_node->base = max->base + max_size[i]; | ||
676 | split_node->length = max->length - max_size[i]; | ||
677 | max->length = max_size[i]; | ||
678 | /* Put it next in the list */ | ||
679 | split_node->next = max->next; | ||
680 | max->next = split_node; | ||
681 | break; | ||
682 | } | ||
683 | } | ||
684 | |||
685 | /* Now take it out of the list */ | ||
686 | temp = (struct pci_resource*) *head; | ||
687 | if (temp == max) { | ||
688 | *head = max->next; | ||
689 | } else { | ||
690 | while (temp && temp->next != max) { | ||
691 | temp = temp->next; | ||
692 | } | ||
693 | |||
694 | temp->next = max->next; | ||
695 | } | ||
696 | |||
697 | max->next = NULL; | ||
698 | return max; | ||
699 | } | ||
700 | |||
701 | /* If we get here, we couldn't find one */ | ||
702 | return NULL; | ||
703 | } | ||
704 | |||
705 | |||
706 | /* | ||
707 | * get_resource | ||
708 | * | ||
709 | * this function sorts the resource list by size and then | ||
710 | * returns the first node of "size" length. If it finds a node | ||
711 | * larger than "size" it will split it up. | ||
712 | * | ||
713 | * size must be a power of two. | ||
714 | */ | ||
715 | static struct pci_resource *get_resource(struct pci_resource **head, u32 size) | ||
716 | { | ||
717 | struct pci_resource *prevnode; | ||
718 | struct pci_resource *node; | ||
719 | struct pci_resource *split_node; | ||
720 | u32 temp_dword; | ||
721 | |||
722 | if (!(*head)) | ||
723 | return NULL; | ||
724 | |||
725 | if ( pciehp_resource_sort_and_combine(head) ) | ||
726 | return NULL; | ||
727 | |||
728 | if ( sort_by_size(head) ) | ||
729 | return NULL; | ||
730 | |||
731 | for (node = *head; node; node = node->next) { | ||
732 | dbg("%s: req_size =0x%x node=%p, base=0x%x, length=0x%x\n", | ||
733 | __FUNCTION__, size, node, node->base, node->length); | ||
734 | if (node->length < size) | ||
735 | continue; | ||
736 | |||
737 | if (node->base & (size - 1)) { | ||
738 | dbg("%s: not aligned\n", __FUNCTION__); | ||
739 | /* this one isn't base aligned properly | ||
740 | so we'll make a new entry and split it up */ | ||
741 | temp_dword = (node->base | (size-1)) + 1; | ||
742 | |||
743 | /* Short circuit if adjusted size is too small */ | ||
744 | if ((node->length - (temp_dword - node->base)) < size) | ||
745 | continue; | ||
746 | |||
747 | split_node = kmalloc(sizeof(struct pci_resource), | ||
748 | GFP_KERNEL); | ||
749 | |||
750 | if (!split_node) | ||
751 | return NULL; | ||
752 | |||
753 | split_node->base = node->base; | ||
754 | split_node->length = temp_dword - node->base; | ||
755 | node->base = temp_dword; | ||
756 | node->length -= split_node->length; | ||
757 | |||
758 | /* Put it in the list */ | ||
759 | split_node->next = node->next; | ||
760 | node->next = split_node; | ||
761 | } /* End of non-aligned base */ | ||
762 | |||
763 | /* Don't need to check if too small since we already did */ | ||
764 | if (node->length > size) { | ||
765 | dbg("%s: too big\n", __FUNCTION__); | ||
766 | /* this one is longer than we need | ||
767 | so we'll make a new entry and split it up */ | ||
768 | split_node = kmalloc(sizeof(struct pci_resource), | ||
769 | GFP_KERNEL); | ||
770 | |||
771 | if (!split_node) | ||
772 | return NULL; | ||
773 | |||
774 | split_node->base = node->base + size; | ||
775 | split_node->length = node->length - size; | ||
776 | node->length = size; | ||
777 | |||
778 | /* Put it in the list */ | ||
779 | split_node->next = node->next; | ||
780 | node->next = split_node; | ||
781 | } /* End of too big on top end */ | ||
782 | |||
783 | dbg("%s: got one!!!\n", __FUNCTION__); | ||
784 | /* If we got here, then it is the right size | ||
785 | Now take it out of the list */ | ||
786 | if (*head == node) { | ||
787 | *head = node->next; | ||
788 | } else { | ||
789 | prevnode = *head; | ||
790 | while (prevnode->next != node) | ||
791 | prevnode = prevnode->next; | ||
792 | |||
793 | prevnode->next = node->next; | ||
794 | } | ||
795 | node->next = NULL; | ||
796 | /* Stop looping */ | ||
797 | break; | ||
798 | } | ||
799 | return node; | ||
800 | } | ||
801 | |||
802 | |||
803 | /* | ||
804 | * pciehp_resource_sort_and_combine | ||
805 | * | ||
806 | * Sorts all of the nodes in the list in ascending order by | ||
807 | * their base addresses. Also does garbage collection by | ||
808 | * combining adjacent nodes. | ||
809 | * | ||
810 | * returns 0 if success | ||
811 | */ | ||
812 | int pciehp_resource_sort_and_combine(struct pci_resource **head) | ||
813 | { | ||
814 | struct pci_resource *node1; | ||
815 | struct pci_resource *node2; | ||
816 | int out_of_order = 1; | ||
817 | |||
818 | dbg("%s: head = %p, *head = %p\n", __FUNCTION__, head, *head); | ||
819 | |||
820 | if (!(*head)) | ||
821 | return 1; | ||
822 | |||
823 | dbg("*head->next = %p\n",(*head)->next); | ||
824 | |||
825 | if (!(*head)->next) | ||
826 | return 0; /* only one item on the list, already sorted! */ | ||
827 | |||
828 | dbg("*head->base = 0x%x\n",(*head)->base); | ||
829 | dbg("*head->next->base = 0x%x\n",(*head)->next->base); | ||
830 | while (out_of_order) { | ||
831 | out_of_order = 0; | ||
832 | |||
833 | /* Special case for swapping list head */ | ||
834 | if (((*head)->next) && | ||
835 | ((*head)->base > (*head)->next->base)) { | ||
836 | node1 = *head; | ||
837 | (*head) = (*head)->next; | ||
838 | node1->next = (*head)->next; | ||
839 | (*head)->next = node1; | ||
840 | out_of_order++; | ||
841 | } | ||
842 | |||
843 | node1 = (*head); | ||
844 | |||
845 | while (node1->next && node1->next->next) { | ||
846 | if (node1->next->base > node1->next->next->base) { | ||
847 | out_of_order++; | ||
848 | node2 = node1->next; | ||
849 | node1->next = node1->next->next; | ||
850 | node1 = node1->next; | ||
851 | node2->next = node1->next; | ||
852 | node1->next = node2; | ||
853 | } else | ||
854 | node1 = node1->next; | ||
855 | } | ||
856 | } /* End of out_of_order loop */ | ||
857 | |||
858 | node1 = *head; | ||
859 | |||
860 | while (node1 && node1->next) { | ||
861 | if ((node1->base + node1->length) == node1->next->base) { | ||
862 | /* Combine */ | ||
863 | dbg("8..\n"); | ||
864 | node1->length += node1->next->length; | ||
865 | node2 = node1->next; | ||
866 | node1->next = node1->next->next; | ||
867 | kfree(node2); | ||
868 | } else | ||
869 | node1 = node1->next; | ||
870 | } | ||
871 | |||
872 | return 0; | ||
873 | } | ||
874 | |||
875 | |||
876 | /** | ||
877 | * pciehp_slot_create - Creates a node and adds it to the proper bus. | ||
878 | * @busnumber - bus where new node is to be located | ||
879 | * | ||
880 | * Returns pointer to the new node or NULL if unsuccessful | ||
881 | */ | ||
882 | struct pci_func *pciehp_slot_create(u8 busnumber) | ||
883 | { | ||
884 | struct pci_func *new_slot; | ||
885 | struct pci_func *next; | ||
886 | dbg("%s: busnumber %x\n", __FUNCTION__, busnumber); | ||
887 | new_slot = kmalloc(sizeof(struct pci_func), GFP_KERNEL); | ||
888 | |||
889 | if (new_slot == NULL) | ||
890 | return new_slot; | ||
891 | |||
892 | memset(new_slot, 0, sizeof(struct pci_func)); | ||
893 | |||
894 | new_slot->next = NULL; | ||
895 | new_slot->configured = 1; | ||
896 | |||
897 | if (pciehp_slot_list[busnumber] == NULL) { | ||
898 | pciehp_slot_list[busnumber] = new_slot; | ||
899 | } else { | ||
900 | next = pciehp_slot_list[busnumber]; | ||
901 | while (next->next != NULL) | ||
902 | next = next->next; | ||
903 | next->next = new_slot; | ||
904 | } | ||
905 | return new_slot; | ||
906 | } | ||
907 | |||
908 | |||
909 | /** | ||
910 | * slot_remove - Removes a node from the linked list of slots. | ||
911 | * @old_slot: slot to remove | ||
912 | * | ||
913 | * Returns 0 if successful, !0 otherwise. | ||
914 | */ | ||
915 | static int slot_remove(struct pci_func * old_slot) | ||
916 | { | ||
917 | struct pci_func *next; | ||
918 | |||
919 | if (old_slot == NULL) | ||
920 | return 1; | ||
921 | |||
922 | next = pciehp_slot_list[old_slot->bus]; | ||
923 | |||
924 | if (next == NULL) | ||
925 | return 1; | ||
926 | |||
927 | if (next == old_slot) { | ||
928 | pciehp_slot_list[old_slot->bus] = old_slot->next; | ||
929 | pciehp_destroy_board_resources(old_slot); | ||
930 | kfree(old_slot); | ||
931 | return 0; | ||
932 | } | ||
933 | |||
934 | while ((next->next != old_slot) && (next->next != NULL)) { | ||
935 | next = next->next; | ||
936 | } | ||
937 | |||
938 | if (next->next == old_slot) { | ||
939 | next->next = old_slot->next; | ||
940 | pciehp_destroy_board_resources(old_slot); | ||
941 | kfree(old_slot); | ||
942 | return 0; | ||
943 | } else | ||
944 | return 2; | ||
945 | } | ||
946 | |||
947 | |||
948 | /** | ||
949 | * bridge_slot_remove - Removes a node from the linked list of slots. | ||
950 | * @bridge: bridge to remove | ||
951 | * | ||
952 | * Returns 0 if successful, !0 otherwise. | ||
953 | */ | ||
954 | static int bridge_slot_remove(struct pci_func *bridge) | ||
955 | { | ||
956 | u8 subordinateBus, secondaryBus; | ||
957 | u8 tempBus; | ||
958 | struct pci_func *next; | ||
959 | |||
960 | if (bridge == NULL) | ||
961 | return 1; | ||
962 | |||
963 | secondaryBus = (bridge->config_space[0x06] >> 8) & 0xFF; | ||
964 | subordinateBus = (bridge->config_space[0x06] >> 16) & 0xFF; | ||
965 | |||
966 | for (tempBus = secondaryBus; tempBus <= subordinateBus; tempBus++) { | ||
967 | next = pciehp_slot_list[tempBus]; | ||
968 | |||
969 | while (!slot_remove(next)) { | ||
970 | next = pciehp_slot_list[tempBus]; | ||
971 | } | ||
972 | } | ||
973 | |||
974 | next = pciehp_slot_list[bridge->bus]; | ||
975 | |||
976 | if (next == NULL) { | ||
977 | return 1; | ||
978 | } | ||
979 | |||
980 | if (next == bridge) { | ||
981 | pciehp_slot_list[bridge->bus] = bridge->next; | ||
982 | kfree(bridge); | ||
983 | return 0; | ||
984 | } | ||
985 | |||
986 | while ((next->next != bridge) && (next->next != NULL)) { | ||
987 | next = next->next; | ||
988 | } | ||
989 | |||
990 | if (next->next == bridge) { | ||
991 | next->next = bridge->next; | ||
992 | kfree(bridge); | ||
993 | return 0; | ||
994 | } else | ||
995 | return 2; | ||
996 | } | ||
997 | |||
998 | |||
999 | /** | ||
1000 | * pciehp_slot_find - Looks for a node by bus, and device, multiple functions accessed | ||
1001 | * @bus: bus to find | ||
1002 | * @device: device to find | ||
1003 | * @index: is 0 for first function found, 1 for the second... | ||
1004 | * | ||
1005 | * Returns pointer to the node if successful, %NULL otherwise. | ||
1006 | */ | ||
1007 | struct pci_func *pciehp_slot_find(u8 bus, u8 device, u8 index) | ||
1008 | { | ||
1009 | int found = -1; | ||
1010 | struct pci_func *func; | ||
1011 | |||
1012 | func = pciehp_slot_list[bus]; | ||
1013 | dbg("%s: bus %x device %x index %x\n", | ||
1014 | __FUNCTION__, bus, device, index); | ||
1015 | if (func != NULL) { | ||
1016 | dbg("%s: func-> bus %x device %x function %x pci_dev %p\n", | ||
1017 | __FUNCTION__, func->bus, func->device, func->function, | ||
1018 | func->pci_dev); | ||
1019 | } else | ||
1020 | dbg("%s: func == NULL\n", __FUNCTION__); | ||
1021 | |||
1022 | if ((func == NULL) || ((func->device == device) && (index == 0))) | ||
1023 | return func; | ||
1024 | |||
1025 | if (func->device == device) | ||
1026 | found++; | ||
1027 | |||
1028 | while (func->next != NULL) { | ||
1029 | func = func->next; | ||
1030 | |||
1031 | dbg("%s: In while loop, func-> bus %x device %x function %x pci_dev %p\n", | ||
1032 | __FUNCTION__, func->bus, func->device, func->function, | ||
1033 | func->pci_dev); | ||
1034 | if (func->device == device) | ||
1035 | found++; | ||
1036 | dbg("%s: while loop, found %d, index %d\n", __FUNCTION__, | ||
1037 | found, index); | ||
1038 | |||
1039 | if ((found == index) || (func->function == index)) { | ||
1040 | dbg("%s: Found bus %x dev %x func %x\n", __FUNCTION__, | ||
1041 | func->bus, func->device, func->function); | ||
1042 | return func; | ||
1043 | } | ||
1044 | } | ||
1045 | |||
1046 | return NULL; | ||
1047 | } | ||
1048 | |||
1049 | static int is_bridge(struct pci_func * func) | ||
1050 | { | ||
1051 | /* Check the header type */ | ||
1052 | if (((func->config_space[0x03] >> 16) & 0xFF) == 0x01) | ||
1053 | return 1; | ||
1054 | else | ||
1055 | return 0; | ||
1056 | } | ||
1057 | |||
1058 | |||
1059 | /* The following routines constitute the bulk of the | 228 | /* The following routines constitute the bulk of the |
1060 | hotplug controller logic | 229 | hotplug controller logic |
1061 | */ | 230 | */ |
@@ -1100,20 +269,17 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
1100 | * Configures board | 269 | * Configures board |
1101 | * | 270 | * |
1102 | */ | 271 | */ |
1103 | static u32 board_added(struct pci_func * func, struct controller * ctrl) | 272 | static int board_added(struct slot *p_slot) |
1104 | { | 273 | { |
1105 | u8 hp_slot; | 274 | u8 hp_slot; |
1106 | int index; | 275 | int rc = 0; |
1107 | u32 temp_register = 0xFFFFFFFF; | 276 | struct controller *ctrl = p_slot->ctrl; |
1108 | u32 rc = 0; | ||
1109 | struct pci_func *new_func = NULL; | ||
1110 | struct slot *p_slot; | ||
1111 | struct resource_lists res_lists; | ||
1112 | 277 | ||
1113 | p_slot = pciehp_find_slot(ctrl, func->device); | 278 | hp_slot = p_slot->device - ctrl->slot_device_offset; |
1114 | hp_slot = func->device - ctrl->slot_device_offset; | ||
1115 | 279 | ||
1116 | dbg("%s: func->device, slot_offset, hp_slot = %d, %d ,%d\n", __FUNCTION__, func->device, ctrl->slot_device_offset, hp_slot); | 280 | dbg("%s: slot device, slot offset, hp slot = %d, %d ,%d\n", |
281 | __FUNCTION__, p_slot->device, | ||
282 | ctrl->slot_device_offset, hp_slot); | ||
1117 | 283 | ||
1118 | /* Wait for exclusive access to hardware */ | 284 | /* Wait for exclusive access to hardware */ |
1119 | down(&ctrl->crit_sect); | 285 | down(&ctrl->crit_sect); |
@@ -1141,9 +307,7 @@ static u32 board_added(struct pci_func * func, struct controller * ctrl) | |||
1141 | up(&ctrl->crit_sect); | 307 | up(&ctrl->crit_sect); |
1142 | 308 | ||
1143 | /* Wait for ~1 second */ | 309 | /* Wait for ~1 second */ |
1144 | dbg("%s: before long_delay\n", __FUNCTION__); | ||
1145 | wait_for_ctrl_irq (ctrl); | 310 | wait_for_ctrl_irq (ctrl); |
1146 | dbg("%s: afterlong_delay\n", __FUNCTION__); | ||
1147 | 311 | ||
1148 | /* Check link training status */ | 312 | /* Check link training status */ |
1149 | rc = p_slot->hpc_ops->check_lnk_status(ctrl); | 313 | rc = p_slot->hpc_ops->check_lnk_status(ctrl); |
@@ -1153,98 +317,47 @@ static u32 board_added(struct pci_func * func, struct controller * ctrl) | |||
1153 | return rc; | 317 | return rc; |
1154 | } | 318 | } |
1155 | 319 | ||
1156 | dbg("%s: func status = %x\n", __FUNCTION__, func->status); | 320 | dbg("%s: slot status = %x\n", __FUNCTION__, p_slot->status); |
1157 | 321 | ||
1158 | /* Check for a power fault */ | 322 | /* Check for a power fault */ |
1159 | if (func->status == 0xFF) { | 323 | if (p_slot->status == 0xFF) { |
1160 | /* power fault occurred, but it was benign */ | 324 | /* power fault occurred, but it was benign */ |
1161 | temp_register = 0xFFFFFFFF; | ||
1162 | dbg("%s: temp register set to %x by power fault\n", __FUNCTION__, temp_register); | ||
1163 | rc = POWER_FAILURE; | 325 | rc = POWER_FAILURE; |
1164 | func->status = 0; | 326 | p_slot->status = 0; |
1165 | } else { | 327 | goto err_exit; |
1166 | /* Get vendor/device ID u32 */ | ||
1167 | rc = pci_bus_read_config_dword (ctrl->pci_dev->subordinate, PCI_DEVFN(func->device, func->function), | ||
1168 | PCI_VENDOR_ID, &temp_register); | ||
1169 | dbg("%s: pci_bus_read_config_dword returns %d\n", __FUNCTION__, rc); | ||
1170 | dbg("%s: temp_register is %x\n", __FUNCTION__, temp_register); | ||
1171 | |||
1172 | if (rc != 0) { | ||
1173 | /* Something's wrong here */ | ||
1174 | temp_register = 0xFFFFFFFF; | ||
1175 | dbg("%s: temp register set to %x by error\n", __FUNCTION__, temp_register); | ||
1176 | } | ||
1177 | /* Preset return code. It will be changed later if things go okay. */ | ||
1178 | rc = NO_ADAPTER_PRESENT; | ||
1179 | } | 328 | } |
1180 | 329 | ||
1181 | /* All F's is an empty slot or an invalid board */ | 330 | rc = pciehp_configure_device(p_slot); |
1182 | if (temp_register != 0xFFFFFFFF) { /* Check for a board in the slot */ | 331 | if (rc) { |
1183 | res_lists.io_head = ctrl->io_head; | 332 | err("Cannot add device 0x%x:%x\n", p_slot->bus, |
1184 | res_lists.mem_head = ctrl->mem_head; | 333 | p_slot->device); |
1185 | res_lists.p_mem_head = ctrl->p_mem_head; | 334 | goto err_exit; |
1186 | res_lists.bus_head = ctrl->bus_head; | 335 | } |
1187 | res_lists.irqs = NULL; | ||
1188 | |||
1189 | rc = configure_new_device(ctrl, func, 0, &res_lists, 0, 0); | ||
1190 | dbg("%s: back from configure_new_device\n", __FUNCTION__); | ||
1191 | |||
1192 | ctrl->io_head = res_lists.io_head; | ||
1193 | ctrl->mem_head = res_lists.mem_head; | ||
1194 | ctrl->p_mem_head = res_lists.p_mem_head; | ||
1195 | ctrl->bus_head = res_lists.bus_head; | ||
1196 | 336 | ||
1197 | pciehp_resource_sort_and_combine(&(ctrl->mem_head)); | 337 | p_slot->status = 0; |
1198 | pciehp_resource_sort_and_combine(&(ctrl->p_mem_head)); | ||
1199 | pciehp_resource_sort_and_combine(&(ctrl->io_head)); | ||
1200 | pciehp_resource_sort_and_combine(&(ctrl->bus_head)); | ||
1201 | 338 | ||
1202 | if (rc) { | 339 | /* |
1203 | set_slot_off(ctrl, p_slot); | 340 | * Some PCI Express root ports require fixup after hot-plug operation. |
1204 | return rc; | 341 | */ |
1205 | } | 342 | if (pcie_mch_quirk) |
1206 | pciehp_save_slot_config(ctrl, func); | 343 | pci_fixup_device(pci_fixup_final, ctrl->pci_dev); |
1207 | 344 | if (PWR_LED(ctrl->ctrlcap)) { | |
1208 | func->status = 0; | 345 | /* Wait for exclusive access to hardware */ |
1209 | func->switch_save = 0x10; | 346 | down(&ctrl->crit_sect); |
1210 | func->is_a_board = 0x01; | ||
1211 | 347 | ||
1212 | /* next, we will instantiate the linux pci_dev structures | 348 | p_slot->hpc_ops->green_led_on(p_slot); |
1213 | * (with appropriate driver notification, if already present) | ||
1214 | */ | ||
1215 | index = 0; | ||
1216 | do { | ||
1217 | new_func = pciehp_slot_find(ctrl->slot_bus, func->device, index++); | ||
1218 | if (new_func && !new_func->pci_dev) { | ||
1219 | dbg("%s:call pci_hp_configure_dev, func %x\n", | ||
1220 | __FUNCTION__, index); | ||
1221 | pciehp_configure_device(ctrl, new_func); | ||
1222 | } | ||
1223 | } while (new_func); | ||
1224 | |||
1225 | /* | ||
1226 | * Some PCI Express root ports require fixup after hot-plug operation. | ||
1227 | */ | ||
1228 | if (pcie_mch_quirk) | ||
1229 | pci_fixup_device(pci_fixup_final, ctrl->pci_dev); | ||
1230 | |||
1231 | if (PWR_LED(ctrl->ctrlcap)) { | ||
1232 | /* Wait for exclusive access to hardware */ | ||
1233 | down(&ctrl->crit_sect); | ||
1234 | |||
1235 | p_slot->hpc_ops->green_led_on(p_slot); | ||
1236 | 349 | ||
1237 | /* Wait for the command to complete */ | 350 | /* Wait for the command to complete */ |
1238 | wait_for_ctrl_irq (ctrl); | 351 | wait_for_ctrl_irq (ctrl); |
1239 | 352 | ||
1240 | /* Done with exclusive hardware access */ | 353 | /* Done with exclusive hardware access */ |
1241 | up(&ctrl->crit_sect); | 354 | up(&ctrl->crit_sect); |
1242 | } | 355 | } |
1243 | } else { | ||
1244 | set_slot_off(ctrl, p_slot); | ||
1245 | return -1; | ||
1246 | } | ||
1247 | return 0; | 356 | return 0; |
357 | |||
358 | err_exit: | ||
359 | set_slot_off(ctrl, p_slot); | ||
360 | return -1; | ||
1248 | } | 361 | } |
1249 | 362 | ||
1250 | 363 | ||
@@ -1252,55 +365,25 @@ static u32 board_added(struct pci_func * func, struct controller * ctrl) | |||
1252 | * remove_board - Turns off slot and LED's | 365 | * remove_board - Turns off slot and LED's |
1253 | * | 366 | * |
1254 | */ | 367 | */ |
1255 | static u32 remove_board(struct pci_func *func, struct controller *ctrl) | 368 | static int remove_board(struct slot *p_slot) |
1256 | { | 369 | { |
1257 | int index; | ||
1258 | u8 skip = 0; | ||
1259 | u8 device; | 370 | u8 device; |
1260 | u8 hp_slot; | 371 | u8 hp_slot; |
1261 | u32 rc; | 372 | int rc; |
1262 | struct resource_lists res_lists; | 373 | struct controller *ctrl = p_slot->ctrl; |
1263 | struct pci_func *temp_func; | ||
1264 | struct slot *p_slot; | ||
1265 | |||
1266 | if (func == NULL) | ||
1267 | return 1; | ||
1268 | 374 | ||
1269 | if (pciehp_unconfigure_device(func)) | 375 | if (pciehp_unconfigure_device(p_slot)) |
1270 | return 1; | 376 | return 1; |
1271 | 377 | ||
1272 | device = func->device; | 378 | device = p_slot->device; |
1273 | 379 | ||
1274 | hp_slot = func->device - ctrl->slot_device_offset; | 380 | hp_slot = p_slot->device - ctrl->slot_device_offset; |
1275 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | 381 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); |
1276 | 382 | ||
1277 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); | 383 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); |
1278 | 384 | ||
1279 | if ((ctrl->add_support) && | ||
1280 | !(func->bus_head || func->mem_head || func->p_mem_head || func->io_head)) { | ||
1281 | /* Here we check to see if we've saved any of the board's | ||
1282 | * resources already. If so, we'll skip the attempt to | ||
1283 | * determine what's being used. | ||
1284 | */ | ||
1285 | index = 0; | ||
1286 | |||
1287 | temp_func = func; | ||
1288 | |||
1289 | while ((temp_func = pciehp_slot_find(temp_func->bus, temp_func->device, index++))) { | ||
1290 | if (temp_func->bus_head || temp_func->mem_head | ||
1291 | || temp_func->p_mem_head || temp_func->io_head) { | ||
1292 | skip = 1; | ||
1293 | break; | ||
1294 | } | ||
1295 | } | ||
1296 | |||
1297 | if (!skip) | ||
1298 | rc = pciehp_save_used_resources(ctrl, func, DISABLE_CARD); | ||
1299 | } | ||
1300 | /* Change status to shutdown */ | 385 | /* Change status to shutdown */ |
1301 | if (func->is_a_board) | 386 | p_slot->status = 0x01; |
1302 | func->status = 0x01; | ||
1303 | func->configured = 0; | ||
1304 | 387 | ||
1305 | /* Wait for exclusive access to hardware */ | 388 | /* Wait for exclusive access to hardware */ |
1306 | down(&ctrl->crit_sect); | 389 | down(&ctrl->crit_sect); |
@@ -1328,56 +411,6 @@ static u32 remove_board(struct pci_func *func, struct controller *ctrl) | |||
1328 | /* Done with exclusive hardware access */ | 411 | /* Done with exclusive hardware access */ |
1329 | up(&ctrl->crit_sect); | 412 | up(&ctrl->crit_sect); |
1330 | 413 | ||
1331 | if (ctrl->add_support) { | ||
1332 | while (func) { | ||
1333 | res_lists.io_head = ctrl->io_head; | ||
1334 | res_lists.mem_head = ctrl->mem_head; | ||
1335 | res_lists.p_mem_head = ctrl->p_mem_head; | ||
1336 | res_lists.bus_head = ctrl->bus_head; | ||
1337 | |||
1338 | dbg("Returning resources to ctlr lists for (B/D/F) = (%#x/%#x/%#x)\n", | ||
1339 | func->bus, func->device, func->function); | ||
1340 | |||
1341 | pciehp_return_board_resources(func, &res_lists); | ||
1342 | |||
1343 | ctrl->io_head = res_lists.io_head; | ||
1344 | ctrl->mem_head = res_lists.mem_head; | ||
1345 | ctrl->p_mem_head = res_lists.p_mem_head; | ||
1346 | ctrl->bus_head = res_lists.bus_head; | ||
1347 | |||
1348 | pciehp_resource_sort_and_combine(&(ctrl->mem_head)); | ||
1349 | pciehp_resource_sort_and_combine(&(ctrl->p_mem_head)); | ||
1350 | pciehp_resource_sort_and_combine(&(ctrl->io_head)); | ||
1351 | pciehp_resource_sort_and_combine(&(ctrl->bus_head)); | ||
1352 | |||
1353 | if (is_bridge(func)) { | ||
1354 | dbg("PCI Bridge Hot-Remove s:b:d:f(%02x:%02x:%02x:%02x)\n", | ||
1355 | ctrl->seg, func->bus, func->device, func->function); | ||
1356 | bridge_slot_remove(func); | ||
1357 | } else { | ||
1358 | dbg("PCI Function Hot-Remove s:b:d:f(%02x:%02x:%02x:%02x)\n", | ||
1359 | ctrl->seg, func->bus, func->device, func->function); | ||
1360 | slot_remove(func); | ||
1361 | } | ||
1362 | |||
1363 | func = pciehp_slot_find(ctrl->slot_bus, device, 0); | ||
1364 | } | ||
1365 | |||
1366 | /* Setup slot structure with entry for empty slot */ | ||
1367 | func = pciehp_slot_create(ctrl->slot_bus); | ||
1368 | |||
1369 | if (func == NULL) { | ||
1370 | return 1; | ||
1371 | } | ||
1372 | |||
1373 | func->bus = ctrl->slot_bus; | ||
1374 | func->device = device; | ||
1375 | func->function = 0; | ||
1376 | func->configured = 0; | ||
1377 | func->switch_save = 0x10; | ||
1378 | func->is_a_board = 0; | ||
1379 | } | ||
1380 | |||
1381 | return 0; | 414 | return 0; |
1382 | } | 415 | } |
1383 | 416 | ||
@@ -1411,13 +444,15 @@ static void pciehp_pushbutton_thread(unsigned long slot) | |||
1411 | p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 444 | p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
1412 | if (getstatus) { | 445 | if (getstatus) { |
1413 | p_slot->state = POWEROFF_STATE; | 446 | p_slot->state = POWEROFF_STATE; |
1414 | dbg("In power_down_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device); | 447 | dbg("%s: disabling bus:device(%x:%x)\n", __FUNCTION__, |
448 | p_slot->bus, p_slot->device); | ||
1415 | 449 | ||
1416 | pciehp_disable_slot(p_slot); | 450 | pciehp_disable_slot(p_slot); |
1417 | p_slot->state = STATIC_STATE; | 451 | p_slot->state = STATIC_STATE; |
1418 | } else { | 452 | } else { |
1419 | p_slot->state = POWERON_STATE; | 453 | p_slot->state = POWERON_STATE; |
1420 | dbg("In add_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device); | 454 | dbg("%s: adding bus:device(%x:%x)\n", __FUNCTION__, |
455 | p_slot->bus, p_slot->device); | ||
1421 | 456 | ||
1422 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { | 457 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { |
1423 | /* Wait for exclusive access to hardware */ | 458 | /* Wait for exclusive access to hardware */ |
@@ -1459,13 +494,15 @@ static void pciehp_surprise_rm_thread(unsigned long slot) | |||
1459 | p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 494 | p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
1460 | if (!getstatus) { | 495 | if (!getstatus) { |
1461 | p_slot->state = POWEROFF_STATE; | 496 | p_slot->state = POWEROFF_STATE; |
1462 | dbg("In removing board, b:d(%x:%x)\n", p_slot->bus, p_slot->device); | 497 | dbg("%s: removing bus:device(%x:%x)\n", |
498 | __FUNCTION__, p_slot->bus, p_slot->device); | ||
1463 | 499 | ||
1464 | pciehp_disable_slot(p_slot); | 500 | pciehp_disable_slot(p_slot); |
1465 | p_slot->state = STATIC_STATE; | 501 | p_slot->state = STATIC_STATE; |
1466 | } else { | 502 | } else { |
1467 | p_slot->state = POWERON_STATE; | 503 | p_slot->state = POWERON_STATE; |
1468 | dbg("In add_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device); | 504 | dbg("%s: adding bus:device(%x:%x)\n", |
505 | __FUNCTION__, p_slot->bus, p_slot->device); | ||
1469 | 506 | ||
1470 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { | 507 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { |
1471 | /* Wait for exclusive access to hardware */ | 508 | /* Wait for exclusive access to hardware */ |
@@ -1531,7 +568,6 @@ int pciehp_event_start_thread(void) | |||
1531 | err ("Can't start up our event thread\n"); | 568 | err ("Can't start up our event thread\n"); |
1532 | return -1; | 569 | return -1; |
1533 | } | 570 | } |
1534 | dbg("Our event thread pid = %d\n", pid); | ||
1535 | return 0; | 571 | return 0; |
1536 | } | 572 | } |
1537 | 573 | ||
@@ -1539,9 +575,7 @@ int pciehp_event_start_thread(void) | |||
1539 | void pciehp_event_stop_thread(void) | 575 | void pciehp_event_stop_thread(void) |
1540 | { | 576 | { |
1541 | event_finished = 1; | 577 | event_finished = 1; |
1542 | dbg("event_thread finish command given\n"); | ||
1543 | up(&event_semaphore); | 578 | up(&event_semaphore); |
1544 | dbg("wait for event_thread to exit\n"); | ||
1545 | down(&event_exit); | 579 | down(&event_exit); |
1546 | } | 580 | } |
1547 | 581 | ||
@@ -1573,7 +607,6 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
1573 | { | 607 | { |
1574 | int loop = 0; | 608 | int loop = 0; |
1575 | int change = 1; | 609 | int change = 1; |
1576 | struct pci_func *func; | ||
1577 | u8 hp_slot; | 610 | u8 hp_slot; |
1578 | u8 getstatus; | 611 | u8 getstatus; |
1579 | struct slot *p_slot; | 612 | struct slot *p_slot; |
@@ -1581,16 +614,12 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
1581 | while (change) { | 614 | while (change) { |
1582 | change = 0; | 615 | change = 0; |
1583 | 616 | ||
1584 | for (loop = 0; loop < 10; loop++) { | 617 | for (loop = 0; loop < MAX_EVENTS; loop++) { |
1585 | if (ctrl->event_queue[loop].event_type != 0) { | 618 | if (ctrl->event_queue[loop].event_type != 0) { |
1586 | hp_slot = ctrl->event_queue[loop].hp_slot; | 619 | hp_slot = ctrl->event_queue[loop].hp_slot; |
1587 | 620 | ||
1588 | func = pciehp_slot_find(ctrl->slot_bus, (hp_slot + ctrl->slot_device_offset), 0); | ||
1589 | |||
1590 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | 621 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); |
1591 | 622 | ||
1592 | dbg("hp_slot %d, func %p, p_slot %p\n", hp_slot, func, p_slot); | ||
1593 | |||
1594 | if (ctrl->event_queue[loop].event_type == INT_BUTTON_CANCEL) { | 623 | if (ctrl->event_queue[loop].event_type == INT_BUTTON_CANCEL) { |
1595 | dbg("button cancel\n"); | 624 | dbg("button cancel\n"); |
1596 | del_timer(&p_slot->task_event); | 625 | del_timer(&p_slot->task_event); |
@@ -1682,7 +711,6 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
1682 | p_slot->task_event.function = (void (*)(unsigned long)) pushbutton_helper_thread; | 711 | p_slot->task_event.function = (void (*)(unsigned long)) pushbutton_helper_thread; |
1683 | p_slot->task_event.data = (unsigned long) p_slot; | 712 | p_slot->task_event.data = (unsigned long) p_slot; |
1684 | 713 | ||
1685 | dbg("add_timer p_slot = %p\n", (void *) p_slot); | ||
1686 | add_timer(&p_slot->task_event); | 714 | add_timer(&p_slot->task_event); |
1687 | } | 715 | } |
1688 | } | 716 | } |
@@ -1737,13 +765,6 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
1737 | { | 765 | { |
1738 | u8 getstatus = 0; | 766 | u8 getstatus = 0; |
1739 | int rc; | 767 | int rc; |
1740 | struct pci_func *func; | ||
1741 | |||
1742 | func = pciehp_slot_find(p_slot->bus, p_slot->device, 0); | ||
1743 | if (!func) { | ||
1744 | dbg("%s: Error! slot NULL\n", __FUNCTION__); | ||
1745 | return 1; | ||
1746 | } | ||
1747 | 768 | ||
1748 | /* Check to see if (latch closed, card present, power off) */ | 769 | /* Check to see if (latch closed, card present, power off) */ |
1749 | down(&p_slot->ctrl->crit_sect); | 770 | down(&p_slot->ctrl->crit_sect); |
@@ -1773,45 +794,11 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
1773 | } | 794 | } |
1774 | up(&p_slot->ctrl->crit_sect); | 795 | up(&p_slot->ctrl->crit_sect); |
1775 | 796 | ||
1776 | slot_remove(func); | ||
1777 | |||
1778 | func = pciehp_slot_create(p_slot->bus); | ||
1779 | if (func == NULL) | ||
1780 | return 1; | ||
1781 | |||
1782 | func->bus = p_slot->bus; | ||
1783 | func->device = p_slot->device; | ||
1784 | func->function = 0; | ||
1785 | func->configured = 0; | ||
1786 | func->is_a_board = 1; | ||
1787 | |||
1788 | /* We have to save the presence info for these slots */ | ||
1789 | p_slot->hpc_ops->get_adapter_status(p_slot, &(func->presence_save)); | ||
1790 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 797 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
1791 | func->switch_save = !getstatus? 0x10:0; | ||
1792 | 798 | ||
1793 | rc = board_added(func, p_slot->ctrl); | 799 | rc = board_added(p_slot); |
1794 | if (rc) { | 800 | if (rc) { |
1795 | if (is_bridge(func)) | ||
1796 | bridge_slot_remove(func); | ||
1797 | else | ||
1798 | slot_remove(func); | ||
1799 | |||
1800 | /* Setup slot structure with entry for empty slot */ | ||
1801 | func = pciehp_slot_create(p_slot->bus); | ||
1802 | if (func == NULL) | ||
1803 | return 1; /* Out of memory */ | ||
1804 | |||
1805 | func->bus = p_slot->bus; | ||
1806 | func->device = p_slot->device; | ||
1807 | func->function = 0; | ||
1808 | func->configured = 0; | ||
1809 | func->is_a_board = 1; | ||
1810 | |||
1811 | /* We have to save the presence info for these slots */ | ||
1812 | p_slot->hpc_ops->get_adapter_status(p_slot, &(func->presence_save)); | ||
1813 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 801 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
1814 | func->switch_save = !getstatus? 0x10:0; | ||
1815 | } | 802 | } |
1816 | 803 | ||
1817 | if (p_slot) | 804 | if (p_slot) |
@@ -1823,14 +810,8 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
1823 | 810 | ||
1824 | int pciehp_disable_slot(struct slot *p_slot) | 811 | int pciehp_disable_slot(struct slot *p_slot) |
1825 | { | 812 | { |
1826 | u8 class_code, header_type, BCR; | ||
1827 | u8 index = 0; | ||
1828 | u8 getstatus = 0; | 813 | u8 getstatus = 0; |
1829 | u32 rc = 0; | ||
1830 | int ret = 0; | 814 | int ret = 0; |
1831 | unsigned int devfn; | ||
1832 | struct pci_bus *pci_bus = p_slot->ctrl->pci_dev->subordinate; | ||
1833 | struct pci_func *func; | ||
1834 | 815 | ||
1835 | if (!p_slot->ctrl) | 816 | if (!p_slot->ctrl) |
1836 | return 1; | 817 | return 1; |
@@ -1867,838 +848,8 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
1867 | 848 | ||
1868 | up(&p_slot->ctrl->crit_sect); | 849 | up(&p_slot->ctrl->crit_sect); |
1869 | 850 | ||
1870 | func = pciehp_slot_find(p_slot->bus, p_slot->device, index++); | 851 | ret = remove_board(p_slot); |
1871 | 852 | update_slot_info(p_slot); | |
1872 | /* Make sure there are no video controllers here | 853 | return ret; |
1873 | * for all func of p_slot | ||
1874 | */ | ||
1875 | while (func && !rc) { | ||
1876 | pci_bus->number = func->bus; | ||
1877 | devfn = PCI_DEVFN(func->device, func->function); | ||
1878 | |||
1879 | /* Check the Class Code */ | ||
1880 | rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code); | ||
1881 | if (rc) | ||
1882 | return rc; | ||
1883 | |||
1884 | if (class_code == PCI_BASE_CLASS_DISPLAY) { | ||
1885 | /* Display/Video adapter (not supported) */ | ||
1886 | rc = REMOVE_NOT_SUPPORTED; | ||
1887 | } else { | ||
1888 | /* See if it's a bridge */ | ||
1889 | rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type); | ||
1890 | if (rc) | ||
1891 | return rc; | ||
1892 | |||
1893 | /* If it's a bridge, check the VGA Enable bit */ | ||
1894 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { | ||
1895 | rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_BRIDGE_CONTROL, &BCR); | ||
1896 | if (rc) | ||
1897 | return rc; | ||
1898 | |||
1899 | /* If the VGA Enable bit is set, remove isn't supported */ | ||
1900 | if (BCR & PCI_BRIDGE_CTL_VGA) { | ||
1901 | rc = REMOVE_NOT_SUPPORTED; | ||
1902 | } | ||
1903 | } | ||
1904 | } | ||
1905 | |||
1906 | func = pciehp_slot_find(p_slot->bus, p_slot->device, index++); | ||
1907 | } | ||
1908 | |||
1909 | func = pciehp_slot_find(p_slot->bus, p_slot->device, 0); | ||
1910 | if ((func != NULL) && !rc) { | ||
1911 | rc = remove_board(func, p_slot->ctrl); | ||
1912 | } else if (!rc) | ||
1913 | rc = 1; | ||
1914 | |||
1915 | if (p_slot) | ||
1916 | update_slot_info(p_slot); | ||
1917 | |||
1918 | return rc; | ||
1919 | } | ||
1920 | |||
1921 | |||
1922 | /** | ||
1923 | * configure_new_device - Configures the PCI header information of one board. | ||
1924 | * | ||
1925 | * @ctrl: pointer to controller structure | ||
1926 | * @func: pointer to function structure | ||
1927 | * @behind_bridge: 1 if this is a recursive call, 0 if not | ||
1928 | * @resources: pointer to set of resource lists | ||
1929 | * | ||
1930 | * Returns 0 if success | ||
1931 | * | ||
1932 | */ | ||
1933 | static u32 configure_new_device(struct controller * ctrl, struct pci_func * func, | ||
1934 | u8 behind_bridge, struct resource_lists * resources, u8 bridge_bus, u8 bridge_dev) | ||
1935 | { | ||
1936 | u8 temp_byte, function, max_functions, stop_it; | ||
1937 | int rc; | ||
1938 | u32 ID; | ||
1939 | struct pci_func *new_slot; | ||
1940 | struct pci_bus lpci_bus, *pci_bus; | ||
1941 | int index; | ||
1942 | |||
1943 | new_slot = func; | ||
1944 | |||
1945 | dbg("%s\n", __FUNCTION__); | ||
1946 | memcpy(&lpci_bus, ctrl->pci_dev->subordinate, sizeof(lpci_bus)); | ||
1947 | pci_bus = &lpci_bus; | ||
1948 | pci_bus->number = func->bus; | ||
1949 | |||
1950 | /* Check for Multi-function device */ | ||
1951 | rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(func->device, func->function), 0x0E, &temp_byte); | ||
1952 | if (rc) { | ||
1953 | dbg("%s: rc = %d\n", __FUNCTION__, rc); | ||
1954 | return rc; | ||
1955 | } | ||
1956 | |||
1957 | if (temp_byte & 0x80) /* Multi-function device */ | ||
1958 | max_functions = 8; | ||
1959 | else | ||
1960 | max_functions = 1; | ||
1961 | |||
1962 | function = 0; | ||
1963 | |||
1964 | do { | ||
1965 | rc = configure_new_function(ctrl, new_slot, behind_bridge, | ||
1966 | resources, bridge_bus, bridge_dev); | ||
1967 | |||
1968 | if (rc) { | ||
1969 | dbg("configure_new_function failed: %d\n", rc); | ||
1970 | index = 0; | ||
1971 | |||
1972 | while (new_slot) { | ||
1973 | new_slot = pciehp_slot_find(new_slot->bus, | ||
1974 | new_slot->device, index++); | ||
1975 | |||
1976 | if (new_slot) | ||
1977 | pciehp_return_board_resources(new_slot, | ||
1978 | resources); | ||
1979 | } | ||
1980 | |||
1981 | return rc; | ||
1982 | } | ||
1983 | |||
1984 | function++; | ||
1985 | |||
1986 | stop_it = 0; | ||
1987 | |||
1988 | /* The following loop skips to the next present function | ||
1989 | * and creates a board structure | ||
1990 | */ | ||
1991 | |||
1992 | while ((function < max_functions) && (!stop_it)) { | ||
1993 | pci_bus_read_config_dword(pci_bus, PCI_DEVFN(func->device, function), 0x00, &ID); | ||
1994 | |||
1995 | if (ID == 0xFFFFFFFF) { /* There's nothing there. */ | ||
1996 | function++; | ||
1997 | } else { /* There's something there */ | ||
1998 | /* Setup slot structure. */ | ||
1999 | new_slot = pciehp_slot_create(func->bus); | ||
2000 | |||
2001 | if (new_slot == NULL) { | ||
2002 | /* Out of memory */ | ||
2003 | return 1; | ||
2004 | } | ||
2005 | |||
2006 | new_slot->bus = func->bus; | ||
2007 | new_slot->device = func->device; | ||
2008 | new_slot->function = function; | ||
2009 | new_slot->is_a_board = 1; | ||
2010 | new_slot->status = 0; | ||
2011 | |||
2012 | stop_it++; | ||
2013 | } | ||
2014 | } | ||
2015 | |||
2016 | } while (function < max_functions); | ||
2017 | dbg("returning from %s\n", __FUNCTION__); | ||
2018 | |||
2019 | return 0; | ||
2020 | } | ||
2021 | |||
2022 | /* | ||
2023 | * Configuration logic that involves the hotplug data structures and | ||
2024 | * their bookkeeping | ||
2025 | */ | ||
2026 | |||
2027 | /** | ||
2028 | * configure_bridge: fill bridge's registers, either configure or disable it. | ||
2029 | */ | ||
2030 | static int | ||
2031 | configure_bridge(struct pci_bus *pci_bus, unsigned int devfn, | ||
2032 | struct pci_resource *mem_node, | ||
2033 | struct pci_resource **hold_mem_node, | ||
2034 | int base_addr, int limit_addr) | ||
2035 | { | ||
2036 | u16 temp_word; | ||
2037 | u32 rc; | ||
2038 | |||
2039 | if (mem_node) { | ||
2040 | memcpy(*hold_mem_node, mem_node, sizeof(struct pci_resource)); | ||
2041 | mem_node->next = NULL; | ||
2042 | |||
2043 | /* set Mem base and Limit registers */ | ||
2044 | RES_CHECK(mem_node->base, 16); | ||
2045 | temp_word = (u16)(mem_node->base >> 16); | ||
2046 | rc = pci_bus_write_config_word(pci_bus, devfn, base_addr, temp_word); | ||
2047 | |||
2048 | RES_CHECK(mem_node->base + mem_node->length - 1, 16); | ||
2049 | temp_word = (u16)((mem_node->base + mem_node->length - 1) >> 16); | ||
2050 | rc = pci_bus_write_config_word(pci_bus, devfn, limit_addr, temp_word); | ||
2051 | } else { | ||
2052 | temp_word = 0xFFFF; | ||
2053 | rc = pci_bus_write_config_word(pci_bus, devfn, base_addr, temp_word); | ||
2054 | |||
2055 | temp_word = 0x0000; | ||
2056 | rc = pci_bus_write_config_word(pci_bus, devfn, limit_addr, temp_word); | ||
2057 | |||
2058 | kfree(*hold_mem_node); | ||
2059 | *hold_mem_node = NULL; | ||
2060 | } | ||
2061 | return rc; | ||
2062 | } | ||
2063 | |||
2064 | static int | ||
2065 | configure_new_bridge(struct controller *ctrl, struct pci_func *func, | ||
2066 | u8 behind_bridge, struct resource_lists *resources, | ||
2067 | struct pci_bus *pci_bus) | ||
2068 | { | ||
2069 | int cloop; | ||
2070 | u8 temp_byte; | ||
2071 | u8 device; | ||
2072 | u16 temp_word; | ||
2073 | u32 rc; | ||
2074 | u32 ID; | ||
2075 | unsigned int devfn; | ||
2076 | struct pci_resource *mem_node; | ||
2077 | struct pci_resource *p_mem_node; | ||
2078 | struct pci_resource *io_node; | ||
2079 | struct pci_resource *bus_node; | ||
2080 | struct pci_resource *hold_mem_node; | ||
2081 | struct pci_resource *hold_p_mem_node; | ||
2082 | struct pci_resource *hold_IO_node; | ||
2083 | struct pci_resource *hold_bus_node; | ||
2084 | struct irq_mapping irqs; | ||
2085 | struct pci_func *new_slot; | ||
2086 | struct resource_lists temp_resources; | ||
2087 | |||
2088 | devfn = PCI_DEVFN(func->device, func->function); | ||
2089 | |||
2090 | /* set Primary bus */ | ||
2091 | dbg("set Primary bus = 0x%x\n", func->bus); | ||
2092 | rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_PRIMARY_BUS, func->bus); | ||
2093 | if (rc) | ||
2094 | return rc; | ||
2095 | |||
2096 | /* find range of busses to use */ | ||
2097 | bus_node = get_max_resource(&resources->bus_head, 1L); | ||
2098 | |||
2099 | /* If we don't have any busses to allocate, we can't continue */ | ||
2100 | if (!bus_node) { | ||
2101 | err("Got NO bus resource to use\n"); | ||
2102 | return -ENOMEM; | ||
2103 | } | ||
2104 | dbg("Got ranges of buses to use: base:len=0x%x:%x\n", bus_node->base, bus_node->length); | ||
2105 | |||
2106 | /* set Secondary bus */ | ||
2107 | temp_byte = (u8)bus_node->base; | ||
2108 | dbg("set Secondary bus = 0x%x\n", temp_byte); | ||
2109 | rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, temp_byte); | ||
2110 | if (rc) | ||
2111 | return rc; | ||
2112 | |||
2113 | /* set subordinate bus */ | ||
2114 | temp_byte = (u8)(bus_node->base + bus_node->length - 1); | ||
2115 | dbg("set subordinate bus = 0x%x\n", temp_byte); | ||
2116 | rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte); | ||
2117 | if (rc) | ||
2118 | return rc; | ||
2119 | |||
2120 | /* Set HP parameters (Cache Line Size, Latency Timer) */ | ||
2121 | rc = pciehprm_set_hpp(ctrl, func, PCI_HEADER_TYPE_BRIDGE); | ||
2122 | if (rc) | ||
2123 | return rc; | ||
2124 | |||
2125 | /* Setup the IO, memory, and prefetchable windows */ | ||
2126 | |||
2127 | io_node = get_max_resource(&(resources->io_head), 0x1000L); | ||
2128 | if (io_node) { | ||
2129 | dbg("io_node(base, len, next) (%x, %x, %p)\n", io_node->base, | ||
2130 | io_node->length, io_node->next); | ||
2131 | } | ||
2132 | |||
2133 | mem_node = get_max_resource(&(resources->mem_head), 0x100000L); | ||
2134 | if (mem_node) { | ||
2135 | dbg("mem_node(base, len, next) (%x, %x, %p)\n", mem_node->base, | ||
2136 | mem_node->length, mem_node->next); | ||
2137 | } | ||
2138 | |||
2139 | if (resources->p_mem_head) | ||
2140 | p_mem_node = get_max_resource(&(resources->p_mem_head), 0x100000L); | ||
2141 | else { | ||
2142 | /* | ||
2143 | * In some platform implementation, MEM and PMEM are not | ||
2144 | * distinguished, and hence ACPI _CRS has only MEM entries | ||
2145 | * for both MEM and PMEM. | ||
2146 | */ | ||
2147 | dbg("using MEM for PMEM\n"); | ||
2148 | p_mem_node = get_max_resource(&(resources->mem_head), 0x100000L); | ||
2149 | } | ||
2150 | if (p_mem_node) { | ||
2151 | dbg("p_mem_node(base, len, next) (%x, %x, %p)\n", p_mem_node->base, | ||
2152 | p_mem_node->length, p_mem_node->next); | ||
2153 | } | ||
2154 | |||
2155 | /* set up the IRQ info */ | ||
2156 | if (!resources->irqs) { | ||
2157 | irqs.barber_pole = 0; | ||
2158 | irqs.interrupt[0] = 0; | ||
2159 | irqs.interrupt[1] = 0; | ||
2160 | irqs.interrupt[2] = 0; | ||
2161 | irqs.interrupt[3] = 0; | ||
2162 | irqs.valid_INT = 0; | ||
2163 | } else { | ||
2164 | irqs.barber_pole = resources->irqs->barber_pole; | ||
2165 | irqs.interrupt[0] = resources->irqs->interrupt[0]; | ||
2166 | irqs.interrupt[1] = resources->irqs->interrupt[1]; | ||
2167 | irqs.interrupt[2] = resources->irqs->interrupt[2]; | ||
2168 | irqs.interrupt[3] = resources->irqs->interrupt[3]; | ||
2169 | irqs.valid_INT = resources->irqs->valid_INT; | ||
2170 | } | ||
2171 | |||
2172 | /* set up resource lists that are now aligned on top and bottom | ||
2173 | * for anything behind the bridge. | ||
2174 | */ | ||
2175 | temp_resources.bus_head = bus_node; | ||
2176 | temp_resources.io_head = io_node; | ||
2177 | temp_resources.mem_head = mem_node; | ||
2178 | temp_resources.p_mem_head = p_mem_node; | ||
2179 | temp_resources.irqs = &irqs; | ||
2180 | |||
2181 | /* Make copies of the nodes we are going to pass down so that | ||
2182 | * if there is a problem,we can just use these to free resources | ||
2183 | */ | ||
2184 | hold_bus_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
2185 | hold_IO_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
2186 | hold_mem_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
2187 | hold_p_mem_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
2188 | |||
2189 | if (!hold_bus_node || !hold_IO_node || !hold_mem_node || !hold_p_mem_node) { | ||
2190 | kfree(hold_bus_node); | ||
2191 | kfree(hold_IO_node); | ||
2192 | kfree(hold_mem_node); | ||
2193 | kfree(hold_p_mem_node); | ||
2194 | |||
2195 | return 1; | ||
2196 | } | ||
2197 | |||
2198 | memcpy(hold_bus_node, bus_node, sizeof(struct pci_resource)); | ||
2199 | |||
2200 | bus_node->base += 1; | ||
2201 | bus_node->length -= 1; | ||
2202 | bus_node->next = NULL; | ||
2203 | |||
2204 | /* If we have IO resources copy them and fill in the bridge's | ||
2205 | * IO range registers | ||
2206 | */ | ||
2207 | if (io_node) { | ||
2208 | memcpy(hold_IO_node, io_node, sizeof(struct pci_resource)); | ||
2209 | io_node->next = NULL; | ||
2210 | |||
2211 | /* set IO base and Limit registers */ | ||
2212 | RES_CHECK(io_node->base, 8); | ||
2213 | temp_byte = (u8)(io_node->base >> 8); | ||
2214 | rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_BASE, temp_byte); | ||
2215 | |||
2216 | RES_CHECK(io_node->base + io_node->length - 1, 8); | ||
2217 | temp_byte = (u8)((io_node->base + io_node->length - 1) >> 8); | ||
2218 | rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_LIMIT, temp_byte); | ||
2219 | } else { | ||
2220 | kfree(hold_IO_node); | ||
2221 | hold_IO_node = NULL; | ||
2222 | } | ||
2223 | |||
2224 | /* If we have memory resources copy them and fill in the bridge's | ||
2225 | * memory range registers. Otherwise, fill in the range | ||
2226 | * registers with values that disable them. | ||
2227 | */ | ||
2228 | rc = configure_bridge(pci_bus, devfn, mem_node, &hold_mem_node, | ||
2229 | PCI_MEMORY_BASE, PCI_MEMORY_LIMIT); | ||
2230 | |||
2231 | /* If we have prefetchable memory resources copy them and | ||
2232 | * fill in the bridge's memory range registers. Otherwise, | ||
2233 | * fill in the range registers with values that disable them. | ||
2234 | */ | ||
2235 | rc = configure_bridge(pci_bus, devfn, p_mem_node, &hold_p_mem_node, | ||
2236 | PCI_PREF_MEMORY_BASE, PCI_PREF_MEMORY_LIMIT); | ||
2237 | |||
2238 | /* Adjust this to compensate for extra adjustment in first loop */ | ||
2239 | irqs.barber_pole--; | ||
2240 | |||
2241 | rc = 0; | ||
2242 | |||
2243 | /* Here we actually find the devices and configure them */ | ||
2244 | for (device = 0; (device <= 0x1F) && !rc; device++) { | ||
2245 | irqs.barber_pole = (irqs.barber_pole + 1) & 0x03; | ||
2246 | |||
2247 | ID = 0xFFFFFFFF; | ||
2248 | pci_bus->number = hold_bus_node->base; | ||
2249 | pci_bus_read_config_dword (pci_bus, PCI_DEVFN(device, 0), PCI_VENDOR_ID, &ID); | ||
2250 | pci_bus->number = func->bus; | ||
2251 | |||
2252 | if (ID != 0xFFFFFFFF) { /* device Present */ | ||
2253 | /* Setup slot structure. */ | ||
2254 | new_slot = pciehp_slot_create(hold_bus_node->base); | ||
2255 | |||
2256 | if (new_slot == NULL) { | ||
2257 | /* Out of memory */ | ||
2258 | rc = -ENOMEM; | ||
2259 | continue; | ||
2260 | } | ||
2261 | |||
2262 | new_slot->bus = hold_bus_node->base; | ||
2263 | new_slot->device = device; | ||
2264 | new_slot->function = 0; | ||
2265 | new_slot->is_a_board = 1; | ||
2266 | new_slot->status = 0; | ||
2267 | |||
2268 | rc = configure_new_device(ctrl, new_slot, 1, | ||
2269 | &temp_resources, func->bus, | ||
2270 | func->device); | ||
2271 | dbg("configure_new_device rc=0x%x\n",rc); | ||
2272 | } /* End of IF (device in slot?) */ | ||
2273 | } /* End of FOR loop */ | ||
2274 | |||
2275 | if (rc) { | ||
2276 | pciehp_destroy_resource_list(&temp_resources); | ||
2277 | |||
2278 | return_resource(&(resources->bus_head), hold_bus_node); | ||
2279 | return_resource(&(resources->io_head), hold_IO_node); | ||
2280 | return_resource(&(resources->mem_head), hold_mem_node); | ||
2281 | return_resource(&(resources->p_mem_head), hold_p_mem_node); | ||
2282 | return(rc); | ||
2283 | } | ||
2284 | |||
2285 | /* save the interrupt routing information */ | ||
2286 | if (resources->irqs) { | ||
2287 | resources->irqs->interrupt[0] = irqs.interrupt[0]; | ||
2288 | resources->irqs->interrupt[1] = irqs.interrupt[1]; | ||
2289 | resources->irqs->interrupt[2] = irqs.interrupt[2]; | ||
2290 | resources->irqs->interrupt[3] = irqs.interrupt[3]; | ||
2291 | resources->irqs->valid_INT = irqs.valid_INT; | ||
2292 | } else if (!behind_bridge) { | ||
2293 | /* We need to hook up the interrupts here */ | ||
2294 | for (cloop = 0; cloop < 4; cloop++) { | ||
2295 | if (irqs.valid_INT & (0x01 << cloop)) { | ||
2296 | rc = pciehp_set_irq(func->bus, func->device, | ||
2297 | 0x0A + cloop, irqs.interrupt[cloop]); | ||
2298 | if (rc) { | ||
2299 | pciehp_destroy_resource_list (&temp_resources); | ||
2300 | return_resource(&(resources->bus_head), hold_bus_node); | ||
2301 | return_resource(&(resources->io_head), hold_IO_node); | ||
2302 | return_resource(&(resources->mem_head), hold_mem_node); | ||
2303 | return_resource(&(resources->p_mem_head), hold_p_mem_node); | ||
2304 | return rc; | ||
2305 | } | ||
2306 | } | ||
2307 | } /* end of for loop */ | ||
2308 | } | ||
2309 | |||
2310 | /* Return unused bus resources | ||
2311 | * First use the temporary node to store information for the board | ||
2312 | */ | ||
2313 | if (hold_bus_node && bus_node && temp_resources.bus_head) { | ||
2314 | hold_bus_node->length = bus_node->base - hold_bus_node->base; | ||
2315 | |||
2316 | hold_bus_node->next = func->bus_head; | ||
2317 | func->bus_head = hold_bus_node; | ||
2318 | |||
2319 | temp_byte = (u8)(temp_resources.bus_head->base - 1); | ||
2320 | |||
2321 | /* set subordinate bus */ | ||
2322 | dbg("re-set subordinate bus = 0x%x\n", temp_byte); | ||
2323 | rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte); | ||
2324 | |||
2325 | if (temp_resources.bus_head->length == 0) { | ||
2326 | kfree(temp_resources.bus_head); | ||
2327 | temp_resources.bus_head = NULL; | ||
2328 | } else { | ||
2329 | dbg("return bus res of b:d(0x%x:%x) base:len(0x%x:%x)\n", | ||
2330 | func->bus, func->device, temp_resources.bus_head->base, temp_resources.bus_head->length); | ||
2331 | return_resource(&(resources->bus_head), temp_resources.bus_head); | ||
2332 | } | ||
2333 | } | ||
2334 | |||
2335 | /* If we have IO space available and there is some left, | ||
2336 | * return the unused portion | ||
2337 | */ | ||
2338 | if (hold_IO_node && temp_resources.io_head) { | ||
2339 | io_node = do_pre_bridge_resource_split(&(temp_resources.io_head), | ||
2340 | &hold_IO_node, 0x1000); | ||
2341 | |||
2342 | /* Check if we were able to split something off */ | ||
2343 | if (io_node) { | ||
2344 | hold_IO_node->base = io_node->base + io_node->length; | ||
2345 | |||
2346 | RES_CHECK(hold_IO_node->base, 8); | ||
2347 | temp_byte = (u8)((hold_IO_node->base) >> 8); | ||
2348 | rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_BASE, temp_byte); | ||
2349 | |||
2350 | return_resource(&(resources->io_head), io_node); | ||
2351 | } | ||
2352 | |||
2353 | io_node = do_bridge_resource_split(&(temp_resources.io_head), 0x1000); | ||
2354 | |||
2355 | /* Check if we were able to split something off */ | ||
2356 | if (io_node) { | ||
2357 | /* First use the temporary node to store information for the board */ | ||
2358 | hold_IO_node->length = io_node->base - hold_IO_node->base; | ||
2359 | |||
2360 | /* If we used any, add it to the board's list */ | ||
2361 | if (hold_IO_node->length) { | ||
2362 | hold_IO_node->next = func->io_head; | ||
2363 | func->io_head = hold_IO_node; | ||
2364 | |||
2365 | RES_CHECK(io_node->base - 1, 8); | ||
2366 | temp_byte = (u8)((io_node->base - 1) >> 8); | ||
2367 | rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_LIMIT, temp_byte); | ||
2368 | |||
2369 | return_resource(&(resources->io_head), io_node); | ||
2370 | } else { | ||
2371 | /* it doesn't need any IO */ | ||
2372 | temp_byte = 0x00; | ||
2373 | rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte); | ||
2374 | |||
2375 | return_resource(&(resources->io_head), io_node); | ||
2376 | kfree(hold_IO_node); | ||
2377 | } | ||
2378 | } else { | ||
2379 | /* it used most of the range */ | ||
2380 | hold_IO_node->next = func->io_head; | ||
2381 | func->io_head = hold_IO_node; | ||
2382 | } | ||
2383 | } else if (hold_IO_node) { | ||
2384 | /* it used the whole range */ | ||
2385 | hold_IO_node->next = func->io_head; | ||
2386 | func->io_head = hold_IO_node; | ||
2387 | } | ||
2388 | |||
2389 | /* If we have memory space available and there is some left, | ||
2390 | * return the unused portion | ||
2391 | */ | ||
2392 | if (hold_mem_node && temp_resources.mem_head) { | ||
2393 | mem_node = do_pre_bridge_resource_split(&(temp_resources.mem_head), &hold_mem_node, 0x100000L); | ||
2394 | |||
2395 | /* Check if we were able to split something off */ | ||
2396 | if (mem_node) { | ||
2397 | hold_mem_node->base = mem_node->base + mem_node->length; | ||
2398 | |||
2399 | RES_CHECK(hold_mem_node->base, 16); | ||
2400 | temp_word = (u16)((hold_mem_node->base) >> 16); | ||
2401 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_BASE, temp_word); | ||
2402 | |||
2403 | return_resource(&(resources->mem_head), mem_node); | ||
2404 | } | ||
2405 | |||
2406 | mem_node = do_bridge_resource_split(&(temp_resources.mem_head), 0x100000L); | ||
2407 | |||
2408 | /* Check if we were able to split something off */ | ||
2409 | if (mem_node) { | ||
2410 | /* First use the temporary node to store information for the board */ | ||
2411 | hold_mem_node->length = mem_node->base - hold_mem_node->base; | ||
2412 | |||
2413 | if (hold_mem_node->length) { | ||
2414 | hold_mem_node->next = func->mem_head; | ||
2415 | func->mem_head = hold_mem_node; | ||
2416 | |||
2417 | /* configure end address */ | ||
2418 | RES_CHECK(mem_node->base - 1, 16); | ||
2419 | temp_word = (u16)((mem_node->base - 1) >> 16); | ||
2420 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word); | ||
2421 | |||
2422 | /* Return unused resources to the pool */ | ||
2423 | return_resource(&(resources->mem_head), mem_node); | ||
2424 | } else { | ||
2425 | /* it doesn't need any Mem */ | ||
2426 | temp_word = 0x0000; | ||
2427 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word); | ||
2428 | |||
2429 | return_resource(&(resources->mem_head), mem_node); | ||
2430 | kfree(hold_mem_node); | ||
2431 | } | ||
2432 | } else { | ||
2433 | /* it used most of the range */ | ||
2434 | hold_mem_node->next = func->mem_head; | ||
2435 | func->mem_head = hold_mem_node; | ||
2436 | } | ||
2437 | } else if (hold_mem_node) { | ||
2438 | /* it used the whole range */ | ||
2439 | hold_mem_node->next = func->mem_head; | ||
2440 | func->mem_head = hold_mem_node; | ||
2441 | } | ||
2442 | |||
2443 | /* If we have prefetchable memory space available and there is some | ||
2444 | * left at the end, return the unused portion | ||
2445 | */ | ||
2446 | if (hold_p_mem_node && temp_resources.p_mem_head) { | ||
2447 | p_mem_node = do_pre_bridge_resource_split(&(temp_resources.p_mem_head), | ||
2448 | &hold_p_mem_node, 0x100000L); | ||
2449 | |||
2450 | /* Check if we were able to split something off */ | ||
2451 | if (p_mem_node) { | ||
2452 | hold_p_mem_node->base = p_mem_node->base + p_mem_node->length; | ||
2453 | |||
2454 | RES_CHECK(hold_p_mem_node->base, 16); | ||
2455 | temp_word = (u16)((hold_p_mem_node->base) >> 16); | ||
2456 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word); | ||
2457 | |||
2458 | return_resource(&(resources->p_mem_head), p_mem_node); | ||
2459 | } | ||
2460 | |||
2461 | p_mem_node = do_bridge_resource_split(&(temp_resources.p_mem_head), 0x100000L); | ||
2462 | |||
2463 | /* Check if we were able to split something off */ | ||
2464 | if (p_mem_node) { | ||
2465 | /* First use the temporary node to store information for the board */ | ||
2466 | hold_p_mem_node->length = p_mem_node->base - hold_p_mem_node->base; | ||
2467 | |||
2468 | /* If we used any, add it to the board's list */ | ||
2469 | if (hold_p_mem_node->length) { | ||
2470 | hold_p_mem_node->next = func->p_mem_head; | ||
2471 | func->p_mem_head = hold_p_mem_node; | ||
2472 | |||
2473 | RES_CHECK(p_mem_node->base - 1, 16); | ||
2474 | temp_word = (u16)((p_mem_node->base - 1) >> 16); | ||
2475 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); | ||
2476 | |||
2477 | return_resource(&(resources->p_mem_head), p_mem_node); | ||
2478 | } else { | ||
2479 | /* it doesn't need any PMem */ | ||
2480 | temp_word = 0x0000; | ||
2481 | rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); | ||
2482 | |||
2483 | return_resource(&(resources->p_mem_head), p_mem_node); | ||
2484 | kfree(hold_p_mem_node); | ||
2485 | } | ||
2486 | } else { | ||
2487 | /* it used the most of the range */ | ||
2488 | hold_p_mem_node->next = func->p_mem_head; | ||
2489 | func->p_mem_head = hold_p_mem_node; | ||
2490 | } | ||
2491 | } else if (hold_p_mem_node) { | ||
2492 | /* it used the whole range */ | ||
2493 | hold_p_mem_node->next = func->p_mem_head; | ||
2494 | func->p_mem_head = hold_p_mem_node; | ||
2495 | } | ||
2496 | |||
2497 | /* We should be configuring an IRQ and the bridge's base address | ||
2498 | * registers if it needs them. Although we have never seen such | ||
2499 | * a device | ||
2500 | */ | ||
2501 | |||
2502 | pciehprm_enable_card(ctrl, func, PCI_HEADER_TYPE_BRIDGE); | ||
2503 | |||
2504 | dbg("PCI Bridge Hot-Added s:b:d:f(%02x:%02x:%02x:%02x)\n", ctrl->seg, func->bus, func->device, func->function); | ||
2505 | |||
2506 | return rc; | ||
2507 | } | 854 | } |
2508 | 855 | ||
2509 | /** | ||
2510 | * configure_new_function - Configures the PCI header information of one device | ||
2511 | * | ||
2512 | * @ctrl: pointer to controller structure | ||
2513 | * @func: pointer to function structure | ||
2514 | * @behind_bridge: 1 if this is a recursive call, 0 if not | ||
2515 | * @resources: pointer to set of resource lists | ||
2516 | * | ||
2517 | * Calls itself recursively for bridged devices. | ||
2518 | * Returns 0 if success | ||
2519 | * | ||
2520 | */ | ||
2521 | static int | ||
2522 | configure_new_function(struct controller *ctrl, struct pci_func *func, | ||
2523 | u8 behind_bridge, struct resource_lists *resources, | ||
2524 | u8 bridge_bus, u8 bridge_dev) | ||
2525 | { | ||
2526 | int cloop; | ||
2527 | u8 temp_byte; | ||
2528 | u8 class_code; | ||
2529 | u32 rc; | ||
2530 | u32 temp_register; | ||
2531 | u32 base; | ||
2532 | unsigned int devfn; | ||
2533 | struct pci_resource *mem_node; | ||
2534 | struct pci_resource *io_node; | ||
2535 | struct pci_bus lpci_bus, *pci_bus; | ||
2536 | |||
2537 | memcpy(&lpci_bus, ctrl->pci_dev->subordinate, sizeof(lpci_bus)); | ||
2538 | pci_bus = &lpci_bus; | ||
2539 | pci_bus->number = func->bus; | ||
2540 | devfn = PCI_DEVFN(func->device, func->function); | ||
2541 | |||
2542 | /* Check for Bridge */ | ||
2543 | rc = pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &temp_byte); | ||
2544 | if (rc) | ||
2545 | return rc; | ||
2546 | dbg("%s: bus %x dev %x func %x temp_byte = %x\n", __FUNCTION__, | ||
2547 | func->bus, func->device, func->function, temp_byte); | ||
2548 | |||
2549 | if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { /* PCI-PCI Bridge */ | ||
2550 | rc = configure_new_bridge(ctrl, func, behind_bridge, resources, | ||
2551 | pci_bus); | ||
2552 | |||
2553 | if (rc) | ||
2554 | return rc; | ||
2555 | } else if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_NORMAL) { | ||
2556 | /* Standard device */ | ||
2557 | u64 base64; | ||
2558 | rc = pci_bus_read_config_byte(pci_bus, devfn, 0x0B, &class_code); | ||
2559 | |||
2560 | if (class_code == PCI_BASE_CLASS_DISPLAY) | ||
2561 | return DEVICE_TYPE_NOT_SUPPORTED; | ||
2562 | |||
2563 | /* Figure out IO and memory needs */ | ||
2564 | for (cloop = PCI_BASE_ADDRESS_0; cloop <= PCI_BASE_ADDRESS_5; cloop += 4) { | ||
2565 | temp_register = 0xFFFFFFFF; | ||
2566 | |||
2567 | rc = pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register); | ||
2568 | rc = pci_bus_read_config_dword(pci_bus, devfn, cloop, &temp_register); | ||
2569 | dbg("Bar[%x]=0x%x on bus:dev:func(0x%x:%x:%x)\n", cloop, temp_register, | ||
2570 | func->bus, func->device, func->function); | ||
2571 | |||
2572 | if (!temp_register) | ||
2573 | continue; | ||
2574 | |||
2575 | base64 = 0L; | ||
2576 | if (temp_register & PCI_BASE_ADDRESS_SPACE_IO) { | ||
2577 | /* Map IO */ | ||
2578 | |||
2579 | /* set base = amount of IO space */ | ||
2580 | base = temp_register & 0xFFFFFFFC; | ||
2581 | base = ~base + 1; | ||
2582 | |||
2583 | dbg("NEED IO length(0x%x)\n", base); | ||
2584 | io_node = get_io_resource(&(resources->io_head),(ulong)base); | ||
2585 | |||
2586 | /* allocate the resource to the board */ | ||
2587 | if (io_node) { | ||
2588 | dbg("Got IO base=0x%x(length=0x%x)\n", io_node->base, io_node->length); | ||
2589 | base = (u32)io_node->base; | ||
2590 | io_node->next = func->io_head; | ||
2591 | func->io_head = io_node; | ||
2592 | } else { | ||
2593 | err("Got NO IO resource(length=0x%x)\n", base); | ||
2594 | return -ENOMEM; | ||
2595 | } | ||
2596 | } else { /* map MEM */ | ||
2597 | int prefetchable = 1; | ||
2598 | struct pci_resource **res_node = &func->p_mem_head; | ||
2599 | char *res_type_str = "PMEM"; | ||
2600 | u32 temp_register2; | ||
2601 | |||
2602 | if (!(temp_register & PCI_BASE_ADDRESS_MEM_PREFETCH)) { | ||
2603 | prefetchable = 0; | ||
2604 | res_node = &func->mem_head; | ||
2605 | res_type_str++; | ||
2606 | } | ||
2607 | |||
2608 | base = temp_register & 0xFFFFFFF0; | ||
2609 | base = ~base + 1; | ||
2610 | |||
2611 | switch (temp_register & PCI_BASE_ADDRESS_MEM_TYPE_MASK) { | ||
2612 | case PCI_BASE_ADDRESS_MEM_TYPE_32: | ||
2613 | dbg("NEED 32 %s bar=0x%x(length=0x%x)\n", res_type_str, temp_register, base); | ||
2614 | |||
2615 | if (prefetchable && resources->p_mem_head) | ||
2616 | mem_node=get_resource(&(resources->p_mem_head), (ulong)base); | ||
2617 | else { | ||
2618 | if (prefetchable) | ||
2619 | dbg("using MEM for PMEM\n"); | ||
2620 | mem_node = get_resource(&(resources->mem_head), (ulong)base); | ||
2621 | } | ||
2622 | |||
2623 | /* allocate the resource to the board */ | ||
2624 | if (mem_node) { | ||
2625 | base = (u32)mem_node->base; | ||
2626 | mem_node->next = *res_node; | ||
2627 | *res_node = mem_node; | ||
2628 | dbg("Got 32 %s base=0x%x(length=0x%x)\n", res_type_str, mem_node->base, | ||
2629 | mem_node->length); | ||
2630 | } else { | ||
2631 | err("Got NO 32 %s resource(length=0x%x)\n", res_type_str, base); | ||
2632 | return -ENOMEM; | ||
2633 | } | ||
2634 | break; | ||
2635 | case PCI_BASE_ADDRESS_MEM_TYPE_64: | ||
2636 | rc = pci_bus_read_config_dword(pci_bus, devfn, cloop+4, &temp_register2); | ||
2637 | dbg("NEED 64 %s bar=0x%x:%x(length=0x%x)\n", res_type_str, temp_register2, | ||
2638 | temp_register, base); | ||
2639 | |||
2640 | if (prefetchable && resources->p_mem_head) | ||
2641 | mem_node = get_resource(&(resources->p_mem_head), (ulong)base); | ||
2642 | else { | ||
2643 | if (prefetchable) | ||
2644 | dbg("using MEM for PMEM\n"); | ||
2645 | mem_node = get_resource(&(resources->mem_head), (ulong)base); | ||
2646 | } | ||
2647 | |||
2648 | /* allocate the resource to the board */ | ||
2649 | if (mem_node) { | ||
2650 | base64 = mem_node->base; | ||
2651 | mem_node->next = *res_node; | ||
2652 | *res_node = mem_node; | ||
2653 | dbg("Got 64 %s base=0x%x:%x(length=%x)\n", res_type_str, (u32)(base64 >> 32), | ||
2654 | (u32)base64, mem_node->length); | ||
2655 | } else { | ||
2656 | err("Got NO 64 %s resource(length=0x%x)\n", res_type_str, base); | ||
2657 | return -ENOMEM; | ||
2658 | } | ||
2659 | break; | ||
2660 | default: | ||
2661 | dbg("reserved BAR type=0x%x\n", temp_register); | ||
2662 | break; | ||
2663 | } | ||
2664 | |||
2665 | } | ||
2666 | |||
2667 | if (base64) { | ||
2668 | rc = pci_bus_write_config_dword(pci_bus, devfn, cloop, (u32)base64); | ||
2669 | cloop += 4; | ||
2670 | base64 >>= 32; | ||
2671 | |||
2672 | if (base64) { | ||
2673 | dbg("%s: high dword of base64(0x%x) set to 0\n", __FUNCTION__, (u32)base64); | ||
2674 | base64 = 0x0L; | ||
2675 | } | ||
2676 | |||
2677 | rc = pci_bus_write_config_dword(pci_bus, devfn, cloop, (u32)base64); | ||
2678 | } else { | ||
2679 | rc = pci_bus_write_config_dword(pci_bus, devfn, cloop, base); | ||
2680 | } | ||
2681 | } /* End of base register loop */ | ||
2682 | |||
2683 | /* disable ROM base Address */ | ||
2684 | rc = pci_bus_write_config_dword (pci_bus, devfn, PCI_ROM_ADDRESS, 0x00); | ||
2685 | |||
2686 | /* Set HP parameters (Cache Line Size, Latency Timer) */ | ||
2687 | rc = pciehprm_set_hpp(ctrl, func, PCI_HEADER_TYPE_NORMAL); | ||
2688 | if (rc) | ||
2689 | return rc; | ||
2690 | |||
2691 | pciehprm_enable_card(ctrl, func, PCI_HEADER_TYPE_NORMAL); | ||
2692 | |||
2693 | dbg("PCI function Hot-Added s:b:d:f(%02x:%02x:%02x:%02x)\n", ctrl->seg, func->bus, func->device, | ||
2694 | func->function); | ||
2695 | } /* End of Not-A-Bridge else */ | ||
2696 | else { | ||
2697 | /* It's some strange type of PCI adapter (Cardbus?) */ | ||
2698 | return DEVICE_TYPE_NOT_SUPPORTED; | ||
2699 | } | ||
2700 | |||
2701 | func->configured = 1; | ||
2702 | |||
2703 | return 0; | ||
2704 | } | ||
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 7a0e27f0e063..4a3cecca012c 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -27,16 +27,10 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
32 | #include <linux/module.h> | 31 | #include <linux/module.h> |
33 | #include <linux/types.h> | 32 | #include <linux/types.h> |
34 | #include <linux/slab.h> | ||
35 | #include <linux/vmalloc.h> | ||
36 | #include <linux/interrupt.h> | ||
37 | #include <linux/spinlock.h> | ||
38 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
39 | #include <asm/system.h> | ||
40 | #include "../pci.h" | 34 | #include "../pci.h" |
41 | #include "pciehp.h" | 35 | #include "pciehp.h" |
42 | 36 | ||
@@ -217,23 +211,6 @@ static int pcie_cap_base = 0; /* Base of the PCI Express capability item struct | |||
217 | #define MRL_STATE 0x0020 | 211 | #define MRL_STATE 0x0020 |
218 | #define PRSN_STATE 0x0040 | 212 | #define PRSN_STATE 0x0040 |
219 | 213 | ||
220 | struct php_ctlr_state_s { | ||
221 | struct php_ctlr_state_s *pnext; | ||
222 | struct pci_dev *pci_dev; | ||
223 | unsigned int irq; | ||
224 | unsigned long flags; /* spinlock's */ | ||
225 | u32 slot_device_offset; | ||
226 | u32 num_slots; | ||
227 | struct timer_list int_poll_timer; /* Added for poll event */ | ||
228 | php_intr_callback_t attention_button_callback; | ||
229 | php_intr_callback_t switch_change_callback; | ||
230 | php_intr_callback_t presence_change_callback; | ||
231 | php_intr_callback_t power_fault_callback; | ||
232 | void *callback_instance_id; | ||
233 | struct ctrl_reg *creg; /* Ptr to controller register space */ | ||
234 | }; | ||
235 | |||
236 | |||
237 | static spinlock_t hpc_event_lock; | 214 | static spinlock_t hpc_event_lock; |
238 | 215 | ||
239 | DEFINE_DBG_BUFFER /* Debug string buffer for entire HPC defined here */ | 216 | DEFINE_DBG_BUFFER /* Debug string buffer for entire HPC defined here */ |
@@ -297,7 +274,6 @@ static int pcie_write_cmd(struct slot *slot, u16 cmd) | |||
297 | 274 | ||
298 | DBG_ENTER_ROUTINE | 275 | DBG_ENTER_ROUTINE |
299 | 276 | ||
300 | dbg("%s : Enter\n", __FUNCTION__); | ||
301 | if (!php_ctlr) { | 277 | if (!php_ctlr) { |
302 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); | 278 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); |
303 | return -1; | 279 | return -1; |
@@ -308,7 +284,6 @@ static int pcie_write_cmd(struct slot *slot, u16 cmd) | |||
308 | err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__); | 284 | err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__); |
309 | return retval; | 285 | return retval; |
310 | } | 286 | } |
311 | dbg("%s : hp_register_read_word SLOT_STATUS %x\n", __FUNCTION__, slot_status); | ||
312 | 287 | ||
313 | if ((slot_status & CMD_COMPLETED) == CMD_COMPLETED ) { | 288 | if ((slot_status & CMD_COMPLETED) == CMD_COMPLETED ) { |
314 | /* After 1 sec and CMD_COMPLETED still not set, just proceed forward to issue | 289 | /* After 1 sec and CMD_COMPLETED still not set, just proceed forward to issue |
@@ -316,14 +291,11 @@ static int pcie_write_cmd(struct slot *slot, u16 cmd) | |||
316 | dbg("%s : CMD_COMPLETED not clear after 1 sec.\n", __FUNCTION__); | 291 | dbg("%s : CMD_COMPLETED not clear after 1 sec.\n", __FUNCTION__); |
317 | } | 292 | } |
318 | 293 | ||
319 | dbg("%s: Before hp_register_write_word SLOT_CTRL %x\n", __FUNCTION__, cmd); | ||
320 | retval = hp_register_write_word(php_ctlr->pci_dev, SLOT_CTRL(slot->ctrl->cap_base), cmd | CMD_CMPL_INTR_ENABLE); | 294 | retval = hp_register_write_word(php_ctlr->pci_dev, SLOT_CTRL(slot->ctrl->cap_base), cmd | CMD_CMPL_INTR_ENABLE); |
321 | if (retval) { | 295 | if (retval) { |
322 | err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__); | 296 | err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__); |
323 | return retval; | 297 | return retval; |
324 | } | 298 | } |
325 | dbg("%s : hp_register_write_word SLOT_CTRL %x\n", __FUNCTION__, cmd | CMD_CMPL_INTR_ENABLE); | ||
326 | dbg("%s : Exit\n", __FUNCTION__); | ||
327 | 299 | ||
328 | DBG_LEAVE_ROUTINE | 300 | DBG_LEAVE_ROUTINE |
329 | return retval; | 301 | return retval; |
@@ -509,7 +481,6 @@ static int hpc_query_power_fault(struct slot * slot) | |||
509 | u16 slot_status; | 481 | u16 slot_status; |
510 | u8 pwr_fault; | 482 | u8 pwr_fault; |
511 | int retval = 0; | 483 | int retval = 0; |
512 | u8 status; | ||
513 | 484 | ||
514 | DBG_ENTER_ROUTINE | 485 | DBG_ENTER_ROUTINE |
515 | 486 | ||
@@ -521,15 +492,13 @@ static int hpc_query_power_fault(struct slot * slot) | |||
521 | retval = hp_register_read_word(php_ctlr->pci_dev, SLOT_STATUS(slot->ctrl->cap_base), slot_status); | 492 | retval = hp_register_read_word(php_ctlr->pci_dev, SLOT_STATUS(slot->ctrl->cap_base), slot_status); |
522 | 493 | ||
523 | if (retval) { | 494 | if (retval) { |
524 | err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__); | 495 | err("%s : Cannot check for power fault\n", __FUNCTION__); |
525 | return retval; | 496 | return retval; |
526 | } | 497 | } |
527 | pwr_fault = (u8)((slot_status & PWR_FAULT_DETECTED) >> 1); | 498 | pwr_fault = (u8)((slot_status & PWR_FAULT_DETECTED) >> 1); |
528 | status = (pwr_fault != 1) ? 1 : 0; | ||
529 | 499 | ||
530 | DBG_LEAVE_ROUTINE | 500 | DBG_LEAVE_ROUTINE |
531 | /* Note: Logic 0 => fault */ | 501 | return pwr_fault; |
532 | return status; | ||
533 | } | 502 | } |
534 | 503 | ||
535 | static int hpc_set_attention_status(struct slot *slot, u8 value) | 504 | static int hpc_set_attention_status(struct slot *slot, u8 value) |
@@ -539,7 +508,8 @@ static int hpc_set_attention_status(struct slot *slot, u8 value) | |||
539 | u16 slot_ctrl; | 508 | u16 slot_ctrl; |
540 | int rc = 0; | 509 | int rc = 0; |
541 | 510 | ||
542 | dbg("%s: \n", __FUNCTION__); | 511 | DBG_ENTER_ROUTINE |
512 | |||
543 | if (!php_ctlr) { | 513 | if (!php_ctlr) { |
544 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); | 514 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); |
545 | return -1; | 515 | return -1; |
@@ -555,7 +525,6 @@ static int hpc_set_attention_status(struct slot *slot, u8 value) | |||
555 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); | 525 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); |
556 | return rc; | 526 | return rc; |
557 | } | 527 | } |
558 | dbg("%s : hp_register_read_word SLOT_CTRL %x\n", __FUNCTION__, slot_ctrl); | ||
559 | 528 | ||
560 | switch (value) { | 529 | switch (value) { |
561 | case 0 : /* turn off */ | 530 | case 0 : /* turn off */ |
@@ -576,6 +545,7 @@ static int hpc_set_attention_status(struct slot *slot, u8 value) | |||
576 | pcie_write_cmd(slot, slot_cmd); | 545 | pcie_write_cmd(slot, slot_cmd); |
577 | dbg("%s: SLOT_CTRL %x write cmd %x\n", __FUNCTION__, SLOT_CTRL(slot->ctrl->cap_base), slot_cmd); | 546 | dbg("%s: SLOT_CTRL %x write cmd %x\n", __FUNCTION__, SLOT_CTRL(slot->ctrl->cap_base), slot_cmd); |
578 | 547 | ||
548 | DBG_LEAVE_ROUTINE | ||
579 | return rc; | 549 | return rc; |
580 | } | 550 | } |
581 | 551 | ||
@@ -587,7 +557,8 @@ static void hpc_set_green_led_on(struct slot *slot) | |||
587 | u16 slot_ctrl; | 557 | u16 slot_ctrl; |
588 | int rc = 0; | 558 | int rc = 0; |
589 | 559 | ||
590 | dbg("%s: \n", __FUNCTION__); | 560 | DBG_ENTER_ROUTINE |
561 | |||
591 | if (!php_ctlr) { | 562 | if (!php_ctlr) { |
592 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); | 563 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); |
593 | return ; | 564 | return ; |
@@ -604,7 +575,6 @@ static void hpc_set_green_led_on(struct slot *slot) | |||
604 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); | 575 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); |
605 | return; | 576 | return; |
606 | } | 577 | } |
607 | dbg("%s : hp_register_read_word SLOT_CTRL %x\n", __FUNCTION__, slot_ctrl); | ||
608 | slot_cmd = (slot_ctrl & ~PWR_LED_CTRL) | 0x0100; | 578 | slot_cmd = (slot_ctrl & ~PWR_LED_CTRL) | 0x0100; |
609 | if (!pciehp_poll_mode) | 579 | if (!pciehp_poll_mode) |
610 | slot_cmd = slot_cmd | HP_INTR_ENABLE; | 580 | slot_cmd = slot_cmd | HP_INTR_ENABLE; |
@@ -612,6 +582,7 @@ static void hpc_set_green_led_on(struct slot *slot) | |||
612 | pcie_write_cmd(slot, slot_cmd); | 582 | pcie_write_cmd(slot, slot_cmd); |
613 | 583 | ||
614 | dbg("%s: SLOT_CTRL %x write cmd %x\n",__FUNCTION__, SLOT_CTRL(slot->ctrl->cap_base), slot_cmd); | 584 | dbg("%s: SLOT_CTRL %x write cmd %x\n",__FUNCTION__, SLOT_CTRL(slot->ctrl->cap_base), slot_cmd); |
585 | DBG_LEAVE_ROUTINE | ||
615 | return; | 586 | return; |
616 | } | 587 | } |
617 | 588 | ||
@@ -622,7 +593,8 @@ static void hpc_set_green_led_off(struct slot *slot) | |||
622 | u16 slot_ctrl; | 593 | u16 slot_ctrl; |
623 | int rc = 0; | 594 | int rc = 0; |
624 | 595 | ||
625 | dbg("%s: \n", __FUNCTION__); | 596 | DBG_ENTER_ROUTINE |
597 | |||
626 | if (!php_ctlr) { | 598 | if (!php_ctlr) { |
627 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); | 599 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); |
628 | return ; | 600 | return ; |
@@ -639,7 +611,6 @@ static void hpc_set_green_led_off(struct slot *slot) | |||
639 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); | 611 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); |
640 | return; | 612 | return; |
641 | } | 613 | } |
642 | dbg("%s : hp_register_read_word SLOT_CTRL %x\n", __FUNCTION__, slot_ctrl); | ||
643 | 614 | ||
644 | slot_cmd = (slot_ctrl & ~PWR_LED_CTRL) | 0x0300; | 615 | slot_cmd = (slot_ctrl & ~PWR_LED_CTRL) | 0x0300; |
645 | 616 | ||
@@ -648,6 +619,7 @@ static void hpc_set_green_led_off(struct slot *slot) | |||
648 | pcie_write_cmd(slot, slot_cmd); | 619 | pcie_write_cmd(slot, slot_cmd); |
649 | dbg("%s: SLOT_CTRL %x write cmd %x\n", __FUNCTION__, SLOT_CTRL(slot->ctrl->cap_base), slot_cmd); | 620 | dbg("%s: SLOT_CTRL %x write cmd %x\n", __FUNCTION__, SLOT_CTRL(slot->ctrl->cap_base), slot_cmd); |
650 | 621 | ||
622 | DBG_LEAVE_ROUTINE | ||
651 | return; | 623 | return; |
652 | } | 624 | } |
653 | 625 | ||
@@ -658,7 +630,8 @@ static void hpc_set_green_led_blink(struct slot *slot) | |||
658 | u16 slot_ctrl; | 630 | u16 slot_ctrl; |
659 | int rc = 0; | 631 | int rc = 0; |
660 | 632 | ||
661 | dbg("%s: \n", __FUNCTION__); | 633 | DBG_ENTER_ROUTINE |
634 | |||
662 | if (!php_ctlr) { | 635 | if (!php_ctlr) { |
663 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); | 636 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); |
664 | return ; | 637 | return ; |
@@ -675,7 +648,6 @@ static void hpc_set_green_led_blink(struct slot *slot) | |||
675 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); | 648 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); |
676 | return; | 649 | return; |
677 | } | 650 | } |
678 | dbg("%s : hp_register_read_word SLOT_CTRL %x\n", __FUNCTION__, slot_ctrl); | ||
679 | 651 | ||
680 | slot_cmd = (slot_ctrl & ~PWR_LED_CTRL) | 0x0200; | 652 | slot_cmd = (slot_ctrl & ~PWR_LED_CTRL) | 0x0200; |
681 | 653 | ||
@@ -684,6 +656,7 @@ static void hpc_set_green_led_blink(struct slot *slot) | |||
684 | pcie_write_cmd(slot, slot_cmd); | 656 | pcie_write_cmd(slot, slot_cmd); |
685 | 657 | ||
686 | dbg("%s: SLOT_CTRL %x write cmd %x\n",__FUNCTION__, SLOT_CTRL(slot->ctrl->cap_base), slot_cmd); | 658 | dbg("%s: SLOT_CTRL %x write cmd %x\n",__FUNCTION__, SLOT_CTRL(slot->ctrl->cap_base), slot_cmd); |
659 | DBG_LEAVE_ROUTINE | ||
687 | return; | 660 | return; |
688 | } | 661 | } |
689 | 662 | ||
@@ -780,7 +753,6 @@ static int hpc_power_on_slot(struct slot * slot) | |||
780 | int retval = 0; | 753 | int retval = 0; |
781 | 754 | ||
782 | DBG_ENTER_ROUTINE | 755 | DBG_ENTER_ROUTINE |
783 | dbg("%s: \n", __FUNCTION__); | ||
784 | 756 | ||
785 | if (!php_ctlr) { | 757 | if (!php_ctlr) { |
786 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); | 758 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); |
@@ -799,8 +771,6 @@ static int hpc_power_on_slot(struct slot * slot) | |||
799 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); | 771 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); |
800 | return retval; | 772 | return retval; |
801 | } | 773 | } |
802 | dbg("%s: SLOT_CTRL %x, value read %xn", __FUNCTION__, SLOT_CTRL(slot->ctrl->cap_base), | ||
803 | slot_ctrl); | ||
804 | 774 | ||
805 | slot_cmd = (slot_ctrl & ~PWR_CTRL) | POWER_ON; | 775 | slot_cmd = (slot_ctrl & ~PWR_CTRL) | POWER_ON; |
806 | 776 | ||
@@ -829,7 +799,6 @@ static int hpc_power_off_slot(struct slot * slot) | |||
829 | int retval = 0; | 799 | int retval = 0; |
830 | 800 | ||
831 | DBG_ENTER_ROUTINE | 801 | DBG_ENTER_ROUTINE |
832 | dbg("%s: \n", __FUNCTION__); | ||
833 | 802 | ||
834 | if (!php_ctlr) { | 803 | if (!php_ctlr) { |
835 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); | 804 | err("%s: Invalid HPC controller handle!\n", __FUNCTION__); |
@@ -848,8 +817,6 @@ static int hpc_power_off_slot(struct slot * slot) | |||
848 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); | 817 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); |
849 | return retval; | 818 | return retval; |
850 | } | 819 | } |
851 | dbg("%s: SLOT_CTRL %x, value read %x\n", __FUNCTION__, SLOT_CTRL(slot->ctrl->cap_base), | ||
852 | slot_ctrl); | ||
853 | 820 | ||
854 | slot_cmd = (slot_ctrl & ~PWR_CTRL) | POWER_OFF; | 821 | slot_cmd = (slot_ctrl & ~PWR_CTRL) | POWER_OFF; |
855 | 822 | ||
@@ -924,7 +891,6 @@ static irqreturn_t pcie_isr(int IRQ, void *dev_id, struct pt_regs *regs) | |||
924 | return IRQ_NONE; | 891 | return IRQ_NONE; |
925 | } | 892 | } |
926 | 893 | ||
927 | dbg("%s: Set Mask Hot-plug Interrupt Enable\n", __FUNCTION__); | ||
928 | dbg("%s: hp_register_read_word SLOT_CTRL with value %x\n", __FUNCTION__, temp_word); | 894 | dbg("%s: hp_register_read_word SLOT_CTRL with value %x\n", __FUNCTION__, temp_word); |
929 | temp_word = (temp_word & ~HP_INTR_ENABLE & ~CMD_CMPL_INTR_ENABLE) | 0x00; | 895 | temp_word = (temp_word & ~HP_INTR_ENABLE & ~CMD_CMPL_INTR_ENABLE) | 0x00; |
930 | 896 | ||
@@ -933,7 +899,6 @@ static irqreturn_t pcie_isr(int IRQ, void *dev_id, struct pt_regs *regs) | |||
933 | err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__); | 899 | err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__); |
934 | return IRQ_NONE; | 900 | return IRQ_NONE; |
935 | } | 901 | } |
936 | dbg("%s: hp_register_write_word SLOT_CTRL with value %x\n", __FUNCTION__, temp_word); | ||
937 | 902 | ||
938 | rc = hp_register_read_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), slot_status); | 903 | rc = hp_register_read_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), slot_status); |
939 | if (rc) { | 904 | if (rc) { |
@@ -949,14 +914,12 @@ static irqreturn_t pcie_isr(int IRQ, void *dev_id, struct pt_regs *regs) | |||
949 | err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__); | 914 | err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__); |
950 | return IRQ_NONE; | 915 | return IRQ_NONE; |
951 | } | 916 | } |
952 | dbg("%s: hp_register_write_word SLOT_STATUS with value %x\n", __FUNCTION__, temp_word); | ||
953 | } | 917 | } |
954 | 918 | ||
955 | if (intr_loc & CMD_COMPLETED) { | 919 | if (intr_loc & CMD_COMPLETED) { |
956 | /* | 920 | /* |
957 | * Command Complete Interrupt Pending | 921 | * Command Complete Interrupt Pending |
958 | */ | 922 | */ |
959 | dbg("%s: In Command Complete Interrupt Pending\n", __FUNCTION__); | ||
960 | wake_up_interruptible(&ctrl->queue); | 923 | wake_up_interruptible(&ctrl->queue); |
961 | } | 924 | } |
962 | 925 | ||
@@ -989,7 +952,6 @@ static irqreturn_t pcie_isr(int IRQ, void *dev_id, struct pt_regs *regs) | |||
989 | } | 952 | } |
990 | 953 | ||
991 | dbg("%s: Unmask Hot-plug Interrupt Enable\n", __FUNCTION__); | 954 | dbg("%s: Unmask Hot-plug Interrupt Enable\n", __FUNCTION__); |
992 | dbg("%s: hp_register_read_word SLOT_CTRL with value %x\n", __FUNCTION__, temp_word); | ||
993 | temp_word = (temp_word & ~HP_INTR_ENABLE) | HP_INTR_ENABLE; | 955 | temp_word = (temp_word & ~HP_INTR_ENABLE) | HP_INTR_ENABLE; |
994 | 956 | ||
995 | rc = hp_register_write_word(php_ctlr->pci_dev, SLOT_CTRL(ctrl->cap_base), temp_word); | 957 | rc = hp_register_write_word(php_ctlr->pci_dev, SLOT_CTRL(ctrl->cap_base), temp_word); |
@@ -997,14 +959,12 @@ static irqreturn_t pcie_isr(int IRQ, void *dev_id, struct pt_regs *regs) | |||
997 | err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__); | 959 | err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__); |
998 | return IRQ_NONE; | 960 | return IRQ_NONE; |
999 | } | 961 | } |
1000 | dbg("%s: hp_register_write_word SLOT_CTRL with value %x\n", __FUNCTION__, temp_word); | ||
1001 | 962 | ||
1002 | rc = hp_register_read_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), slot_status); | 963 | rc = hp_register_read_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), slot_status); |
1003 | if (rc) { | 964 | if (rc) { |
1004 | err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__); | 965 | err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__); |
1005 | return IRQ_NONE; | 966 | return IRQ_NONE; |
1006 | } | 967 | } |
1007 | dbg("%s: hp_register_read_word SLOT_STATUS with value %x\n", __FUNCTION__, slot_status); | ||
1008 | 968 | ||
1009 | /* Clear command complete interrupt caused by this write */ | 969 | /* Clear command complete interrupt caused by this write */ |
1010 | temp_word = 0x1F; | 970 | temp_word = 0x1F; |
@@ -1248,12 +1208,7 @@ static struct hpc_ops pciehp_hpc_ops = { | |||
1248 | .check_lnk_status = hpc_check_lnk_status, | 1208 | .check_lnk_status = hpc_check_lnk_status, |
1249 | }; | 1209 | }; |
1250 | 1210 | ||
1251 | int pcie_init(struct controller * ctrl, | 1211 | int pcie_init(struct controller * ctrl, struct pcie_device *dev) |
1252 | struct pcie_device *dev, | ||
1253 | php_intr_callback_t attention_button_callback, | ||
1254 | php_intr_callback_t switch_change_callback, | ||
1255 | php_intr_callback_t presence_change_callback, | ||
1256 | php_intr_callback_t power_fault_callback) | ||
1257 | { | 1212 | { |
1258 | struct php_ctlr_state_s *php_ctlr, *p; | 1213 | struct php_ctlr_state_s *php_ctlr, *p; |
1259 | void *instance_id = ctrl; | 1214 | void *instance_id = ctrl; |
@@ -1282,8 +1237,8 @@ int pcie_init(struct controller * ctrl, | |||
1282 | pdev = dev->port; | 1237 | pdev = dev->port; |
1283 | php_ctlr->pci_dev = pdev; /* save pci_dev in context */ | 1238 | php_ctlr->pci_dev = pdev; /* save pci_dev in context */ |
1284 | 1239 | ||
1285 | dbg("%s: pdev->vendor %x pdev->device %x\n", __FUNCTION__, | 1240 | dbg("%s: hotplug controller vendor id 0x%x device id 0x%x\n", |
1286 | pdev->vendor, pdev->device); | 1241 | __FUNCTION__, pdev->vendor, pdev->device); |
1287 | 1242 | ||
1288 | saved_cap_base = pcie_cap_base; | 1243 | saved_cap_base = pcie_cap_base; |
1289 | 1244 | ||
@@ -1340,8 +1295,6 @@ int pcie_init(struct controller * ctrl, | |||
1340 | first = 0; | 1295 | first = 0; |
1341 | } | 1296 | } |
1342 | 1297 | ||
1343 | dbg("pdev = %p: b:d:f:irq=0x%x:%x:%x:%x\n", pdev, pdev->bus->number, | ||
1344 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), dev->irq); | ||
1345 | for ( rc = 0; rc < DEVICE_COUNT_RESOURCE; rc++) | 1298 | for ( rc = 0; rc < DEVICE_COUNT_RESOURCE; rc++) |
1346 | if (pci_resource_len(pdev, rc) > 0) | 1299 | if (pci_resource_len(pdev, rc) > 0) |
1347 | dbg("pci resource[%d] start=0x%lx(len=0x%lx)\n", rc, | 1300 | dbg("pci resource[%d] start=0x%lx(len=0x%lx)\n", rc, |
@@ -1359,13 +1312,12 @@ int pcie_init(struct controller * ctrl, | |||
1359 | 1312 | ||
1360 | /* find the IRQ */ | 1313 | /* find the IRQ */ |
1361 | php_ctlr->irq = dev->irq; | 1314 | php_ctlr->irq = dev->irq; |
1362 | dbg("HPC interrupt = %d\n", php_ctlr->irq); | ||
1363 | 1315 | ||
1364 | /* Save interrupt callback info */ | 1316 | /* Save interrupt callback info */ |
1365 | php_ctlr->attention_button_callback = attention_button_callback; | 1317 | php_ctlr->attention_button_callback = pciehp_handle_attention_button; |
1366 | php_ctlr->switch_change_callback = switch_change_callback; | 1318 | php_ctlr->switch_change_callback = pciehp_handle_switch_change; |
1367 | php_ctlr->presence_change_callback = presence_change_callback; | 1319 | php_ctlr->presence_change_callback = pciehp_handle_presence_change; |
1368 | php_ctlr->power_fault_callback = power_fault_callback; | 1320 | php_ctlr->power_fault_callback = pciehp_handle_power_fault; |
1369 | php_ctlr->callback_instance_id = instance_id; | 1321 | php_ctlr->callback_instance_id = instance_id; |
1370 | 1322 | ||
1371 | /* return PCI Controller Info */ | 1323 | /* return PCI Controller Info */ |
@@ -1387,15 +1339,12 @@ int pcie_init(struct controller * ctrl, | |||
1387 | err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__); | 1339 | err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__); |
1388 | goto abort_free_ctlr; | 1340 | goto abort_free_ctlr; |
1389 | } | 1341 | } |
1390 | dbg("%s : Mask HPIE hp_register_write_word SLOT_CTRL %x\n", __FUNCTION__, temp_word); | ||
1391 | 1342 | ||
1392 | rc = hp_register_read_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), slot_status); | 1343 | rc = hp_register_read_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), slot_status); |
1393 | if (rc) { | 1344 | if (rc) { |
1394 | err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__); | 1345 | err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__); |
1395 | goto abort_free_ctlr; | 1346 | goto abort_free_ctlr; |
1396 | } | 1347 | } |
1397 | dbg("%s: Mask HPIE SLOT_STATUS offset %x reads slot_status %x\n", __FUNCTION__, SLOT_STATUS(ctrl->cap_base) | ||
1398 | , slot_status); | ||
1399 | 1348 | ||
1400 | temp_word = 0x1F; /* Clear all events */ | 1349 | temp_word = 0x1F; /* Clear all events */ |
1401 | rc = hp_register_write_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), temp_word); | 1350 | rc = hp_register_write_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), temp_word); |
@@ -1403,7 +1352,6 @@ int pcie_init(struct controller * ctrl, | |||
1403 | err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__); | 1352 | err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__); |
1404 | goto abort_free_ctlr; | 1353 | goto abort_free_ctlr; |
1405 | } | 1354 | } |
1406 | dbg("%s: SLOT_STATUS offset %x writes slot_status %x\n", __FUNCTION__, SLOT_STATUS(ctrl->cap_base), temp_word); | ||
1407 | 1355 | ||
1408 | if (pciehp_poll_mode) {/* Install interrupt polling code */ | 1356 | if (pciehp_poll_mode) {/* Install interrupt polling code */ |
1409 | /* Install and start the interrupt polling timer */ | 1357 | /* Install and start the interrupt polling timer */ |
@@ -1419,13 +1367,14 @@ int pcie_init(struct controller * ctrl, | |||
1419 | } | 1367 | } |
1420 | } | 1368 | } |
1421 | 1369 | ||
1370 | dbg("pciehp ctrl b:d:f:irq=0x%x:%x:%x:%x\n", pdev->bus->number, | ||
1371 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), dev->irq); | ||
1372 | |||
1422 | rc = hp_register_read_word(pdev, SLOT_CTRL(ctrl->cap_base), temp_word); | 1373 | rc = hp_register_read_word(pdev, SLOT_CTRL(ctrl->cap_base), temp_word); |
1423 | if (rc) { | 1374 | if (rc) { |
1424 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); | 1375 | err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); |
1425 | goto abort_free_ctlr; | 1376 | goto abort_free_ctlr; |
1426 | } | 1377 | } |
1427 | dbg("%s: SLOT_CTRL %x value read %x\n", __FUNCTION__, SLOT_CTRL(ctrl->cap_base), temp_word); | ||
1428 | dbg("%s: slot_cap %x\n", __FUNCTION__, slot_cap); | ||
1429 | 1378 | ||
1430 | intr_enable = intr_enable | PRSN_DETECT_ENABLE; | 1379 | intr_enable = intr_enable | PRSN_DETECT_ENABLE; |
1431 | 1380 | ||
@@ -1445,7 +1394,6 @@ int pcie_init(struct controller * ctrl, | |||
1445 | } else { | 1394 | } else { |
1446 | temp_word = (temp_word & ~HP_INTR_ENABLE) | HP_INTR_ENABLE; | 1395 | temp_word = (temp_word & ~HP_INTR_ENABLE) | HP_INTR_ENABLE; |
1447 | } | 1396 | } |
1448 | dbg("%s: temp_word %x\n", __FUNCTION__, temp_word); | ||
1449 | 1397 | ||
1450 | /* Unmask Hot-plug Interrupt Enable for the interrupt notification mechanism case */ | 1398 | /* Unmask Hot-plug Interrupt Enable for the interrupt notification mechanism case */ |
1451 | rc = hp_register_write_word(pdev, SLOT_CTRL(ctrl->cap_base), temp_word); | 1399 | rc = hp_register_write_word(pdev, SLOT_CTRL(ctrl->cap_base), temp_word); |
@@ -1453,14 +1401,11 @@ int pcie_init(struct controller * ctrl, | |||
1453 | err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__); | 1401 | err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__); |
1454 | goto abort_free_ctlr; | 1402 | goto abort_free_ctlr; |
1455 | } | 1403 | } |
1456 | dbg("%s : Unmask HPIE hp_register_write_word SLOT_CTRL with %x\n", __FUNCTION__, temp_word); | ||
1457 | rc = hp_register_read_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), slot_status); | 1404 | rc = hp_register_read_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), slot_status); |
1458 | if (rc) { | 1405 | if (rc) { |
1459 | err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__); | 1406 | err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__); |
1460 | goto abort_free_ctlr; | 1407 | goto abort_free_ctlr; |
1461 | } | 1408 | } |
1462 | dbg("%s: Unmask HPIE SLOT_STATUS offset %x reads slot_status %x\n", __FUNCTION__, | ||
1463 | SLOT_STATUS(ctrl->cap_base), slot_status); | ||
1464 | 1409 | ||
1465 | temp_word = 0x1F; /* Clear all events */ | 1410 | temp_word = 0x1F; /* Clear all events */ |
1466 | rc = hp_register_write_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), temp_word); | 1411 | rc = hp_register_write_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), temp_word); |
@@ -1468,8 +1413,16 @@ int pcie_init(struct controller * ctrl, | |||
1468 | err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__); | 1413 | err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__); |
1469 | goto abort_free_ctlr; | 1414 | goto abort_free_ctlr; |
1470 | } | 1415 | } |
1471 | dbg("%s: SLOT_STATUS offset %x writes slot_status %x\n", __FUNCTION__, SLOT_STATUS(ctrl->cap_base), temp_word); | ||
1472 | 1416 | ||
1417 | if (pciehp_force) { | ||
1418 | dbg("Bypassing BIOS check for pciehp use on %s\n", | ||
1419 | pci_name(ctrl->pci_dev)); | ||
1420 | } else { | ||
1421 | rc = pciehp_get_hp_hw_control_from_firmware(ctrl->pci_dev); | ||
1422 | if (rc) | ||
1423 | goto abort_free_ctlr; | ||
1424 | } | ||
1425 | |||
1473 | /* Add this HPC instance into the HPC list */ | 1426 | /* Add this HPC instance into the HPC list */ |
1474 | spin_lock(&list_lock); | 1427 | spin_lock(&list_lock); |
1475 | if (php_ctlr_list_head == 0) { | 1428 | if (php_ctlr_list_head == 0) { |
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index ff17d8e07e94..647673a7d224 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c | |||
@@ -27,801 +27,111 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
33 | #include <linux/types.h> | 32 | #include <linux/types.h> |
34 | #include <linux/slab.h> | ||
35 | #include <linux/workqueue.h> | ||
36 | #include <linux/proc_fs.h> | ||
37 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
38 | #include "../pci.h" | 34 | #include "../pci.h" |
39 | #include "pciehp.h" | 35 | #include "pciehp.h" |
40 | #ifndef CONFIG_IA64 | ||
41 | #include "../../../arch/i386/pci/pci.h" /* horrible hack showing how processor dependant we are... */ | ||
42 | #endif | ||
43 | 36 | ||
44 | 37 | ||
45 | int pciehp_configure_device (struct controller* ctrl, struct pci_func* func) | 38 | int pciehp_configure_device(struct slot *p_slot) |
46 | { | 39 | { |
47 | unsigned char bus; | 40 | struct pci_dev *dev; |
48 | struct pci_bus *child; | 41 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; |
49 | int num; | 42 | int num, fn; |
50 | 43 | ||
51 | if (func->pci_dev == NULL) | 44 | dev = pci_find_slot(p_slot->bus, PCI_DEVFN(p_slot->device, 0)); |
52 | func->pci_dev = pci_find_slot(func->bus, PCI_DEVFN(func->device, func->function)); | 45 | if (dev) { |
53 | 46 | err("Device %s already exists at %x:%x, cannot hot-add\n", | |
54 | /* Still NULL ? Well then scan for it ! */ | 47 | pci_name(dev), p_slot->bus, p_slot->device); |
55 | if (func->pci_dev == NULL) { | 48 | return -EINVAL; |
56 | dbg("%s: pci_dev still null. do pci_scan_slot\n", __FUNCTION__); | ||
57 | |||
58 | num = pci_scan_slot(ctrl->pci_dev->subordinate, PCI_DEVFN(func->device, func->function)); | ||
59 | |||
60 | if (num) | ||
61 | pci_bus_add_devices(ctrl->pci_dev->subordinate); | ||
62 | |||
63 | func->pci_dev = pci_find_slot(func->bus, PCI_DEVFN(func->device, func->function)); | ||
64 | if (func->pci_dev == NULL) { | ||
65 | dbg("ERROR: pci_dev still null\n"); | ||
66 | return 0; | ||
67 | } | ||
68 | } | 49 | } |
69 | 50 | ||
70 | if (func->pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | 51 | num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0)); |
71 | pci_read_config_byte(func->pci_dev, PCI_SECONDARY_BUS, &bus); | 52 | if (num == 0) { |
72 | child = pci_add_new_bus(func->pci_dev->bus, (func->pci_dev), bus); | 53 | err("No new device found\n"); |
73 | pci_do_scan_bus(child); | 54 | return -ENODEV; |
55 | } | ||
74 | 56 | ||
57 | for (fn = 0; fn < 8; fn++) { | ||
58 | if (!(dev = pci_find_slot(p_slot->bus, | ||
59 | PCI_DEVFN(p_slot->device, fn)))) | ||
60 | continue; | ||
61 | if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { | ||
62 | err("Cannot hot-add display device %s\n", | ||
63 | pci_name(dev)); | ||
64 | continue; | ||
65 | } | ||
66 | if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || | ||
67 | (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) { | ||
68 | /* Find an unused bus number for the new bridge */ | ||
69 | struct pci_bus *child; | ||
70 | unsigned char busnr, start = parent->secondary; | ||
71 | unsigned char end = parent->subordinate; | ||
72 | for (busnr = start; busnr <= end; busnr++) { | ||
73 | if (!pci_find_bus(pci_domain_nr(parent), | ||
74 | busnr)) | ||
75 | break; | ||
76 | } | ||
77 | if (busnr >= end) { | ||
78 | err("No free bus for hot-added bridge\n"); | ||
79 | continue; | ||
80 | } | ||
81 | child = pci_add_new_bus(parent, dev, busnr); | ||
82 | if (!child) { | ||
83 | err("Cannot add new bus for %s\n", | ||
84 | pci_name(dev)); | ||
85 | continue; | ||
86 | } | ||
87 | child->subordinate = pci_do_scan_bus(child); | ||
88 | pci_bus_size_bridges(child); | ||
89 | } | ||
90 | /* TBD: program firmware provided _HPP values */ | ||
91 | /* program_fw_provided_values(dev); */ | ||
75 | } | 92 | } |
76 | 93 | ||
94 | pci_bus_assign_resources(parent); | ||
95 | pci_bus_add_devices(parent); | ||
96 | pci_enable_bridges(parent); | ||
77 | return 0; | 97 | return 0; |
78 | } | 98 | } |
79 | 99 | ||
80 | 100 | int pciehp_unconfigure_device(struct slot *p_slot) | |
81 | int pciehp_unconfigure_device(struct pci_func* func) | ||
82 | { | 101 | { |
83 | int rc = 0; | 102 | int rc = 0; |
84 | int j; | 103 | int j; |
85 | struct pci_bus *pbus; | 104 | u8 bctl = 0; |
86 | 105 | ||
87 | dbg("%s: bus/dev/func = %x/%x/%x\n", __FUNCTION__, func->bus, | 106 | dbg("%s: bus/dev = %x/%x\n", __FUNCTION__, p_slot->bus, |
88 | func->device, func->function); | 107 | p_slot->device); |
89 | pbus = func->pci_dev->bus; | ||
90 | 108 | ||
91 | for (j=0; j<8 ; j++) { | 109 | for (j=0; j<8 ; j++) { |
92 | struct pci_dev* temp = pci_find_slot(func->bus, | 110 | struct pci_dev* temp = pci_find_slot(p_slot->bus, |
93 | (func->device << 3) | j); | 111 | (p_slot->device << 3) | j); |
94 | if (temp) { | 112 | if (!temp) |
95 | pci_remove_bus_device(temp); | 113 | continue; |
114 | if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { | ||
115 | err("Cannot remove display device %s\n", | ||
116 | pci_name(temp)); | ||
117 | continue; | ||
96 | } | 118 | } |
119 | if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | ||
120 | pci_read_config_byte(temp, PCI_BRIDGE_CONTROL, &bctl); | ||
121 | if (bctl & PCI_BRIDGE_CTL_VGA) { | ||
122 | err("Cannot remove display device %s\n", | ||
123 | pci_name(temp)); | ||
124 | continue; | ||
125 | } | ||
126 | } | ||
127 | pci_remove_bus_device(temp); | ||
97 | } | 128 | } |
98 | /* | 129 | /* |
99 | * Some PCI Express root ports require fixup after hot-plug operation. | 130 | * Some PCI Express root ports require fixup after hot-plug operation. |
100 | */ | 131 | */ |
101 | if (pcie_mch_quirk) | 132 | if (pcie_mch_quirk) |
102 | pci_fixup_device(pci_fixup_final, pbus->self); | 133 | pci_fixup_device(pci_fixup_final, p_slot->ctrl->pci_dev); |
103 | 134 | ||
104 | return rc; | 135 | return rc; |
105 | } | 136 | } |
106 | 137 | ||
107 | /* | ||
108 | * pciehp_set_irq | ||
109 | * | ||
110 | * @bus_num: bus number of PCI device | ||
111 | * @dev_num: device number of PCI device | ||
112 | * @slot: pointer to u8 where slot number will be returned | ||
113 | */ | ||
114 | int pciehp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num) | ||
115 | { | ||
116 | #if defined(CONFIG_X86_32) && !defined(CONFIG_X86_IO_APIC) | ||
117 | int rc; | ||
118 | u16 temp_word; | ||
119 | struct pci_dev fakedev; | ||
120 | struct pci_bus fakebus; | ||
121 | |||
122 | fakedev.devfn = dev_num << 3; | ||
123 | fakedev.bus = &fakebus; | ||
124 | fakebus.number = bus_num; | ||
125 | dbg("%s: dev %d, bus %d, pin %d, num %d\n", | ||
126 | __FUNCTION__, dev_num, bus_num, int_pin, irq_num); | ||
127 | rc = pcibios_set_irq_routing(&fakedev, int_pin - 0x0a, irq_num); | ||
128 | dbg("%s: rc %d\n", __FUNCTION__, rc); | ||
129 | if (!rc) | ||
130 | return !rc; | ||
131 | |||
132 | /* set the Edge Level Control Register (ELCR) */ | ||
133 | temp_word = inb(0x4d0); | ||
134 | temp_word |= inb(0x4d1) << 8; | ||
135 | |||
136 | temp_word |= 0x01 << irq_num; | ||
137 | |||
138 | /* This should only be for x86 as it sets the Edge Level Control Register */ | ||
139 | outb((u8) (temp_word & 0xFF), 0x4d0); | ||
140 | outb((u8) ((temp_word & 0xFF00) >> 8), 0x4d1); | ||
141 | #endif | ||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | /* More PCI configuration routines; this time centered around hotplug controller */ | ||
146 | |||
147 | |||
148 | /* | ||
149 | * pciehp_save_config | ||
150 | * | ||
151 | * Reads configuration for all slots in a PCI bus and saves info. | ||
152 | * | ||
153 | * Note: For non-hot plug busses, the slot # saved is the device # | ||
154 | * | ||
155 | * returns 0 if success | ||
156 | */ | ||
157 | int pciehp_save_config(struct controller *ctrl, int busnumber, int num_ctlr_slots, int first_device_num) | ||
158 | { | ||
159 | int rc; | ||
160 | u8 class_code; | ||
161 | u8 header_type; | ||
162 | u32 ID; | ||
163 | u8 secondary_bus; | ||
164 | struct pci_func *new_slot; | ||
165 | int sub_bus; | ||
166 | int max_functions; | ||
167 | int function; | ||
168 | u8 DevError; | ||
169 | int device = 0; | ||
170 | int cloop = 0; | ||
171 | int stop_it; | ||
172 | int index; | ||
173 | int is_hot_plug = num_ctlr_slots || first_device_num; | ||
174 | struct pci_bus lpci_bus, *pci_bus; | ||
175 | int FirstSupported, LastSupported; | ||
176 | |||
177 | dbg("%s: Enter\n", __FUNCTION__); | ||
178 | |||
179 | memcpy(&lpci_bus, ctrl->pci_dev->subordinate, sizeof(lpci_bus)); | ||
180 | pci_bus = &lpci_bus; | ||
181 | |||
182 | dbg("%s: num_ctlr_slots = %d, first_device_num = %d\n", __FUNCTION__, | ||
183 | num_ctlr_slots, first_device_num); | ||
184 | |||
185 | /* Decide which slots are supported */ | ||
186 | if (is_hot_plug) { | ||
187 | /********************************* | ||
188 | * is_hot_plug is the slot mask | ||
189 | *********************************/ | ||
190 | FirstSupported = first_device_num; | ||
191 | LastSupported = FirstSupported + num_ctlr_slots - 1; | ||
192 | } else { | ||
193 | FirstSupported = 0; | ||
194 | LastSupported = 0x1F; | ||
195 | } | ||
196 | |||
197 | dbg("FirstSupported = %d, LastSupported = %d\n", FirstSupported, | ||
198 | LastSupported); | ||
199 | |||
200 | /* Save PCI configuration space for all devices in supported slots */ | ||
201 | dbg("%s: pci_bus->number = %x\n", __FUNCTION__, pci_bus->number); | ||
202 | pci_bus->number = busnumber; | ||
203 | dbg("%s: bus = %x, dev = %x\n", __FUNCTION__, busnumber, device); | ||
204 | for (device = FirstSupported; device <= LastSupported; device++) { | ||
205 | ID = 0xFFFFFFFF; | ||
206 | rc = pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, 0), | ||
207 | PCI_VENDOR_ID, &ID); | ||
208 | |||
209 | if (ID != 0xFFFFFFFF) { /* device in slot */ | ||
210 | dbg("%s: ID = %x\n", __FUNCTION__, ID); | ||
211 | rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, 0), | ||
212 | 0x0B, &class_code); | ||
213 | if (rc) | ||
214 | return rc; | ||
215 | |||
216 | rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, 0), | ||
217 | PCI_HEADER_TYPE, &header_type); | ||
218 | if (rc) | ||
219 | return rc; | ||
220 | |||
221 | dbg("class_code = %x, header_type = %x\n", class_code, header_type); | ||
222 | |||
223 | /* If multi-function device, set max_functions to 8 */ | ||
224 | if (header_type & 0x80) | ||
225 | max_functions = 8; | ||
226 | else | ||
227 | max_functions = 1; | ||
228 | |||
229 | function = 0; | ||
230 | |||
231 | do { | ||
232 | DevError = 0; | ||
233 | dbg("%s: In do loop\n", __FUNCTION__); | ||
234 | |||
235 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { /* P-P Bridge */ | ||
236 | /* Recurse the subordinate bus | ||
237 | * get the subordinate bus number | ||
238 | */ | ||
239 | rc = pci_bus_read_config_byte(pci_bus, | ||
240 | PCI_DEVFN(device, function), | ||
241 | PCI_SECONDARY_BUS, &secondary_bus); | ||
242 | if (rc) { | ||
243 | return rc; | ||
244 | } else { | ||
245 | sub_bus = (int) secondary_bus; | ||
246 | |||
247 | /* Save secondary bus cfg spc with this recursive call. */ | ||
248 | rc = pciehp_save_config(ctrl, sub_bus, 0, 0); | ||
249 | if (rc) | ||
250 | return rc; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | index = 0; | ||
255 | new_slot = pciehp_slot_find(busnumber, device, index++); | ||
256 | |||
257 | dbg("%s: new_slot = %p bus %x dev %x fun %x\n", | ||
258 | __FUNCTION__, new_slot, busnumber, device, index-1); | ||
259 | |||
260 | while (new_slot && (new_slot->function != (u8) function)) { | ||
261 | new_slot = pciehp_slot_find(busnumber, device, index++); | ||
262 | dbg("%s: while loop, new_slot = %p bus %x dev %x fun %x\n", | ||
263 | __FUNCTION__, new_slot, busnumber, device, index-1); | ||
264 | } | ||
265 | if (!new_slot) { | ||
266 | /* Setup slot structure. */ | ||
267 | new_slot = pciehp_slot_create(busnumber); | ||
268 | dbg("%s: if, new_slot = %p bus %x dev %x fun %x\n", | ||
269 | __FUNCTION__, new_slot, busnumber, device, function); | ||
270 | |||
271 | if (new_slot == NULL) | ||
272 | return(1); | ||
273 | } | ||
274 | |||
275 | new_slot->bus = (u8) busnumber; | ||
276 | new_slot->device = (u8) device; | ||
277 | new_slot->function = (u8) function; | ||
278 | new_slot->is_a_board = 1; | ||
279 | new_slot->switch_save = 0x10; | ||
280 | /* In case of unsupported board */ | ||
281 | new_slot->status = DevError; | ||
282 | new_slot->pci_dev = pci_find_slot(new_slot->bus, | ||
283 | (new_slot->device << 3) | new_slot->function); | ||
284 | dbg("new_slot->pci_dev = %p\n", new_slot->pci_dev); | ||
285 | |||
286 | for (cloop = 0; cloop < 0x20; cloop++) { | ||
287 | rc = pci_bus_read_config_dword(pci_bus, | ||
288 | PCI_DEVFN(device, function), | ||
289 | cloop << 2, | ||
290 | (u32 *) &(new_slot->config_space [cloop])); | ||
291 | /* dbg("new_slot->config_space[%x] = %x\n", | ||
292 | cloop, new_slot->config_space[cloop]); */ | ||
293 | if (rc) | ||
294 | return rc; | ||
295 | } | ||
296 | |||
297 | function++; | ||
298 | |||
299 | stop_it = 0; | ||
300 | |||
301 | /* this loop skips to the next present function | ||
302 | * reading in Class Code and Header type. | ||
303 | */ | ||
304 | |||
305 | while ((function < max_functions)&&(!stop_it)) { | ||
306 | dbg("%s: In while loop \n", __FUNCTION__); | ||
307 | rc = pci_bus_read_config_dword(pci_bus, | ||
308 | PCI_DEVFN(device, function), | ||
309 | PCI_VENDOR_ID, &ID); | ||
310 | |||
311 | if (ID == 0xFFFFFFFF) { /* nothing there. */ | ||
312 | function++; | ||
313 | dbg("Nothing there\n"); | ||
314 | } else { /* Something there */ | ||
315 | rc = pci_bus_read_config_byte(pci_bus, | ||
316 | PCI_DEVFN(device, function), | ||
317 | 0x0B, &class_code); | ||
318 | if (rc) | ||
319 | return rc; | ||
320 | |||
321 | rc = pci_bus_read_config_byte(pci_bus, | ||
322 | PCI_DEVFN(device, function), | ||
323 | PCI_HEADER_TYPE, &header_type); | ||
324 | if (rc) | ||
325 | return rc; | ||
326 | |||
327 | dbg("class_code = %x, header_type = %x\n", class_code, header_type); | ||
328 | stop_it++; | ||
329 | } | ||
330 | } | ||
331 | |||
332 | } while (function < max_functions); | ||
333 | /* End of IF (device in slot?) */ | ||
334 | } else if (is_hot_plug) { | ||
335 | /* Setup slot structure with entry for empty slot */ | ||
336 | new_slot = pciehp_slot_create(busnumber); | ||
337 | |||
338 | if (new_slot == NULL) { | ||
339 | return(1); | ||
340 | } | ||
341 | dbg("new_slot = %p, bus = %x, dev = %x, fun = %x\n", new_slot, | ||
342 | new_slot->bus, new_slot->device, new_slot->function); | ||
343 | |||
344 | new_slot->bus = (u8) busnumber; | ||
345 | new_slot->device = (u8) device; | ||
346 | new_slot->function = 0; | ||
347 | new_slot->is_a_board = 0; | ||
348 | new_slot->presence_save = 0; | ||
349 | new_slot->switch_save = 0; | ||
350 | } | ||
351 | } /* End of FOR loop */ | ||
352 | |||
353 | dbg("%s: Exit\n", __FUNCTION__); | ||
354 | return(0); | ||
355 | } | ||
356 | |||
357 | |||
358 | /* | ||
359 | * pciehp_save_slot_config | ||
360 | * | ||
361 | * Saves configuration info for all PCI devices in a given slot | ||
362 | * including subordinate busses. | ||
363 | * | ||
364 | * returns 0 if success | ||
365 | */ | ||
366 | int pciehp_save_slot_config(struct controller *ctrl, struct pci_func * new_slot) | ||
367 | { | ||
368 | int rc; | ||
369 | u8 class_code; | ||
370 | u8 header_type; | ||
371 | u32 ID; | ||
372 | u8 secondary_bus; | ||
373 | int sub_bus; | ||
374 | int max_functions; | ||
375 | int function; | ||
376 | int cloop = 0; | ||
377 | int stop_it; | ||
378 | struct pci_bus lpci_bus, *pci_bus; | ||
379 | memcpy(&lpci_bus, ctrl->pci_dev->subordinate, sizeof(lpci_bus)); | ||
380 | pci_bus = &lpci_bus; | ||
381 | pci_bus->number = new_slot->bus; | ||
382 | |||
383 | ID = 0xFFFFFFFF; | ||
384 | |||
385 | pci_bus_read_config_dword(pci_bus, PCI_DEVFN(new_slot->device, 0), | ||
386 | PCI_VENDOR_ID, &ID); | ||
387 | |||
388 | if (ID != 0xFFFFFFFF) { /* device in slot */ | ||
389 | pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, 0), | ||
390 | 0x0B, &class_code); | ||
391 | |||
392 | pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, 0), | ||
393 | PCI_HEADER_TYPE, &header_type); | ||
394 | |||
395 | if (header_type & 0x80) /* Multi-function device */ | ||
396 | max_functions = 8; | ||
397 | else | ||
398 | max_functions = 1; | ||
399 | |||
400 | function = 0; | ||
401 | |||
402 | do { | ||
403 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { /* PCI-PCI Bridge */ | ||
404 | /* Recurse the subordinate bus */ | ||
405 | pci_bus_read_config_byte(pci_bus, | ||
406 | PCI_DEVFN(new_slot->device, function), | ||
407 | PCI_SECONDARY_BUS, &secondary_bus); | ||
408 | |||
409 | sub_bus = (int) secondary_bus; | ||
410 | |||
411 | /* Save the config headers for the secondary bus. */ | ||
412 | rc = pciehp_save_config(ctrl, sub_bus, 0, 0); | ||
413 | |||
414 | if (rc) | ||
415 | return rc; | ||
416 | |||
417 | } /* End of IF */ | ||
418 | |||
419 | new_slot->status = 0; | ||
420 | |||
421 | for (cloop = 0; cloop < 0x20; cloop++) { | ||
422 | pci_bus_read_config_dword(pci_bus, | ||
423 | PCI_DEVFN(new_slot->device, function), | ||
424 | cloop << 2, | ||
425 | (u32 *) &(new_slot->config_space [cloop])); | ||
426 | } | ||
427 | |||
428 | function++; | ||
429 | |||
430 | stop_it = 0; | ||
431 | |||
432 | /* this loop skips to the next present function | ||
433 | * reading in the Class Code and the Header type. | ||
434 | */ | ||
435 | |||
436 | while ((function < max_functions) && (!stop_it)) { | ||
437 | pci_bus_read_config_dword(pci_bus, | ||
438 | PCI_DEVFN(new_slot->device, function), | ||
439 | PCI_VENDOR_ID, &ID); | ||
440 | |||
441 | if (ID == 0xFFFFFFFF) { /* nothing there. */ | ||
442 | function++; | ||
443 | } else { /* Something there */ | ||
444 | pci_bus_read_config_byte(pci_bus, | ||
445 | PCI_DEVFN(new_slot->device, function), | ||
446 | 0x0B, &class_code); | ||
447 | |||
448 | pci_bus_read_config_byte(pci_bus, | ||
449 | PCI_DEVFN(new_slot->device, function), | ||
450 | PCI_HEADER_TYPE, &header_type); | ||
451 | |||
452 | stop_it++; | ||
453 | } | ||
454 | } | ||
455 | |||
456 | } while (function < max_functions); | ||
457 | } /* End of IF (device in slot?) */ | ||
458 | else { | ||
459 | return 2; | ||
460 | } | ||
461 | |||
462 | return 0; | ||
463 | } | ||
464 | |||
465 | |||
466 | /* | ||
467 | * pciehp_save_used_resources | ||
468 | * | ||
469 | * Stores used resource information for existing boards. this is | ||
470 | * for boards that were in the system when this driver was loaded. | ||
471 | * this function is for hot plug ADD | ||
472 | * | ||
473 | * returns 0 if success | ||
474 | * if disable == 1(DISABLE_CARD), | ||
475 | * it loops for all functions of the slot and disables them. | ||
476 | * else, it just get resources of the function and return. | ||
477 | */ | ||
478 | int pciehp_save_used_resources(struct controller *ctrl, struct pci_func *func, int disable) | ||
479 | { | ||
480 | u8 cloop; | ||
481 | u8 header_type; | ||
482 | u8 secondary_bus; | ||
483 | u8 temp_byte; | ||
484 | u16 command; | ||
485 | u16 save_command; | ||
486 | u16 w_base, w_length; | ||
487 | u32 temp_register; | ||
488 | u32 save_base; | ||
489 | u32 base, length; | ||
490 | u64 base64 = 0; | ||
491 | int index = 0; | ||
492 | unsigned int devfn; | ||
493 | struct pci_resource *mem_node = NULL; | ||
494 | struct pci_resource *p_mem_node = NULL; | ||
495 | struct pci_resource *t_mem_node; | ||
496 | struct pci_resource *io_node; | ||
497 | struct pci_resource *bus_node; | ||
498 | struct pci_bus lpci_bus, *pci_bus; | ||
499 | memcpy(&lpci_bus, ctrl->pci_dev->subordinate, sizeof(lpci_bus)); | ||
500 | pci_bus = &lpci_bus; | ||
501 | |||
502 | if (disable) | ||
503 | func = pciehp_slot_find(func->bus, func->device, index++); | ||
504 | |||
505 | while ((func != NULL) && func->is_a_board) { | ||
506 | pci_bus->number = func->bus; | ||
507 | devfn = PCI_DEVFN(func->device, func->function); | ||
508 | |||
509 | /* Save the command register */ | ||
510 | pci_bus_read_config_word(pci_bus, devfn, PCI_COMMAND, &save_command); | ||
511 | |||
512 | if (disable) { | ||
513 | /* disable card */ | ||
514 | command = 0x00; | ||
515 | pci_bus_write_config_word(pci_bus, devfn, PCI_COMMAND, command); | ||
516 | } | ||
517 | |||
518 | /* Check for Bridge */ | ||
519 | pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type); | ||
520 | |||
521 | if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { /* PCI-PCI Bridge */ | ||
522 | dbg("Save_used_res of PCI bridge b:d=0x%x:%x, sc=0x%x\n", | ||
523 | func->bus, func->device, save_command); | ||
524 | if (disable) { | ||
525 | /* Clear Bridge Control Register */ | ||
526 | command = 0x00; | ||
527 | pci_bus_write_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, command); | ||
528 | } | ||
529 | |||
530 | pci_bus_read_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus); | ||
531 | pci_bus_read_config_byte(pci_bus, devfn, PCI_SUBORDINATE_BUS, &temp_byte); | ||
532 | |||
533 | bus_node = kmalloc(sizeof(struct pci_resource), | ||
534 | GFP_KERNEL); | ||
535 | if (!bus_node) | ||
536 | return -ENOMEM; | ||
537 | |||
538 | bus_node->base = (ulong)secondary_bus; | ||
539 | bus_node->length = (ulong)(temp_byte - secondary_bus + 1); | ||
540 | |||
541 | bus_node->next = func->bus_head; | ||
542 | func->bus_head = bus_node; | ||
543 | |||
544 | /* Save IO base and Limit registers */ | ||
545 | pci_bus_read_config_byte(pci_bus, devfn, PCI_IO_BASE, &temp_byte); | ||
546 | base = temp_byte; | ||
547 | pci_bus_read_config_byte(pci_bus, devfn, PCI_IO_LIMIT, &temp_byte); | ||
548 | length = temp_byte; | ||
549 | |||
550 | if ((base <= length) && (!disable || (save_command & PCI_COMMAND_IO))) { | ||
551 | io_node = kmalloc(sizeof(struct pci_resource), | ||
552 | GFP_KERNEL); | ||
553 | if (!io_node) | ||
554 | return -ENOMEM; | ||
555 | |||
556 | io_node->base = (ulong)(base & PCI_IO_RANGE_MASK) << 8; | ||
557 | io_node->length = (ulong)(length - base + 0x10) << 8; | ||
558 | |||
559 | io_node->next = func->io_head; | ||
560 | func->io_head = io_node; | ||
561 | } | ||
562 | |||
563 | /* Save memory base and Limit registers */ | ||
564 | pci_bus_read_config_word(pci_bus, devfn, PCI_MEMORY_BASE, &w_base); | ||
565 | pci_bus_read_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, &w_length); | ||
566 | |||
567 | if ((w_base <= w_length) && (!disable || (save_command & PCI_COMMAND_MEMORY))) { | ||
568 | mem_node = kmalloc(sizeof(struct pci_resource), | ||
569 | GFP_KERNEL); | ||
570 | if (!mem_node) | ||
571 | return -ENOMEM; | ||
572 | |||
573 | mem_node->base = (ulong)w_base << 16; | ||
574 | mem_node->length = (ulong)(w_length - w_base + 0x10) << 16; | ||
575 | |||
576 | mem_node->next = func->mem_head; | ||
577 | func->mem_head = mem_node; | ||
578 | } | ||
579 | /* Save prefetchable memory base and Limit registers */ | ||
580 | pci_bus_read_config_word(pci_bus, devfn, PCI_PREF_MEMORY_BASE, &w_base); | ||
581 | pci_bus_read_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &w_length); | ||
582 | |||
583 | if ((w_base <= w_length) && (!disable || (save_command & PCI_COMMAND_MEMORY))) { | ||
584 | p_mem_node = kmalloc(sizeof(struct pci_resource), | ||
585 | GFP_KERNEL); | ||
586 | if (!p_mem_node) | ||
587 | return -ENOMEM; | ||
588 | |||
589 | p_mem_node->base = (ulong)w_base << 16; | ||
590 | p_mem_node->length = (ulong)(w_length - w_base + 0x10) << 16; | ||
591 | |||
592 | p_mem_node->next = func->p_mem_head; | ||
593 | func->p_mem_head = p_mem_node; | ||
594 | } | ||
595 | } else if ((header_type & 0x7F) == PCI_HEADER_TYPE_NORMAL) { | ||
596 | dbg("Save_used_res of PCI adapter b:d=0x%x:%x, sc=0x%x\n", | ||
597 | func->bus, func->device, save_command); | ||
598 | |||
599 | /* Figure out IO and memory base lengths */ | ||
600 | for (cloop = PCI_BASE_ADDRESS_0; cloop <= PCI_BASE_ADDRESS_5; cloop += 4) { | ||
601 | pci_bus_read_config_dword(pci_bus, devfn, cloop, &save_base); | ||
602 | |||
603 | temp_register = 0xFFFFFFFF; | ||
604 | pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register); | ||
605 | pci_bus_read_config_dword(pci_bus, devfn, cloop, &temp_register); | ||
606 | |||
607 | if (!disable) | ||
608 | pci_bus_write_config_dword(pci_bus, devfn, cloop, save_base); | ||
609 | |||
610 | if (!temp_register) | ||
611 | continue; | ||
612 | |||
613 | base = temp_register; | ||
614 | |||
615 | if ((base & PCI_BASE_ADDRESS_SPACE_IO) && | ||
616 | (!disable || (save_command & PCI_COMMAND_IO))) { | ||
617 | /* IO base */ | ||
618 | /* set temp_register = amount of IO space requested */ | ||
619 | base = base & 0xFFFFFFFCL; | ||
620 | base = (~base) + 1; | ||
621 | |||
622 | io_node = kmalloc(sizeof (struct pci_resource), | ||
623 | GFP_KERNEL); | ||
624 | if (!io_node) | ||
625 | return -ENOMEM; | ||
626 | |||
627 | io_node->base = (ulong)save_base & PCI_BASE_ADDRESS_IO_MASK; | ||
628 | io_node->length = (ulong)base; | ||
629 | dbg("sur adapter: IO bar=0x%x(length=0x%x)\n", | ||
630 | io_node->base, io_node->length); | ||
631 | |||
632 | io_node->next = func->io_head; | ||
633 | func->io_head = io_node; | ||
634 | } else { /* map Memory */ | ||
635 | int prefetchable = 1; | ||
636 | /* struct pci_resources **res_node; */ | ||
637 | char *res_type_str = "PMEM"; | ||
638 | u32 temp_register2; | ||
639 | |||
640 | t_mem_node = kmalloc(sizeof (struct pci_resource), | ||
641 | GFP_KERNEL); | ||
642 | if (!t_mem_node) | ||
643 | return -ENOMEM; | ||
644 | |||
645 | if (!(base & PCI_BASE_ADDRESS_MEM_PREFETCH) && | ||
646 | (!disable || (save_command & PCI_COMMAND_MEMORY))) { | ||
647 | prefetchable = 0; | ||
648 | mem_node = t_mem_node; | ||
649 | res_type_str++; | ||
650 | } else | ||
651 | p_mem_node = t_mem_node; | ||
652 | |||
653 | base = base & 0xFFFFFFF0L; | ||
654 | base = (~base) + 1; | ||
655 | |||
656 | switch (temp_register & PCI_BASE_ADDRESS_MEM_TYPE_MASK) { | ||
657 | case PCI_BASE_ADDRESS_MEM_TYPE_32: | ||
658 | if (prefetchable) { | ||
659 | p_mem_node->base = (ulong)save_base & PCI_BASE_ADDRESS_MEM_MASK; | ||
660 | p_mem_node->length = (ulong)base; | ||
661 | dbg("sur adapter: 32 %s bar=0x%x(length=0x%x)\n", | ||
662 | res_type_str, | ||
663 | p_mem_node->base, | ||
664 | p_mem_node->length); | ||
665 | |||
666 | p_mem_node->next = func->p_mem_head; | ||
667 | func->p_mem_head = p_mem_node; | ||
668 | } else { | ||
669 | mem_node->base = (ulong)save_base & PCI_BASE_ADDRESS_MEM_MASK; | ||
670 | mem_node->length = (ulong)base; | ||
671 | dbg("sur adapter: 32 %s bar=0x%x(length=0x%x)\n", | ||
672 | res_type_str, | ||
673 | mem_node->base, | ||
674 | mem_node->length); | ||
675 | |||
676 | mem_node->next = func->mem_head; | ||
677 | func->mem_head = mem_node; | ||
678 | } | ||
679 | break; | ||
680 | case PCI_BASE_ADDRESS_MEM_TYPE_64: | ||
681 | pci_bus_read_config_dword(pci_bus, devfn, cloop+4, &temp_register2); | ||
682 | base64 = temp_register2; | ||
683 | base64 = (base64 << 32) | save_base; | ||
684 | |||
685 | if (temp_register2) { | ||
686 | dbg("sur adapter: 64 %s high dword of base64(0x%x:%x) masked to 0\n", | ||
687 | res_type_str, temp_register2, (u32)base64); | ||
688 | base64 &= 0x00000000FFFFFFFFL; | ||
689 | } | ||
690 | |||
691 | if (prefetchable) { | ||
692 | p_mem_node->base = base64 & PCI_BASE_ADDRESS_MEM_MASK; | ||
693 | p_mem_node->length = base; | ||
694 | dbg("sur adapter: 64 %s base=0x%x(len=0x%x)\n", | ||
695 | res_type_str, | ||
696 | p_mem_node->base, | ||
697 | p_mem_node->length); | ||
698 | |||
699 | p_mem_node->next = func->p_mem_head; | ||
700 | func->p_mem_head = p_mem_node; | ||
701 | } else { | ||
702 | mem_node->base = base64 & PCI_BASE_ADDRESS_MEM_MASK; | ||
703 | mem_node->length = base; | ||
704 | dbg("sur adapter: 64 %s base=0x%x(len=0x%x)\n", | ||
705 | res_type_str, | ||
706 | mem_node->base, | ||
707 | mem_node->length); | ||
708 | |||
709 | mem_node->next = func->mem_head; | ||
710 | func->mem_head = mem_node; | ||
711 | } | ||
712 | cloop += 4; | ||
713 | break; | ||
714 | default: | ||
715 | dbg("asur: reserved BAR type=0x%x\n", | ||
716 | temp_register); | ||
717 | break; | ||
718 | } | ||
719 | } | ||
720 | } /* End of base register loop */ | ||
721 | } else { /* Some other unknown header type */ | ||
722 | dbg("Save_used_res of PCI unknown type b:d=0x%x:%x. skip.\n", | ||
723 | func->bus, func->device); | ||
724 | } | ||
725 | |||
726 | /* find the next device in this slot */ | ||
727 | if (!disable) | ||
728 | break; | ||
729 | func = pciehp_slot_find(func->bus, func->device, index++); | ||
730 | } | ||
731 | |||
732 | return 0; | ||
733 | } | ||
734 | |||
735 | |||
736 | /** | ||
737 | * kfree_resource_list: release memory of all list members | ||
738 | * @res: resource list to free | ||
739 | */ | ||
740 | static inline void | ||
741 | return_resource_list(struct pci_resource **func, struct pci_resource **res) | ||
742 | { | ||
743 | struct pci_resource *node; | ||
744 | struct pci_resource *t_node; | ||
745 | |||
746 | node = *func; | ||
747 | *func = NULL; | ||
748 | while (node) { | ||
749 | t_node = node->next; | ||
750 | return_resource(res, node); | ||
751 | node = t_node; | ||
752 | } | ||
753 | } | ||
754 | |||
755 | /* | ||
756 | * pciehp_return_board_resources | ||
757 | * | ||
758 | * this routine returns all resources allocated to a board to | ||
759 | * the available pool. | ||
760 | * | ||
761 | * returns 0 if success | ||
762 | */ | ||
763 | int pciehp_return_board_resources(struct pci_func * func, | ||
764 | struct resource_lists * resources) | ||
765 | { | ||
766 | int rc; | ||
767 | |||
768 | dbg("%s\n", __FUNCTION__); | ||
769 | |||
770 | if (!func) | ||
771 | return 1; | ||
772 | |||
773 | return_resource_list(&(func->io_head),&(resources->io_head)); | ||
774 | return_resource_list(&(func->mem_head),&(resources->mem_head)); | ||
775 | return_resource_list(&(func->p_mem_head),&(resources->p_mem_head)); | ||
776 | return_resource_list(&(func->bus_head),&(resources->bus_head)); | ||
777 | |||
778 | rc = pciehp_resource_sort_and_combine(&(resources->mem_head)); | ||
779 | rc |= pciehp_resource_sort_and_combine(&(resources->p_mem_head)); | ||
780 | rc |= pciehp_resource_sort_and_combine(&(resources->io_head)); | ||
781 | rc |= pciehp_resource_sort_and_combine(&(resources->bus_head)); | ||
782 | |||
783 | return rc; | ||
784 | } | ||
785 | |||
786 | /** | ||
787 | * kfree_resource_list: release memory of all list members | ||
788 | * @res: resource list to free | ||
789 | */ | ||
790 | static inline void | ||
791 | kfree_resource_list(struct pci_resource **r) | ||
792 | { | ||
793 | struct pci_resource *res, *tres; | ||
794 | |||
795 | res = *r; | ||
796 | *r = NULL; | ||
797 | |||
798 | while (res) { | ||
799 | tres = res; | ||
800 | res = res->next; | ||
801 | kfree(tres); | ||
802 | } | ||
803 | } | ||
804 | |||
805 | /** | ||
806 | * pciehp_destroy_resource_list: put node back in the resource list | ||
807 | * @resources: list to put nodes back | ||
808 | */ | ||
809 | void pciehp_destroy_resource_list(struct resource_lists * resources) | ||
810 | { | ||
811 | kfree_resource_list(&(resources->io_head)); | ||
812 | kfree_resource_list(&(resources->mem_head)); | ||
813 | kfree_resource_list(&(resources->p_mem_head)); | ||
814 | kfree_resource_list(&(resources->bus_head)); | ||
815 | } | ||
816 | |||
817 | /** | ||
818 | * pciehp_destroy_board_resources: put node back in the resource list | ||
819 | * @resources: list to put nodes back | ||
820 | */ | ||
821 | void pciehp_destroy_board_resources(struct pci_func * func) | ||
822 | { | ||
823 | kfree_resource_list(&(func->io_head)); | ||
824 | kfree_resource_list(&(func->mem_head)); | ||
825 | kfree_resource_list(&(func->p_mem_head)); | ||
826 | kfree_resource_list(&(func->bus_head)); | ||
827 | } | ||
diff --git a/drivers/pci/hotplug/pciehprm.h b/drivers/pci/hotplug/pciehprm.h deleted file mode 100644 index 05f20fbc5f50..000000000000 --- a/drivers/pci/hotplug/pciehprm.h +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | /* | ||
2 | * PCIEHPRM : PCIEHP Resource Manager for ACPI/non-ACPI platform | ||
3 | * | ||
4 | * Copyright (C) 1995,2001 Compaq Computer Corporation | ||
5 | * Copyright (C) 2001,2003 Greg Kroah-Hartman (greg@kroah.com) | ||
6 | * Copyright (C) 2001 IBM Corp. | ||
7 | * Copyright (C) 2003-2004 Intel Corporation | ||
8 | * | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or (at | ||
14 | * your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, but | ||
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
19 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
20 | * details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | * | ||
26 | * Send feedback to <greg@kroah.com>, <kristen.c.accardi@intel.com> | ||
27 | * | ||
28 | */ | ||
29 | |||
30 | #ifndef _PCIEHPRM_H_ | ||
31 | #define _PCIEHPRM_H_ | ||
32 | |||
33 | #ifdef CONFIG_HOTPLUG_PCI_PCIE_PHPRM_NONACPI | ||
34 | #include "pciehprm_nonacpi.h" | ||
35 | #endif | ||
36 | |||
37 | int pciehprm_init(enum php_ctlr_type ct); | ||
38 | void pciehprm_cleanup(void); | ||
39 | int pciehprm_print_pirt(void); | ||
40 | int pciehprm_find_available_resources(struct controller *ctrl); | ||
41 | int pciehprm_set_hpp(struct controller *ctrl, struct pci_func *func, u8 card_type); | ||
42 | void pciehprm_enable_card(struct controller *ctrl, struct pci_func *func, u8 card_type); | ||
43 | |||
44 | #ifdef DEBUG | ||
45 | #define RES_CHECK(this, bits) \ | ||
46 | { if (((this) & (bits - 1))) \ | ||
47 | printk("%s:%d ERR: potential res loss!\n", __FUNCTION__, __LINE__); } | ||
48 | #else | ||
49 | #define RES_CHECK(this, bits) | ||
50 | #endif | ||
51 | |||
52 | #endif /* _PCIEHPRM_H_ */ | ||
diff --git a/drivers/pci/hotplug/pciehprm_acpi.c b/drivers/pci/hotplug/pciehprm_acpi.c index 1406db35b089..ae244e218620 100644 --- a/drivers/pci/hotplug/pciehprm_acpi.c +++ b/drivers/pci/hotplug/pciehprm_acpi.c | |||
@@ -24,100 +24,20 @@ | |||
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | #include <linux/module.h> | 27 | #include <linux/module.h> |
29 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
30 | #include <linux/types.h> | 29 | #include <linux/types.h> |
31 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
32 | #include <linux/init.h> | ||
33 | #include <linux/acpi.h> | 31 | #include <linux/acpi.h> |
34 | #include <linux/efi.h> | ||
35 | #include <linux/pci-acpi.h> | 32 | #include <linux/pci-acpi.h> |
36 | #include <asm/uaccess.h> | ||
37 | #include <asm/system.h> | ||
38 | #ifdef CONFIG_IA64 | ||
39 | #include <asm/iosapic.h> | ||
40 | #endif | ||
41 | #include <acpi/acpi.h> | ||
42 | #include <acpi/acpi_bus.h> | 33 | #include <acpi/acpi_bus.h> |
43 | #include <acpi/actypes.h> | 34 | #include <acpi/actypes.h> |
44 | #include "pciehp.h" | 35 | #include "pciehp.h" |
45 | #include "pciehprm.h" | ||
46 | |||
47 | #define PCI_MAX_BUS 0x100 | ||
48 | #define ACPI_STA_DEVICE_PRESENT 0x01 | ||
49 | 36 | ||
50 | #define METHOD_NAME__SUN "_SUN" | 37 | #define METHOD_NAME__SUN "_SUN" |
51 | #define METHOD_NAME__HPP "_HPP" | 38 | #define METHOD_NAME__HPP "_HPP" |
52 | #define METHOD_NAME_OSHP "OSHP" | 39 | #define METHOD_NAME_OSHP "OSHP" |
53 | 40 | ||
54 | /* Status code for running acpi method to gain native control */ | ||
55 | #define NC_NOT_RUN 0 | ||
56 | #define OSC_NOT_EXIST 1 | ||
57 | #define OSC_RUN_FAILED 2 | ||
58 | #define OSHP_NOT_EXIST 3 | ||
59 | #define OSHP_RUN_FAILED 4 | ||
60 | #define NC_RUN_SUCCESS 5 | ||
61 | |||
62 | #define PHP_RES_BUS 0xA0 | ||
63 | #define PHP_RES_IO 0xA1 | ||
64 | #define PHP_RES_MEM 0xA2 | ||
65 | #define PHP_RES_PMEM 0xA3 | ||
66 | |||
67 | #define BRIDGE_TYPE_P2P 0x00 | ||
68 | #define BRIDGE_TYPE_HOST 0x01 | ||
69 | |||
70 | /* this should go to drivers/acpi/include/ */ | ||
71 | struct acpi__hpp { | ||
72 | u8 cache_line_size; | ||
73 | u8 latency_timer; | ||
74 | u8 enable_serr; | ||
75 | u8 enable_perr; | ||
76 | }; | ||
77 | |||
78 | struct acpi_php_slot { | ||
79 | struct acpi_php_slot *next; | ||
80 | struct acpi_bridge *bridge; | ||
81 | acpi_handle handle; | ||
82 | int seg; | ||
83 | int bus; | ||
84 | int dev; | ||
85 | int fun; | ||
86 | u32 sun; | ||
87 | struct pci_resource *mem_head; | ||
88 | struct pci_resource *p_mem_head; | ||
89 | struct pci_resource *io_head; | ||
90 | struct pci_resource *bus_head; | ||
91 | void *slot_ops; /* _STA, _EJx, etc */ | ||
92 | struct slot *slot; | ||
93 | }; /* per func */ | ||
94 | |||
95 | struct acpi_bridge { | ||
96 | struct acpi_bridge *parent; | ||
97 | struct acpi_bridge *next; | ||
98 | struct acpi_bridge *child; | ||
99 | acpi_handle handle; | ||
100 | int seg; | ||
101 | int pbus; /* pdev->bus->number */ | ||
102 | int pdevice; /* PCI_SLOT(pdev->devfn) */ | ||
103 | int pfunction; /* PCI_DEVFN(pdev->devfn) */ | ||
104 | int bus; /* pdev->subordinate->number */ | ||
105 | struct acpi__hpp *_hpp; | ||
106 | struct acpi_php_slot *slots; | ||
107 | struct pci_resource *tmem_head; /* total from crs */ | ||
108 | struct pci_resource *tp_mem_head; /* total from crs */ | ||
109 | struct pci_resource *tio_head; /* total from crs */ | ||
110 | struct pci_resource *tbus_head; /* total from crs */ | ||
111 | struct pci_resource *mem_head; /* available */ | ||
112 | struct pci_resource *p_mem_head; /* available */ | ||
113 | struct pci_resource *io_head; /* available */ | ||
114 | struct pci_resource *bus_head; /* available */ | ||
115 | int scanned; | ||
116 | int type; | ||
117 | }; | ||
118 | |||
119 | static struct acpi_bridge *acpi_bridges_head; | ||
120 | |||
121 | static u8 * acpi_path_name( acpi_handle handle) | 41 | static u8 * acpi_path_name( acpi_handle handle) |
122 | { | 42 | { |
123 | acpi_status status; | 43 | acpi_status status; |
@@ -133,85 +53,43 @@ static u8 * acpi_path_name( acpi_handle handle) | |||
133 | return path_name; | 53 | return path_name; |
134 | } | 54 | } |
135 | 55 | ||
136 | static void acpi_get__hpp ( struct acpi_bridge *ab); | 56 | static acpi_status |
137 | static int acpi_run_oshp ( struct acpi_bridge *ab); | 57 | acpi_run_hpp(acpi_handle handle, struct hotplug_params *hpp) |
138 | static int osc_run_status = NC_NOT_RUN; | ||
139 | static int oshp_run_status = NC_NOT_RUN; | ||
140 | |||
141 | static int acpi_add_slot_to_php_slots( | ||
142 | struct acpi_bridge *ab, | ||
143 | int bus_num, | ||
144 | acpi_handle handle, | ||
145 | u32 adr, | ||
146 | u32 sun | ||
147 | ) | ||
148 | { | ||
149 | struct acpi_php_slot *aps; | ||
150 | static long samesun = -1; | ||
151 | |||
152 | aps = (struct acpi_php_slot *) kmalloc (sizeof(struct acpi_php_slot), GFP_KERNEL); | ||
153 | if (!aps) { | ||
154 | err ("acpi_pciehprm: alloc for aps fail\n"); | ||
155 | return -1; | ||
156 | } | ||
157 | memset(aps, 0, sizeof(struct acpi_php_slot)); | ||
158 | |||
159 | aps->handle = handle; | ||
160 | aps->bus = bus_num; | ||
161 | aps->dev = (adr >> 16) & 0xffff; | ||
162 | aps->fun = adr & 0xffff; | ||
163 | aps->sun = sun; | ||
164 | |||
165 | aps->next = ab->slots; /* cling to the bridge */ | ||
166 | aps->bridge = ab; | ||
167 | ab->slots = aps; | ||
168 | |||
169 | ab->scanned += 1; | ||
170 | if (!ab->_hpp) | ||
171 | acpi_get__hpp(ab); | ||
172 | |||
173 | if (osc_run_status == OSC_NOT_EXIST) | ||
174 | oshp_run_status = acpi_run_oshp(ab); | ||
175 | |||
176 | if (sun != samesun) { | ||
177 | info("acpi_pciehprm: Slot sun(%x) at s:b:d:f=0x%02x:%02x:%02x:%02x\n", | ||
178 | aps->sun, ab->seg, aps->bus, aps->dev, aps->fun); | ||
179 | samesun = sun; | ||
180 | } | ||
181 | return 0; | ||
182 | } | ||
183 | |||
184 | static void acpi_get__hpp ( struct acpi_bridge *ab) | ||
185 | { | 58 | { |
186 | acpi_status status; | 59 | acpi_status status; |
187 | u8 nui[4]; | 60 | u8 nui[4]; |
188 | struct acpi_buffer ret_buf = { 0, NULL}; | 61 | struct acpi_buffer ret_buf = { 0, NULL}; |
189 | union acpi_object *ext_obj, *package; | 62 | union acpi_object *ext_obj, *package; |
190 | u8 *path_name = acpi_path_name(ab->handle); | 63 | u8 *path_name = acpi_path_name(handle); |
191 | int i, len = 0; | 64 | int i, len = 0; |
192 | 65 | ||
193 | /* get _hpp */ | 66 | /* get _hpp */ |
194 | status = acpi_evaluate_object(ab->handle, METHOD_NAME__HPP, NULL, &ret_buf); | 67 | status = acpi_evaluate_object(handle, METHOD_NAME__HPP, NULL, &ret_buf); |
195 | switch (status) { | 68 | switch (status) { |
196 | case AE_BUFFER_OVERFLOW: | 69 | case AE_BUFFER_OVERFLOW: |
197 | ret_buf.pointer = kmalloc (ret_buf.length, GFP_KERNEL); | 70 | ret_buf.pointer = kmalloc (ret_buf.length, GFP_KERNEL); |
198 | if (!ret_buf.pointer) { | 71 | if (!ret_buf.pointer) { |
199 | err ("acpi_pciehprm:%s alloc for _HPP fail\n", path_name); | 72 | err ("%s:%s alloc for _HPP fail\n", __FUNCTION__, |
200 | return; | 73 | path_name); |
74 | return AE_NO_MEMORY; | ||
201 | } | 75 | } |
202 | status = acpi_evaluate_object(ab->handle, METHOD_NAME__HPP, NULL, &ret_buf); | 76 | status = acpi_evaluate_object(handle, METHOD_NAME__HPP, |
77 | NULL, &ret_buf); | ||
203 | if (ACPI_SUCCESS(status)) | 78 | if (ACPI_SUCCESS(status)) |
204 | break; | 79 | break; |
205 | default: | 80 | default: |
206 | if (ACPI_FAILURE(status)) { | 81 | if (ACPI_FAILURE(status)) { |
207 | err("acpi_pciehprm:%s _HPP fail=0x%x\n", path_name, status); | 82 | dbg("%s:%s _HPP fail=0x%x\n", __FUNCTION__, |
208 | return; | 83 | path_name, status); |
84 | return status; | ||
209 | } | 85 | } |
210 | } | 86 | } |
211 | 87 | ||
212 | ext_obj = (union acpi_object *) ret_buf.pointer; | 88 | ext_obj = (union acpi_object *) ret_buf.pointer; |
213 | if (ext_obj->type != ACPI_TYPE_PACKAGE) { | 89 | if (ext_obj->type != ACPI_TYPE_PACKAGE) { |
214 | err ("acpi_pciehprm:%s _HPP obj not a package\n", path_name); | 90 | err ("%s:%s _HPP obj not a package\n", __FUNCTION__, |
91 | path_name); | ||
92 | status = AE_ERROR; | ||
215 | goto free_and_return; | 93 | goto free_and_return; |
216 | } | 94 | } |
217 | 95 | ||
@@ -224,1514 +102,153 @@ static void acpi_get__hpp ( struct acpi_bridge *ab) | |||
224 | nui[i] = (u8)ext_obj->integer.value; | 102 | nui[i] = (u8)ext_obj->integer.value; |
225 | break; | 103 | break; |
226 | default: | 104 | default: |
227 | err ("acpi_pciehprm:%s _HPP obj type incorrect\n", path_name); | 105 | err ("%s:%s _HPP obj type incorrect\n", __FUNCTION__, |
106 | path_name); | ||
107 | status = AE_ERROR; | ||
228 | goto free_and_return; | 108 | goto free_and_return; |
229 | } | 109 | } |
230 | } | 110 | } |
231 | 111 | ||
232 | ab->_hpp = kmalloc (sizeof (struct acpi__hpp), GFP_KERNEL); | 112 | hpp->cache_line_size = nui[0]; |
233 | if (!ab->_hpp) { | 113 | hpp->latency_timer = nui[1]; |
234 | err ("acpi_pciehprm:%s alloc for _HPP failed\n", path_name); | 114 | hpp->enable_serr = nui[2]; |
235 | goto free_and_return; | 115 | hpp->enable_perr = nui[3]; |
236 | } | ||
237 | memset(ab->_hpp, 0, sizeof(struct acpi__hpp)); | ||
238 | 116 | ||
239 | ab->_hpp->cache_line_size = nui[0]; | 117 | dbg(" _HPP: cache_line_size=0x%x\n", hpp->cache_line_size); |
240 | ab->_hpp->latency_timer = nui[1]; | 118 | dbg(" _HPP: latency timer =0x%x\n", hpp->latency_timer); |
241 | ab->_hpp->enable_serr = nui[2]; | 119 | dbg(" _HPP: enable SERR =0x%x\n", hpp->enable_serr); |
242 | ab->_hpp->enable_perr = nui[3]; | 120 | dbg(" _HPP: enable PERR =0x%x\n", hpp->enable_perr); |
243 | |||
244 | dbg(" _HPP: cache_line_size=0x%x\n", ab->_hpp->cache_line_size); | ||
245 | dbg(" _HPP: latency timer =0x%x\n", ab->_hpp->latency_timer); | ||
246 | dbg(" _HPP: enable SERR =0x%x\n", ab->_hpp->enable_serr); | ||
247 | dbg(" _HPP: enable PERR =0x%x\n", ab->_hpp->enable_perr); | ||
248 | 121 | ||
249 | free_and_return: | 122 | free_and_return: |
250 | kfree(ret_buf.pointer); | 123 | kfree(ret_buf.pointer); |
124 | return status; | ||
251 | } | 125 | } |
252 | 126 | ||
253 | static int acpi_run_oshp ( struct acpi_bridge *ab) | 127 | static acpi_status acpi_run_oshp(acpi_handle handle) |
254 | { | 128 | { |
255 | acpi_status status; | 129 | acpi_status status; |
256 | u8 *path_name = acpi_path_name(ab->handle); | 130 | u8 *path_name = acpi_path_name(handle); |
257 | 131 | ||
258 | /* run OSHP */ | 132 | /* run OSHP */ |
259 | status = acpi_evaluate_object(ab->handle, METHOD_NAME_OSHP, NULL, NULL); | 133 | status = acpi_evaluate_object(handle, METHOD_NAME_OSHP, NULL, NULL); |
260 | if (ACPI_FAILURE(status)) { | 134 | if (ACPI_FAILURE(status)) { |
261 | err("acpi_pciehprm:%s OSHP fails=0x%x\n", path_name, status); | 135 | dbg("%s:%s OSHP fails=0x%x\n", __FUNCTION__, path_name, |
262 | oshp_run_status = (status == AE_NOT_FOUND) ? OSHP_NOT_EXIST : OSHP_RUN_FAILED; | 136 | status); |
263 | } else { | 137 | } else { |
264 | oshp_run_status = NC_RUN_SUCCESS; | 138 | dbg("%s:%s OSHP passes\n", __FUNCTION__, path_name); |
265 | dbg("acpi_pciehprm:%s OSHP passes =0x%x\n", path_name, status); | ||
266 | dbg("acpi_pciehprm:%s oshp_run_status =0x%x\n", path_name, oshp_run_status); | ||
267 | } | ||
268 | return oshp_run_status; | ||
269 | } | ||
270 | |||
271 | static acpi_status acpi_evaluate_crs( | ||
272 | acpi_handle handle, | ||
273 | struct acpi_resource **retbuf | ||
274 | ) | ||
275 | { | ||
276 | acpi_status status; | ||
277 | struct acpi_buffer crsbuf; | ||
278 | u8 *path_name = acpi_path_name(handle); | ||
279 | |||
280 | crsbuf.length = 0; | ||
281 | crsbuf.pointer = NULL; | ||
282 | |||
283 | status = acpi_get_current_resources (handle, &crsbuf); | ||
284 | |||
285 | switch (status) { | ||
286 | case AE_BUFFER_OVERFLOW: | ||
287 | break; /* found */ | ||
288 | case AE_NOT_FOUND: | ||
289 | dbg("acpi_pciehprm:%s _CRS not found\n", path_name); | ||
290 | return status; | ||
291 | default: | ||
292 | err ("acpi_pciehprm:%s _CRS fail=0x%x\n", path_name, status); | ||
293 | return status; | ||
294 | } | 139 | } |
295 | |||
296 | crsbuf.pointer = kmalloc (crsbuf.length, GFP_KERNEL); | ||
297 | if (!crsbuf.pointer) { | ||
298 | err ("acpi_pciehprm: alloc %ld bytes for %s _CRS fail\n", (ulong)crsbuf.length, path_name); | ||
299 | return AE_NO_MEMORY; | ||
300 | } | ||
301 | |||
302 | status = acpi_get_current_resources (handle, &crsbuf); | ||
303 | if (ACPI_FAILURE(status)) { | ||
304 | err("acpi_pciehprm: %s _CRS fail=0x%x.\n", path_name, status); | ||
305 | kfree(crsbuf.pointer); | ||
306 | return status; | ||
307 | } | ||
308 | |||
309 | *retbuf = crsbuf.pointer; | ||
310 | |||
311 | return status; | 140 | return status; |
312 | } | 141 | } |
313 | 142 | ||
314 | static void free_pci_resource ( struct pci_resource *aprh) | 143 | static int is_root_bridge(acpi_handle handle) |
315 | { | 144 | { |
316 | struct pci_resource *res, *next; | 145 | acpi_status status; |
146 | struct acpi_device_info *info; | ||
147 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
148 | int i; | ||
317 | 149 | ||
318 | for (res = aprh; res; res = next) { | 150 | status = acpi_get_object_info(handle, &buffer); |
319 | next = res->next; | 151 | if (ACPI_SUCCESS(status)) { |
320 | kfree(res); | 152 | info = buffer.pointer; |
321 | } | 153 | if ((info->valid & ACPI_VALID_HID) && |
322 | } | 154 | !strcmp(PCI_ROOT_HID_STRING, |
323 | 155 | info->hardware_id.value)) { | |
324 | static void print_pci_resource ( struct pci_resource *aprh) | 156 | acpi_os_free(buffer.pointer); |
325 | { | 157 | return 1; |
326 | struct pci_resource *res; | 158 | } |
327 | 159 | if (info->valid & ACPI_VALID_CID) { | |
328 | for (res = aprh; res; res = res->next) | 160 | for (i=0; i < info->compatibility_id.count; i++) { |
329 | dbg(" base= 0x%x length= 0x%x\n", res->base, res->length); | 161 | if (!strcmp(PCI_ROOT_HID_STRING, |
330 | } | 162 | info->compatibility_id.id[i].value)) { |
331 | 163 | acpi_os_free(buffer.pointer); | |
332 | static void print_slot_resources( struct acpi_php_slot *aps) | 164 | return 1; |
333 | { | 165 | } |
334 | if (aps->bus_head) { | 166 | } |
335 | dbg(" BUS Resources:\n"); | ||
336 | print_pci_resource (aps->bus_head); | ||
337 | } | ||
338 | |||
339 | if (aps->io_head) { | ||
340 | dbg(" IO Resources:\n"); | ||
341 | print_pci_resource (aps->io_head); | ||
342 | } | ||
343 | |||
344 | if (aps->mem_head) { | ||
345 | dbg(" MEM Resources:\n"); | ||
346 | print_pci_resource (aps->mem_head); | ||
347 | } | ||
348 | |||
349 | if (aps->p_mem_head) { | ||
350 | dbg(" PMEM Resources:\n"); | ||
351 | print_pci_resource (aps->p_mem_head); | ||
352 | } | ||
353 | } | ||
354 | |||
355 | static void print_pci_resources( struct acpi_bridge *ab) | ||
356 | { | ||
357 | if (ab->tbus_head) { | ||
358 | dbg(" Total BUS Resources:\n"); | ||
359 | print_pci_resource (ab->tbus_head); | ||
360 | } | ||
361 | if (ab->bus_head) { | ||
362 | dbg(" BUS Resources:\n"); | ||
363 | print_pci_resource (ab->bus_head); | ||
364 | } | ||
365 | |||
366 | if (ab->tio_head) { | ||
367 | dbg(" Total IO Resources:\n"); | ||
368 | print_pci_resource (ab->tio_head); | ||
369 | } | ||
370 | if (ab->io_head) { | ||
371 | dbg(" IO Resources:\n"); | ||
372 | print_pci_resource (ab->io_head); | ||
373 | } | ||
374 | |||
375 | if (ab->tmem_head) { | ||
376 | dbg(" Total MEM Resources:\n"); | ||
377 | print_pci_resource (ab->tmem_head); | ||
378 | } | ||
379 | if (ab->mem_head) { | ||
380 | dbg(" MEM Resources:\n"); | ||
381 | print_pci_resource (ab->mem_head); | ||
382 | } | ||
383 | |||
384 | if (ab->tp_mem_head) { | ||
385 | dbg(" Total PMEM Resources:\n"); | ||
386 | print_pci_resource (ab->tp_mem_head); | ||
387 | } | ||
388 | if (ab->p_mem_head) { | ||
389 | dbg(" PMEM Resources:\n"); | ||
390 | print_pci_resource (ab->p_mem_head); | ||
391 | } | ||
392 | if (ab->_hpp) { | ||
393 | dbg(" _HPP: cache_line_size=0x%x\n", ab->_hpp->cache_line_size); | ||
394 | dbg(" _HPP: latency timer =0x%x\n", ab->_hpp->latency_timer); | ||
395 | dbg(" _HPP: enable SERR =0x%x\n", ab->_hpp->enable_serr); | ||
396 | dbg(" _HPP: enable PERR =0x%x\n", ab->_hpp->enable_perr); | ||
397 | } | ||
398 | } | ||
399 | |||
400 | static int pciehprm_delete_resource( | ||
401 | struct pci_resource **aprh, | ||
402 | ulong base, | ||
403 | ulong size) | ||
404 | { | ||
405 | struct pci_resource *res; | ||
406 | struct pci_resource *prevnode; | ||
407 | struct pci_resource *split_node; | ||
408 | ulong tbase; | ||
409 | |||
410 | pciehp_resource_sort_and_combine(aprh); | ||
411 | |||
412 | for (res = *aprh; res; res = res->next) { | ||
413 | if (res->base > base) | ||
414 | continue; | ||
415 | |||
416 | if ((res->base + res->length) < (base + size)) | ||
417 | continue; | ||
418 | |||
419 | if (res->base < base) { | ||
420 | tbase = base; | ||
421 | |||
422 | if ((res->length - (tbase - res->base)) < size) | ||
423 | continue; | ||
424 | |||
425 | split_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
426 | if (!split_node) | ||
427 | return -ENOMEM; | ||
428 | |||
429 | split_node->base = res->base; | ||
430 | split_node->length = tbase - res->base; | ||
431 | res->base = tbase; | ||
432 | res->length -= split_node->length; | ||
433 | |||
434 | split_node->next = res->next; | ||
435 | res->next = split_node; | ||
436 | } | ||
437 | |||
438 | if (res->length >= size) { | ||
439 | split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
440 | if (!split_node) | ||
441 | return -ENOMEM; | ||
442 | |||
443 | split_node->base = res->base + size; | ||
444 | split_node->length = res->length - size; | ||
445 | res->length = size; | ||
446 | |||
447 | split_node->next = res->next; | ||
448 | res->next = split_node; | ||
449 | } | ||
450 | |||
451 | if (*aprh == res) { | ||
452 | *aprh = res->next; | ||
453 | } else { | ||
454 | prevnode = *aprh; | ||
455 | while (prevnode->next != res) | ||
456 | prevnode = prevnode->next; | ||
457 | |||
458 | prevnode->next = res->next; | ||
459 | } | ||
460 | res->next = NULL; | ||
461 | kfree(res); | ||
462 | break; | ||
463 | } | ||
464 | |||
465 | return 0; | ||
466 | } | ||
467 | |||
468 | static int pciehprm_delete_resources( | ||
469 | struct pci_resource **aprh, | ||
470 | struct pci_resource *this | ||
471 | ) | ||
472 | { | ||
473 | struct pci_resource *res; | ||
474 | |||
475 | for (res = this; res; res = res->next) | ||
476 | pciehprm_delete_resource(aprh, res->base, res->length); | ||
477 | |||
478 | return 0; | ||
479 | } | ||
480 | |||
481 | static int pciehprm_add_resource( | ||
482 | struct pci_resource **aprh, | ||
483 | ulong base, | ||
484 | ulong size) | ||
485 | { | ||
486 | struct pci_resource *res; | ||
487 | |||
488 | for (res = *aprh; res; res = res->next) { | ||
489 | if ((res->base + res->length) == base) { | ||
490 | res->length += size; | ||
491 | size = 0L; | ||
492 | break; | ||
493 | } | 167 | } |
494 | if (res->next == *aprh) | ||
495 | break; | ||
496 | } | 168 | } |
497 | |||
498 | if (size) { | ||
499 | res = kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
500 | if (!res) { | ||
501 | err ("acpi_pciehprm: alloc for res fail\n"); | ||
502 | return -ENOMEM; | ||
503 | } | ||
504 | memset(res, 0, sizeof (struct pci_resource)); | ||
505 | |||
506 | res->base = base; | ||
507 | res->length = size; | ||
508 | res->next = *aprh; | ||
509 | *aprh = res; | ||
510 | } | ||
511 | |||
512 | return 0; | 169 | return 0; |
513 | } | 170 | } |
514 | 171 | ||
515 | static int pciehprm_add_resources( | 172 | int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev) |
516 | struct pci_resource **aprh, | ||
517 | struct pci_resource *this | ||
518 | ) | ||
519 | { | ||
520 | struct pci_resource *res; | ||
521 | int rc = 0; | ||
522 | |||
523 | for (res = this; res && !rc; res = res->next) | ||
524 | rc = pciehprm_add_resource(aprh, res->base, res->length); | ||
525 | |||
526 | return rc; | ||
527 | } | ||
528 | |||
529 | static void acpi_parse_io ( | ||
530 | struct acpi_bridge *ab, | ||
531 | union acpi_resource_data *data | ||
532 | ) | ||
533 | { | 173 | { |
534 | struct acpi_resource_io *dataio; | 174 | acpi_status status; |
535 | dataio = (struct acpi_resource_io *) data; | 175 | acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev)); |
536 | 176 | struct pci_dev *pdev = dev; | |
537 | dbg("Io Resource\n"); | 177 | u8 *path_name; |
538 | dbg(" %d bit decode\n", ACPI_DECODE_16 == dataio->io_decode ? 16:10); | 178 | /* |
539 | dbg(" Range minimum base: %08X\n", dataio->min_base_address); | 179 | * Per PCI firmware specification, we should run the ACPI _OSC |
540 | dbg(" Range maximum base: %08X\n", dataio->max_base_address); | 180 | * method to get control of hotplug hardware before using it. |
541 | dbg(" Alignment: %08X\n", dataio->alignment); | 181 | * If an _OSC is missing, we look for an OSHP to do the same thing. |
542 | dbg(" Range Length: %08X\n", dataio->range_length); | 182 | * To handle different BIOS behavior, we look for _OSC and OSHP |
543 | } | 183 | * within the scope of the hotplug controller and its parents, upto |
544 | 184 | * the host bridge under which this controller exists. | |
545 | static void acpi_parse_fixed_io ( | ||
546 | struct acpi_bridge *ab, | ||
547 | union acpi_resource_data *data | ||
548 | ) | ||
549 | { | ||
550 | struct acpi_resource_fixed_io *datafio; | ||
551 | datafio = (struct acpi_resource_fixed_io *) data; | ||
552 | |||
553 | dbg("Fixed Io Resource\n"); | ||
554 | dbg(" Range base address: %08X", datafio->base_address); | ||
555 | dbg(" Range length: %08X", datafio->range_length); | ||
556 | } | ||
557 | |||
558 | static void acpi_parse_address16_32 ( | ||
559 | struct acpi_bridge *ab, | ||
560 | union acpi_resource_data *data, | ||
561 | acpi_resource_type id | ||
562 | ) | ||
563 | { | ||
564 | /* | ||
565 | * acpi_resource_address16 == acpi_resource_address32 | ||
566 | * acpi_resource_address16 *data16 = (acpi_resource_address16 *) data; | ||
567 | */ | 185 | */ |
568 | struct acpi_resource_address32 *data32 = (struct acpi_resource_address32 *) data; | 186 | while (!handle) { |
569 | struct pci_resource **aprh, **tprh; | 187 | /* |
570 | 188 | * This hotplug controller was not listed in the ACPI name | |
571 | if (id == ACPI_RSTYPE_ADDRESS16) | 189 | * space at all. Try to get acpi handle of parent pci bus. |
572 | dbg("acpi_pciehprm:16-Bit Address Space Resource\n"); | 190 | */ |
573 | else | 191 | if (!pdev || !pdev->bus->parent) |
574 | dbg("acpi_pciehprm:32-Bit Address Space Resource\n"); | ||
575 | |||
576 | switch (data32->resource_type) { | ||
577 | case ACPI_MEMORY_RANGE: | ||
578 | dbg(" Resource Type: Memory Range\n"); | ||
579 | aprh = &ab->mem_head; | ||
580 | tprh = &ab->tmem_head; | ||
581 | |||
582 | switch (data32->attribute.memory.cache_attribute) { | ||
583 | case ACPI_NON_CACHEABLE_MEMORY: | ||
584 | dbg(" Type Specific: Noncacheable memory\n"); | ||
585 | break; | ||
586 | case ACPI_CACHABLE_MEMORY: | ||
587 | dbg(" Type Specific: Cacheable memory\n"); | ||
588 | break; | ||
589 | case ACPI_WRITE_COMBINING_MEMORY: | ||
590 | dbg(" Type Specific: Write-combining memory\n"); | ||
591 | break; | ||
592 | case ACPI_PREFETCHABLE_MEMORY: | ||
593 | aprh = &ab->p_mem_head; | ||
594 | dbg(" Type Specific: Prefetchable memory\n"); | ||
595 | break; | ||
596 | default: | ||
597 | dbg(" Type Specific: Invalid cache attribute\n"); | ||
598 | break; | 192 | break; |
599 | } | 193 | dbg("Could not find %s in acpi namespace, trying parent\n", |
600 | 194 | pci_name(pdev)); | |
601 | dbg(" Type Specific: Read%s\n", ACPI_READ_WRITE_MEMORY == data32->attribute.memory.read_write_attribute ? "/Write":" Only"); | 195 | if (!pdev->bus->parent->self) |
602 | break; | 196 | /* Parent must be a host bridge */ |
603 | 197 | handle = acpi_get_pci_rootbridge_handle( | |
604 | case ACPI_IO_RANGE: | 198 | pci_domain_nr(pdev->bus->parent), |
605 | dbg(" Resource Type: I/O Range\n"); | 199 | pdev->bus->parent->number); |
606 | aprh = &ab->io_head; | 200 | else |
607 | tprh = &ab->tio_head; | 201 | handle = DEVICE_ACPI_HANDLE( |
608 | 202 | &(pdev->bus->parent->self->dev)); | |
609 | switch (data32->attribute.io.range_attribute) { | 203 | pdev = pdev->bus->parent->self; |
610 | case ACPI_NON_ISA_ONLY_RANGES: | 204 | } |
611 | dbg(" Type Specific: Non-ISA Io Addresses\n"); | 205 | |
612 | break; | 206 | while (handle) { |
613 | case ACPI_ISA_ONLY_RANGES: | 207 | path_name = acpi_path_name(handle); |
614 | dbg(" Type Specific: ISA Io Addresses\n"); | 208 | dbg("Trying to get hotplug control for %s \n", path_name); |
615 | break; | 209 | status = pci_osc_control_set(handle, |
616 | case ACPI_ENTIRE_RANGE: | 210 | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL); |
617 | dbg(" Type Specific: ISA and non-ISA Io Addresses\n"); | 211 | if (status == AE_NOT_FOUND) |
618 | break; | 212 | status = acpi_run_oshp(handle); |
619 | default: | 213 | if (ACPI_SUCCESS(status)) { |
620 | dbg(" Type Specific: Invalid range attribute\n"); | 214 | dbg("Gained control for hotplug HW for pci %s (%s)\n", |
215 | pci_name(dev), path_name); | ||
216 | return 0; | ||
217 | } | ||
218 | if (is_root_bridge(handle)) | ||
621 | break; | 219 | break; |
622 | } | 220 | chandle = handle; |
623 | break; | 221 | status = acpi_get_parent(chandle, &handle); |
624 | |||
625 | case ACPI_BUS_NUMBER_RANGE: | ||
626 | dbg(" Resource Type: Bus Number Range(fixed)\n"); | ||
627 | /* fixup to be compatible with the rest of php driver */ | ||
628 | data32->min_address_range++; | ||
629 | data32->address_length--; | ||
630 | aprh = &ab->bus_head; | ||
631 | tprh = &ab->tbus_head; | ||
632 | break; | ||
633 | default: | ||
634 | dbg(" Resource Type: Invalid resource type. Exiting.\n"); | ||
635 | return; | ||
636 | } | ||
637 | |||
638 | dbg(" Resource %s\n", ACPI_CONSUMER == data32->producer_consumer ? "Consumer":"Producer"); | ||
639 | dbg(" %s decode\n", ACPI_SUB_DECODE == data32->decode ? "Subtractive":"Positive"); | ||
640 | dbg(" Min address is %s fixed\n", ACPI_ADDRESS_FIXED == data32->min_address_fixed ? "":"not"); | ||
641 | dbg(" Max address is %s fixed\n", ACPI_ADDRESS_FIXED == data32->max_address_fixed ? "":"not"); | ||
642 | dbg(" Granularity: %08X\n", data32->granularity); | ||
643 | dbg(" Address range min: %08X\n", data32->min_address_range); | ||
644 | dbg(" Address range max: %08X\n", data32->max_address_range); | ||
645 | dbg(" Address translation offset: %08X\n", data32->address_translation_offset); | ||
646 | dbg(" Address Length: %08X\n", data32->address_length); | ||
647 | |||
648 | if (0xFF != data32->resource_source.index) { | ||
649 | dbg(" Resource Source Index: %X\n", data32->resource_source.index); | ||
650 | /* dbg(" Resource Source: %s\n", data32->resource_source.string_ptr); */ | ||
651 | } | ||
652 | |||
653 | pciehprm_add_resource(aprh, data32->min_address_range, data32->address_length); | ||
654 | } | ||
655 | |||
656 | static acpi_status acpi_parse_crs( | ||
657 | struct acpi_bridge *ab, | ||
658 | struct acpi_resource *crsbuf | ||
659 | ) | ||
660 | { | ||
661 | acpi_status status = AE_OK; | ||
662 | struct acpi_resource *resource = crsbuf; | ||
663 | u8 count = 0; | ||
664 | u8 done = 0; | ||
665 | |||
666 | while (!done) { | ||
667 | dbg("acpi_pciehprm: PCI bus 0x%x Resource structure %x.\n", ab->bus, count++); | ||
668 | switch (resource->id) { | ||
669 | case ACPI_RSTYPE_IRQ: | ||
670 | dbg("Irq -------- Resource\n"); | ||
671 | break; | ||
672 | case ACPI_RSTYPE_DMA: | ||
673 | dbg("DMA -------- Resource\n"); | ||
674 | break; | ||
675 | case ACPI_RSTYPE_START_DPF: | ||
676 | dbg("Start DPF -------- Resource\n"); | ||
677 | break; | ||
678 | case ACPI_RSTYPE_END_DPF: | ||
679 | dbg("End DPF -------- Resource\n"); | ||
680 | break; | ||
681 | case ACPI_RSTYPE_IO: | ||
682 | acpi_parse_io (ab, &resource->data); | ||
683 | break; | ||
684 | case ACPI_RSTYPE_FIXED_IO: | ||
685 | acpi_parse_fixed_io (ab, &resource->data); | ||
686 | break; | ||
687 | case ACPI_RSTYPE_VENDOR: | ||
688 | dbg("Vendor -------- Resource\n"); | ||
689 | break; | ||
690 | case ACPI_RSTYPE_END_TAG: | ||
691 | dbg("End_tag -------- Resource\n"); | ||
692 | done = 1; | ||
693 | break; | ||
694 | case ACPI_RSTYPE_MEM24: | ||
695 | dbg("Mem24 -------- Resource\n"); | ||
696 | break; | ||
697 | case ACPI_RSTYPE_MEM32: | ||
698 | dbg("Mem32 -------- Resource\n"); | ||
699 | break; | ||
700 | case ACPI_RSTYPE_FIXED_MEM32: | ||
701 | dbg("Fixed Mem32 -------- Resource\n"); | ||
702 | break; | ||
703 | case ACPI_RSTYPE_ADDRESS16: | ||
704 | acpi_parse_address16_32(ab, &resource->data, ACPI_RSTYPE_ADDRESS16); | ||
705 | break; | ||
706 | case ACPI_RSTYPE_ADDRESS32: | ||
707 | acpi_parse_address16_32(ab, &resource->data, ACPI_RSTYPE_ADDRESS32); | ||
708 | break; | ||
709 | case ACPI_RSTYPE_ADDRESS64: | ||
710 | info("Address64 -------- Resource unparsed\n"); | ||
711 | break; | ||
712 | case ACPI_RSTYPE_EXT_IRQ: | ||
713 | dbg("Ext Irq -------- Resource\n"); | ||
714 | break; | ||
715 | default: | ||
716 | dbg("Invalid -------- resource type 0x%x\n", resource->id); | ||
717 | break; | ||
718 | } | ||
719 | |||
720 | resource = (struct acpi_resource *) ((char *)resource + resource->length); | ||
721 | } | ||
722 | |||
723 | return status; | ||
724 | } | ||
725 | |||
726 | static acpi_status acpi_get_crs( struct acpi_bridge *ab) | ||
727 | { | ||
728 | acpi_status status; | ||
729 | struct acpi_resource *crsbuf; | ||
730 | |||
731 | status = acpi_evaluate_crs(ab->handle, &crsbuf); | ||
732 | if (ACPI_SUCCESS(status)) { | ||
733 | status = acpi_parse_crs(ab, crsbuf); | ||
734 | kfree(crsbuf); | ||
735 | |||
736 | pciehp_resource_sort_and_combine(&ab->bus_head); | ||
737 | pciehp_resource_sort_and_combine(&ab->io_head); | ||
738 | pciehp_resource_sort_and_combine(&ab->mem_head); | ||
739 | pciehp_resource_sort_and_combine(&ab->p_mem_head); | ||
740 | |||
741 | pciehprm_add_resources (&ab->tbus_head, ab->bus_head); | ||
742 | pciehprm_add_resources (&ab->tio_head, ab->io_head); | ||
743 | pciehprm_add_resources (&ab->tmem_head, ab->mem_head); | ||
744 | pciehprm_add_resources (&ab->tp_mem_head, ab->p_mem_head); | ||
745 | } | ||
746 | |||
747 | return status; | ||
748 | } | ||
749 | |||
750 | /* find acpi_bridge downword from ab. */ | ||
751 | static struct acpi_bridge * | ||
752 | find_acpi_bridge_by_bus( | ||
753 | struct acpi_bridge *ab, | ||
754 | int seg, | ||
755 | int bus /* pdev->subordinate->number */ | ||
756 | ) | ||
757 | { | ||
758 | struct acpi_bridge *lab = NULL; | ||
759 | |||
760 | if (!ab) | ||
761 | return NULL; | ||
762 | |||
763 | if ((ab->bus == bus) && (ab->seg == seg)) | ||
764 | return ab; | ||
765 | |||
766 | if (ab->child) | ||
767 | lab = find_acpi_bridge_by_bus(ab->child, seg, bus); | ||
768 | |||
769 | if (!lab) | ||
770 | if (ab->next) | ||
771 | lab = find_acpi_bridge_by_bus(ab->next, seg, bus); | ||
772 | |||
773 | return lab; | ||
774 | } | ||
775 | |||
776 | /* | ||
777 | * Build a device tree of ACPI PCI Bridges | ||
778 | */ | ||
779 | static void pciehprm_acpi_register_a_bridge ( | ||
780 | struct acpi_bridge **head, | ||
781 | struct acpi_bridge *pab, /* parent bridge to which child bridge is added */ | ||
782 | struct acpi_bridge *cab /* child bridge to add */ | ||
783 | ) | ||
784 | { | ||
785 | struct acpi_bridge *lpab; | ||
786 | struct acpi_bridge *lcab; | ||
787 | |||
788 | lpab = find_acpi_bridge_by_bus(*head, pab->seg, pab->bus); | ||
789 | if (!lpab) { | ||
790 | if (!(pab->type & BRIDGE_TYPE_HOST)) | ||
791 | warn("PCI parent bridge s:b(%x:%x) not in list.\n", pab->seg, pab->bus); | ||
792 | pab->next = *head; | ||
793 | *head = pab; | ||
794 | lpab = pab; | ||
795 | } | ||
796 | |||
797 | if ((cab->type & BRIDGE_TYPE_HOST) && (pab == cab)) | ||
798 | return; | ||
799 | |||
800 | lcab = find_acpi_bridge_by_bus(*head, cab->seg, cab->bus); | ||
801 | if (lcab) { | ||
802 | if ((pab->bus != lcab->parent->bus) || (lcab->bus != cab->bus)) | ||
803 | err("PCI child bridge s:b(%x:%x) in list with diff parent.\n", cab->seg, cab->bus); | ||
804 | return; | ||
805 | } else | ||
806 | lcab = cab; | ||
807 | |||
808 | lcab->parent = lpab; | ||
809 | lcab->next = lpab->child; | ||
810 | lpab->child = lcab; | ||
811 | } | ||
812 | |||
813 | static acpi_status pciehprm_acpi_build_php_slots_callback( | ||
814 | acpi_handle handle, | ||
815 | u32 Level, | ||
816 | void *context, | ||
817 | void **retval | ||
818 | ) | ||
819 | { | ||
820 | ulong bus_num; | ||
821 | ulong seg_num; | ||
822 | ulong sun, adr; | ||
823 | ulong padr = 0; | ||
824 | acpi_handle phandle = NULL; | ||
825 | struct acpi_bridge *pab = (struct acpi_bridge *)context; | ||
826 | struct acpi_bridge *lab; | ||
827 | acpi_status status; | ||
828 | u8 *path_name = acpi_path_name(handle); | ||
829 | |||
830 | /* get _SUN */ | ||
831 | status = acpi_evaluate_integer(handle, METHOD_NAME__SUN, NULL, &sun); | ||
832 | switch(status) { | ||
833 | case AE_NOT_FOUND: | ||
834 | return AE_OK; | ||
835 | default: | ||
836 | if (ACPI_FAILURE(status)) { | ||
837 | err("acpi_pciehprm:%s _SUN fail=0x%x\n", path_name, status); | ||
838 | return status; | ||
839 | } | ||
840 | } | ||
841 | |||
842 | /* get _ADR. _ADR must exist if _SUN exists */ | ||
843 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr); | ||
844 | if (ACPI_FAILURE(status)) { | ||
845 | err("acpi_pciehprm:%s _ADR fail=0x%x\n", path_name, status); | ||
846 | return status; | ||
847 | } | ||
848 | |||
849 | dbg("acpi_pciehprm:%s sun=0x%08x adr=0x%08x\n", path_name, (u32)sun, (u32)adr); | ||
850 | |||
851 | status = acpi_get_parent(handle, &phandle); | ||
852 | if (ACPI_FAILURE(status)) { | ||
853 | err("acpi_pciehprm:%s get_parent fail=0x%x\n", path_name, status); | ||
854 | return (status); | ||
855 | } | ||
856 | |||
857 | bus_num = pab->bus; | ||
858 | seg_num = pab->seg; | ||
859 | |||
860 | if (pab->bus == bus_num) { | ||
861 | lab = pab; | ||
862 | } else { | ||
863 | dbg("WARN: pab is not parent\n"); | ||
864 | lab = find_acpi_bridge_by_bus(pab, seg_num, bus_num); | ||
865 | if (!lab) { | ||
866 | dbg("acpi_pciehprm: alloc new P2P bridge(%x) for sun(%08x)\n", (u32)bus_num, (u32)sun); | ||
867 | lab = (struct acpi_bridge *)kmalloc(sizeof(struct acpi_bridge), GFP_KERNEL); | ||
868 | if (!lab) { | ||
869 | err("acpi_pciehprm: alloc for ab fail\n"); | ||
870 | return AE_NO_MEMORY; | ||
871 | } | ||
872 | memset(lab, 0, sizeof(struct acpi_bridge)); | ||
873 | |||
874 | lab->handle = phandle; | ||
875 | lab->pbus = pab->bus; | ||
876 | lab->pdevice = (int)(padr >> 16) & 0xffff; | ||
877 | lab->pfunction = (int)(padr & 0xffff); | ||
878 | lab->bus = (int)bus_num; | ||
879 | lab->scanned = 0; | ||
880 | lab->type = BRIDGE_TYPE_P2P; | ||
881 | |||
882 | pciehprm_acpi_register_a_bridge (&acpi_bridges_head, pab, lab); | ||
883 | } else | ||
884 | dbg("acpi_pciehprm: found P2P bridge(%x) for sun(%08x)\n", (u32)bus_num, (u32)sun); | ||
885 | } | ||
886 | |||
887 | acpi_add_slot_to_php_slots(lab, (int)bus_num, handle, (u32)adr, (u32)sun); | ||
888 | |||
889 | return (status); | ||
890 | } | ||
891 | |||
892 | static int pciehprm_acpi_build_php_slots( | ||
893 | struct acpi_bridge *ab, | ||
894 | u32 depth | ||
895 | ) | ||
896 | { | ||
897 | acpi_status status; | ||
898 | u8 *path_name = acpi_path_name(ab->handle); | ||
899 | |||
900 | /* Walk down this pci bridge to get _SUNs if any behind P2P */ | ||
901 | status = acpi_walk_namespace ( ACPI_TYPE_DEVICE, | ||
902 | ab->handle, | ||
903 | depth, | ||
904 | pciehprm_acpi_build_php_slots_callback, | ||
905 | ab, | ||
906 | NULL ); | ||
907 | if (ACPI_FAILURE(status)) { | ||
908 | dbg("acpi_pciehprm:%s walk for _SUN on pci bridge seg:bus(%x:%x) fail=0x%x\n", path_name, ab->seg, ab->bus, status); | ||
909 | return -1; | ||
910 | } | ||
911 | |||
912 | return 0; | ||
913 | } | ||
914 | |||
915 | static void build_a_bridge( | ||
916 | struct acpi_bridge *pab, | ||
917 | struct acpi_bridge *ab | ||
918 | ) | ||
919 | { | ||
920 | u8 *path_name = acpi_path_name(ab->handle); | ||
921 | |||
922 | pciehprm_acpi_register_a_bridge (&acpi_bridges_head, pab, ab); | ||
923 | |||
924 | switch (ab->type) { | ||
925 | case BRIDGE_TYPE_HOST: | ||
926 | dbg("acpi_pciehprm: Registered PCI HOST Bridge(%02x) on s:b:d:f(%02x:%02x:%02x:%02x) [%s]\n", | ||
927 | ab->bus, ab->seg, ab->pbus, ab->pdevice, ab->pfunction, path_name); | ||
928 | break; | ||
929 | case BRIDGE_TYPE_P2P: | ||
930 | dbg("acpi_pciehprm: Registered PCI P2P Bridge(%02x-%02x) on s:b:d:f(%02x:%02x:%02x:%02x) [%s]\n", | ||
931 | ab->pbus, ab->bus, ab->seg, ab->pbus, ab->pdevice, ab->pfunction, path_name); | ||
932 | break; | ||
933 | }; | ||
934 | |||
935 | /* build any immediate PHP slots under this pci bridge */ | ||
936 | pciehprm_acpi_build_php_slots(ab, 1); | ||
937 | } | ||
938 | |||
939 | static struct acpi_bridge * add_p2p_bridge( | ||
940 | acpi_handle handle, | ||
941 | struct acpi_bridge *pab, /* parent */ | ||
942 | ulong adr | ||
943 | ) | ||
944 | { | ||
945 | struct acpi_bridge *ab; | ||
946 | struct pci_dev *pdev; | ||
947 | ulong devnum, funcnum; | ||
948 | u8 *path_name = acpi_path_name(handle); | ||
949 | |||
950 | ab = (struct acpi_bridge *) kmalloc (sizeof(struct acpi_bridge), GFP_KERNEL); | ||
951 | if (!ab) { | ||
952 | err("acpi_pciehprm: alloc for ab fail\n"); | ||
953 | return NULL; | ||
954 | } | ||
955 | memset(ab, 0, sizeof(struct acpi_bridge)); | ||
956 | |||
957 | devnum = (adr >> 16) & 0xffff; | ||
958 | funcnum = adr & 0xffff; | ||
959 | |||
960 | pdev = pci_find_slot(pab->bus, PCI_DEVFN(devnum, funcnum)); | ||
961 | if (!pdev || !pdev->subordinate) { | ||
962 | err("acpi_pciehprm:%s is not a P2P Bridge\n", path_name); | ||
963 | kfree(ab); | ||
964 | return NULL; | ||
965 | } | ||
966 | |||
967 | ab->handle = handle; | ||
968 | ab->seg = pab->seg; | ||
969 | ab->pbus = pab->bus; /* or pdev->bus->number */ | ||
970 | ab->pdevice = devnum; /* or PCI_SLOT(pdev->devfn) */ | ||
971 | ab->pfunction = funcnum; /* or PCI_FUNC(pdev->devfn) */ | ||
972 | ab->bus = pdev->subordinate->number; | ||
973 | ab->scanned = 0; | ||
974 | ab->type = BRIDGE_TYPE_P2P; | ||
975 | |||
976 | dbg("acpi_pciehprm: P2P(%x-%x) on pci=b:d:f(%x:%x:%x) acpi=b:d:f(%x:%x:%x) [%s]\n", | ||
977 | pab->bus, ab->bus, pdev->bus->number, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), | ||
978 | pab->bus, (u32)devnum, (u32)funcnum, path_name); | ||
979 | |||
980 | build_a_bridge(pab, ab); | ||
981 | |||
982 | return ab; | ||
983 | } | ||
984 | |||
985 | static acpi_status scan_p2p_bridge( | ||
986 | acpi_handle handle, | ||
987 | u32 Level, | ||
988 | void *context, | ||
989 | void **retval | ||
990 | ) | ||
991 | { | ||
992 | struct acpi_bridge *pab = (struct acpi_bridge *)context; | ||
993 | struct acpi_bridge *ab; | ||
994 | acpi_status status; | ||
995 | ulong adr = 0; | ||
996 | u8 *path_name = acpi_path_name(handle); | ||
997 | ulong devnum, funcnum; | ||
998 | struct pci_dev *pdev; | ||
999 | |||
1000 | /* get device, function */ | ||
1001 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr); | ||
1002 | if (ACPI_FAILURE(status)) { | ||
1003 | if (status != AE_NOT_FOUND) | ||
1004 | err("acpi_pciehprm:%s _ADR fail=0x%x\n", path_name, status); | ||
1005 | return AE_OK; | ||
1006 | } | ||
1007 | |||
1008 | devnum = (adr >> 16) & 0xffff; | ||
1009 | funcnum = adr & 0xffff; | ||
1010 | |||
1011 | pdev = pci_find_slot(pab->bus, PCI_DEVFN(devnum, funcnum)); | ||
1012 | if (!pdev) | ||
1013 | return AE_OK; | ||
1014 | if (!pdev->subordinate) | ||
1015 | return AE_OK; | ||
1016 | |||
1017 | ab = add_p2p_bridge(handle, pab, adr); | ||
1018 | if (ab) { | ||
1019 | status = acpi_walk_namespace ( ACPI_TYPE_DEVICE, | ||
1020 | handle, | ||
1021 | (u32)1, | ||
1022 | scan_p2p_bridge, | ||
1023 | ab, | ||
1024 | NULL); | ||
1025 | if (ACPI_FAILURE(status)) | 222 | if (ACPI_FAILURE(status)) |
1026 | dbg("acpi_pciehprm:%s find_p2p fail=0x%x\n", path_name, status); | 223 | break; |
1027 | } | ||
1028 | |||
1029 | return AE_OK; | ||
1030 | } | ||
1031 | |||
1032 | static struct acpi_bridge * add_host_bridge( | ||
1033 | acpi_handle handle, | ||
1034 | ulong segnum, | ||
1035 | ulong busnum | ||
1036 | ) | ||
1037 | { | ||
1038 | ulong adr = 0; | ||
1039 | acpi_status status; | ||
1040 | struct acpi_bridge *ab; | ||
1041 | u8 *path_name = acpi_path_name(handle); | ||
1042 | |||
1043 | /* get device, function: host br adr is always 0000 though. */ | ||
1044 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr); | ||
1045 | if (ACPI_FAILURE(status)) { | ||
1046 | err("acpi_pciehprm:%s _ADR fail=0x%x\n", path_name, status); | ||
1047 | return NULL; | ||
1048 | } | ||
1049 | dbg("acpi_pciehprm: ROOT PCI seg(0x%x)bus(0x%x)dev(0x%x)func(0x%x) [%s]\n", (u32)segnum, | ||
1050 | (u32)busnum, (u32)(adr >> 16) & 0xffff, (u32)adr & 0xffff, path_name); | ||
1051 | |||
1052 | ab = (struct acpi_bridge *) kmalloc (sizeof(struct acpi_bridge), GFP_KERNEL); | ||
1053 | if (!ab) { | ||
1054 | err("acpi_pciehprm: alloc for ab fail\n"); | ||
1055 | return NULL; | ||
1056 | } | ||
1057 | memset(ab, 0, sizeof(struct acpi_bridge)); | ||
1058 | |||
1059 | ab->handle = handle; | ||
1060 | ab->seg = (int)segnum; | ||
1061 | ab->bus = ab->pbus = (int)busnum; | ||
1062 | ab->pdevice = (int)(adr >> 16) & 0xffff; | ||
1063 | ab->pfunction = (int)(adr & 0xffff); | ||
1064 | ab->scanned = 0; | ||
1065 | ab->type = BRIDGE_TYPE_HOST; | ||
1066 | |||
1067 | /* get root pci bridge's current resources */ | ||
1068 | status = acpi_get_crs(ab); | ||
1069 | if (ACPI_FAILURE(status)) { | ||
1070 | err("acpi_pciehprm:%s evaluate _CRS fail=0x%x\n", path_name, status); | ||
1071 | kfree(ab); | ||
1072 | return NULL; | ||
1073 | } | ||
1074 | |||
1075 | status = pci_osc_control_set (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL); | ||
1076 | if (ACPI_FAILURE(status)) { | ||
1077 | err("%s: status %x\n", __FUNCTION__, status); | ||
1078 | osc_run_status = (status == AE_NOT_FOUND) ? OSC_NOT_EXIST : OSC_RUN_FAILED; | ||
1079 | } else { | ||
1080 | osc_run_status = NC_RUN_SUCCESS; | ||
1081 | } | ||
1082 | dbg("%s: osc_run_status %x\n", __FUNCTION__, osc_run_status); | ||
1083 | |||
1084 | build_a_bridge(ab, ab); | ||
1085 | |||
1086 | return ab; | ||
1087 | } | ||
1088 | |||
1089 | static acpi_status acpi_scan_from_root_pci_callback ( | ||
1090 | acpi_handle handle, | ||
1091 | u32 Level, | ||
1092 | void *context, | ||
1093 | void **retval | ||
1094 | ) | ||
1095 | { | ||
1096 | ulong segnum = 0; | ||
1097 | ulong busnum = 0; | ||
1098 | acpi_status status; | ||
1099 | struct acpi_bridge *ab; | ||
1100 | u8 *path_name = acpi_path_name(handle); | ||
1101 | |||
1102 | /* get bus number of this pci root bridge */ | ||
1103 | status = acpi_evaluate_integer(handle, METHOD_NAME__SEG, NULL, &segnum); | ||
1104 | if (ACPI_FAILURE(status)) { | ||
1105 | if (status != AE_NOT_FOUND) { | ||
1106 | err("acpi_pciehprm:%s evaluate _SEG fail=0x%x\n", path_name, status); | ||
1107 | return status; | ||
1108 | } | ||
1109 | segnum = 0; | ||
1110 | } | ||
1111 | |||
1112 | /* get bus number of this pci root bridge */ | ||
1113 | status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, NULL, &busnum); | ||
1114 | if (ACPI_FAILURE(status)) { | ||
1115 | err("acpi_pciehprm:%s evaluate _BBN fail=0x%x\n", path_name, status); | ||
1116 | return (status); | ||
1117 | } | ||
1118 | |||
1119 | ab = add_host_bridge(handle, segnum, busnum); | ||
1120 | if (ab) { | ||
1121 | status = acpi_walk_namespace ( ACPI_TYPE_DEVICE, | ||
1122 | handle, | ||
1123 | 1, | ||
1124 | scan_p2p_bridge, | ||
1125 | ab, | ||
1126 | NULL); | ||
1127 | if (ACPI_FAILURE(status)) | ||
1128 | dbg("acpi_pciehprm:%s find_p2p fail=0x%x\n", path_name, status); | ||
1129 | } | 224 | } |
1130 | 225 | ||
1131 | return AE_OK; | 226 | err("Cannot get control of hotplug hardware for pci %s\n", |
227 | pci_name(dev)); | ||
228 | return -1; | ||
1132 | } | 229 | } |
1133 | 230 | ||
1134 | static int pciehprm_acpi_scan_pci (void) | 231 | void pciehp_get_hp_params_from_firmware(struct pci_dev *dev, |
232 | struct hotplug_params *hpp) | ||
1135 | { | 233 | { |
1136 | acpi_status status; | 234 | acpi_status status = AE_NOT_FOUND; |
235 | struct pci_dev *pdev = dev; | ||
1137 | 236 | ||
1138 | /* | 237 | /* |
1139 | * TBD: traverse LDM device tree with the help of | 238 | * _HPP settings apply to all child buses, until another _HPP is |
1140 | * unified ACPI augmented for php device population. | 239 | * encountered. If we don't find an _HPP for the input pci dev, |
240 | * look for it in the parent device scope since that would apply to | ||
241 | * this pci dev. If we don't find any _HPP, use hardcoded defaults | ||
1141 | */ | 242 | */ |
1142 | status = acpi_get_devices ( PCI_ROOT_HID_STRING, | 243 | while (pdev && (ACPI_FAILURE(status))) { |
1143 | acpi_scan_from_root_pci_callback, | 244 | acpi_handle handle = DEVICE_ACPI_HANDLE(&(pdev->dev)); |
1144 | NULL, | 245 | if (!handle) |
1145 | NULL ); | 246 | break; |
1146 | if (ACPI_FAILURE(status)) { | 247 | status = acpi_run_hpp(handle, hpp); |
1147 | err("acpi_pciehprm:get_device PCI ROOT HID fail=0x%x\n", status); | 248 | if (!(pdev->bus->parent)) |
1148 | return -1; | 249 | break; |
1149 | } | 250 | /* Check if a parent object supports _HPP */ |
1150 | 251 | pdev = pdev->bus->parent->self; | |
1151 | return 0; | ||
1152 | } | ||
1153 | |||
1154 | int pciehprm_init(enum php_ctlr_type ctlr_type) | ||
1155 | { | ||
1156 | int rc; | ||
1157 | |||
1158 | if (ctlr_type != PCI) | ||
1159 | return -ENODEV; | ||
1160 | |||
1161 | dbg("pciehprm ACPI init <enter>\n"); | ||
1162 | acpi_bridges_head = NULL; | ||
1163 | |||
1164 | /* construct PCI bus:device tree of acpi_handles */ | ||
1165 | rc = pciehprm_acpi_scan_pci(); | ||
1166 | if (rc) | ||
1167 | return rc; | ||
1168 | |||
1169 | if ((oshp_run_status != NC_RUN_SUCCESS) && (osc_run_status != NC_RUN_SUCCESS)) { | ||
1170 | err("Fails to gain control of native hot-plug\n"); | ||
1171 | rc = -ENODEV; | ||
1172 | } | ||
1173 | |||
1174 | dbg("pciehprm ACPI init %s\n", (rc)?"fail":"success"); | ||
1175 | return rc; | ||
1176 | } | ||
1177 | |||
1178 | static void free_a_slot(struct acpi_php_slot *aps) | ||
1179 | { | ||
1180 | dbg(" free a php func of slot(0x%02x) on PCI b:d:f=0x%02x:%02x:%02x\n", aps->sun, aps->bus, aps->dev, aps->fun); | ||
1181 | |||
1182 | free_pci_resource (aps->io_head); | ||
1183 | free_pci_resource (aps->bus_head); | ||
1184 | free_pci_resource (aps->mem_head); | ||
1185 | free_pci_resource (aps->p_mem_head); | ||
1186 | |||
1187 | kfree(aps); | ||
1188 | } | ||
1189 | |||
1190 | static void free_a_bridge( struct acpi_bridge *ab) | ||
1191 | { | ||
1192 | struct acpi_php_slot *aps, *next; | ||
1193 | |||
1194 | switch (ab->type) { | ||
1195 | case BRIDGE_TYPE_HOST: | ||
1196 | dbg("Free ACPI PCI HOST Bridge(%x) [%s] on s:b:d:f(%x:%x:%x:%x)\n", | ||
1197 | ab->bus, acpi_path_name(ab->handle), ab->seg, ab->pbus, ab->pdevice, ab->pfunction); | ||
1198 | break; | ||
1199 | case BRIDGE_TYPE_P2P: | ||
1200 | dbg("Free ACPI PCI P2P Bridge(%x-%x) [%s] on s:b:d:f(%x:%x:%x:%x)\n", | ||
1201 | ab->pbus, ab->bus, acpi_path_name(ab->handle), ab->seg, ab->pbus, ab->pdevice, ab->pfunction); | ||
1202 | break; | ||
1203 | }; | ||
1204 | |||
1205 | /* free slots first */ | ||
1206 | for (aps = ab->slots; aps; aps = next) { | ||
1207 | next = aps->next; | ||
1208 | free_a_slot(aps); | ||
1209 | } | ||
1210 | |||
1211 | free_pci_resource (ab->io_head); | ||
1212 | free_pci_resource (ab->tio_head); | ||
1213 | free_pci_resource (ab->bus_head); | ||
1214 | free_pci_resource (ab->tbus_head); | ||
1215 | free_pci_resource (ab->mem_head); | ||
1216 | free_pci_resource (ab->tmem_head); | ||
1217 | free_pci_resource (ab->p_mem_head); | ||
1218 | free_pci_resource (ab->tp_mem_head); | ||
1219 | |||
1220 | kfree(ab); | ||
1221 | } | ||
1222 | |||
1223 | static void pciehprm_free_bridges ( struct acpi_bridge *ab) | ||
1224 | { | ||
1225 | if (!ab) | ||
1226 | return; | ||
1227 | |||
1228 | if (ab->child) | ||
1229 | pciehprm_free_bridges (ab->child); | ||
1230 | |||
1231 | if (ab->next) | ||
1232 | pciehprm_free_bridges (ab->next); | ||
1233 | |||
1234 | free_a_bridge(ab); | ||
1235 | } | ||
1236 | |||
1237 | void pciehprm_cleanup(void) | ||
1238 | { | ||
1239 | pciehprm_free_bridges (acpi_bridges_head); | ||
1240 | } | ||
1241 | |||
1242 | static int get_number_of_slots ( | ||
1243 | struct acpi_bridge *ab, | ||
1244 | int selfonly | ||
1245 | ) | ||
1246 | { | ||
1247 | struct acpi_php_slot *aps; | ||
1248 | int prev_slot = -1; | ||
1249 | int slot_num = 0; | ||
1250 | |||
1251 | for ( aps = ab->slots; aps; aps = aps->next) | ||
1252 | if (aps->dev != prev_slot) { | ||
1253 | prev_slot = aps->dev; | ||
1254 | slot_num++; | ||
1255 | } | ||
1256 | |||
1257 | if (ab->child) | ||
1258 | slot_num += get_number_of_slots (ab->child, 0); | ||
1259 | |||
1260 | if (selfonly) | ||
1261 | return slot_num; | ||
1262 | |||
1263 | if (ab->next) | ||
1264 | slot_num += get_number_of_slots (ab->next, 0); | ||
1265 | |||
1266 | return slot_num; | ||
1267 | } | ||
1268 | |||
1269 | static int print_acpi_resources (struct acpi_bridge *ab) | ||
1270 | { | ||
1271 | struct acpi_php_slot *aps; | ||
1272 | int i; | ||
1273 | |||
1274 | switch (ab->type) { | ||
1275 | case BRIDGE_TYPE_HOST: | ||
1276 | dbg("PCI HOST Bridge (%x) [%s]\n", ab->bus, acpi_path_name(ab->handle)); | ||
1277 | break; | ||
1278 | case BRIDGE_TYPE_P2P: | ||
1279 | dbg("PCI P2P Bridge (%x-%x) [%s]\n", ab->pbus, ab->bus, acpi_path_name(ab->handle)); | ||
1280 | break; | ||
1281 | }; | ||
1282 | |||
1283 | print_pci_resources (ab); | ||
1284 | |||
1285 | for ( i = -1, aps = ab->slots; aps; aps = aps->next) { | ||
1286 | if (aps->dev == i) | ||
1287 | continue; | ||
1288 | dbg(" Slot sun(%x) s:b:d:f(%02x:%02x:%02x:%02x)\n", aps->sun, aps->seg, aps->bus, aps->dev, aps->fun); | ||
1289 | print_slot_resources(aps); | ||
1290 | i = aps->dev; | ||
1291 | } | ||
1292 | |||
1293 | if (ab->child) | ||
1294 | print_acpi_resources (ab->child); | ||
1295 | |||
1296 | if (ab->next) | ||
1297 | print_acpi_resources (ab->next); | ||
1298 | |||
1299 | return 0; | ||
1300 | } | ||
1301 | |||
1302 | int pciehprm_print_pirt(void) | ||
1303 | { | ||
1304 | dbg("PCIEHPRM ACPI Slots\n"); | ||
1305 | if (acpi_bridges_head) | ||
1306 | print_acpi_resources (acpi_bridges_head); | ||
1307 | |||
1308 | return 0; | ||
1309 | } | ||
1310 | |||
1311 | static struct acpi_php_slot * get_acpi_slot ( | ||
1312 | struct acpi_bridge *ab, | ||
1313 | u32 sun | ||
1314 | ) | ||
1315 | { | ||
1316 | struct acpi_php_slot *aps = NULL; | ||
1317 | |||
1318 | for ( aps = ab->slots; aps; aps = aps->next) | ||
1319 | if (aps->sun == sun) | ||
1320 | return aps; | ||
1321 | |||
1322 | if (!aps && ab->child) { | ||
1323 | aps = (struct acpi_php_slot *)get_acpi_slot (ab->child, sun); | ||
1324 | if (aps) | ||
1325 | return aps; | ||
1326 | } | ||
1327 | |||
1328 | if (!aps && ab->next) { | ||
1329 | aps = (struct acpi_php_slot *)get_acpi_slot (ab->next, sun); | ||
1330 | if (aps) | ||
1331 | return aps; | ||
1332 | } | ||
1333 | |||
1334 | return aps; | ||
1335 | |||
1336 | } | ||
1337 | |||
1338 | #if 0 | ||
1339 | void * pciehprm_get_slot(struct slot *slot) | ||
1340 | { | ||
1341 | struct acpi_bridge *ab = acpi_bridges_head; | ||
1342 | struct acpi_php_slot *aps = get_acpi_slot (ab, slot->number); | ||
1343 | |||
1344 | aps->slot = slot; | ||
1345 | |||
1346 | dbg("Got acpi slot sun(%x): s:b:d:f(%x:%x:%x:%x)\n", aps->sun, aps->seg, aps->bus, aps->dev, aps->fun); | ||
1347 | |||
1348 | return (void *)aps; | ||
1349 | } | ||
1350 | #endif | ||
1351 | |||
1352 | static void pciehprm_dump_func_res( struct pci_func *fun) | ||
1353 | { | ||
1354 | struct pci_func *func = fun; | ||
1355 | |||
1356 | if (func->bus_head) { | ||
1357 | dbg(": BUS Resources:\n"); | ||
1358 | print_pci_resource (func->bus_head); | ||
1359 | } | ||
1360 | if (func->io_head) { | ||
1361 | dbg(": IO Resources:\n"); | ||
1362 | print_pci_resource (func->io_head); | ||
1363 | } | ||
1364 | if (func->mem_head) { | ||
1365 | dbg(": MEM Resources:\n"); | ||
1366 | print_pci_resource (func->mem_head); | ||
1367 | } | ||
1368 | if (func->p_mem_head) { | ||
1369 | dbg(": PMEM Resources:\n"); | ||
1370 | print_pci_resource (func->p_mem_head); | ||
1371 | } | ||
1372 | } | ||
1373 | |||
1374 | static void pciehprm_dump_ctrl_res( struct controller *ctlr) | ||
1375 | { | ||
1376 | struct controller *ctrl = ctlr; | ||
1377 | |||
1378 | if (ctrl->bus_head) { | ||
1379 | dbg(": BUS Resources:\n"); | ||
1380 | print_pci_resource (ctrl->bus_head); | ||
1381 | } | ||
1382 | if (ctrl->io_head) { | ||
1383 | dbg(": IO Resources:\n"); | ||
1384 | print_pci_resource (ctrl->io_head); | ||
1385 | } | ||
1386 | if (ctrl->mem_head) { | ||
1387 | dbg(": MEM Resources:\n"); | ||
1388 | print_pci_resource (ctrl->mem_head); | ||
1389 | } | ||
1390 | if (ctrl->p_mem_head) { | ||
1391 | dbg(": PMEM Resources:\n"); | ||
1392 | print_pci_resource (ctrl->p_mem_head); | ||
1393 | } | ||
1394 | } | ||
1395 | |||
1396 | static int pciehprm_get_used_resources ( | ||
1397 | struct controller *ctrl, | ||
1398 | struct pci_func *func | ||
1399 | ) | ||
1400 | { | ||
1401 | return pciehp_save_used_resources (ctrl, func, !DISABLE_CARD); | ||
1402 | } | ||
1403 | |||
1404 | static int configure_existing_function( | ||
1405 | struct controller *ctrl, | ||
1406 | struct pci_func *func | ||
1407 | ) | ||
1408 | { | ||
1409 | int rc; | ||
1410 | |||
1411 | /* see how much resources the func has used. */ | ||
1412 | rc = pciehprm_get_used_resources (ctrl, func); | ||
1413 | |||
1414 | if (!rc) { | ||
1415 | /* subtract the resources used by the func from ctrl resources */ | ||
1416 | rc = pciehprm_delete_resources (&ctrl->bus_head, func->bus_head); | ||
1417 | rc |= pciehprm_delete_resources (&ctrl->io_head, func->io_head); | ||
1418 | rc |= pciehprm_delete_resources (&ctrl->mem_head, func->mem_head); | ||
1419 | rc |= pciehprm_delete_resources (&ctrl->p_mem_head, func->p_mem_head); | ||
1420 | if (rc) | ||
1421 | warn("aCEF: cannot del used resources\n"); | ||
1422 | } else | ||
1423 | err("aCEF: cannot get used resources\n"); | ||
1424 | |||
1425 | return rc; | ||
1426 | } | ||
1427 | |||
1428 | static int bind_pci_resources_to_slots ( struct controller *ctrl) | ||
1429 | { | ||
1430 | struct pci_func *func, new_func; | ||
1431 | int busn = ctrl->slot_bus; | ||
1432 | int devn, funn; | ||
1433 | u32 vid; | ||
1434 | |||
1435 | for (devn = 0; devn < 32; devn++) { | ||
1436 | for (funn = 0; funn < 8; funn++) { | ||
1437 | /* | ||
1438 | if (devn == ctrl->device && funn == ctrl->function) | ||
1439 | continue; | ||
1440 | */ | ||
1441 | /* find out if this entry is for an occupied slot */ | ||
1442 | vid = 0xFFFFFFFF; | ||
1443 | pci_bus_read_config_dword(ctrl->pci_dev->subordinate, PCI_DEVFN(devn, funn), PCI_VENDOR_ID, &vid); | ||
1444 | |||
1445 | if (vid != 0xFFFFFFFF) { | ||
1446 | dbg("%s: vid = %x\n", __FUNCTION__, vid); | ||
1447 | func = pciehp_slot_find(busn, devn, funn); | ||
1448 | if (!func) { | ||
1449 | memset(&new_func, 0, sizeof(struct pci_func)); | ||
1450 | new_func.bus = busn; | ||
1451 | new_func.device = devn; | ||
1452 | new_func.function = funn; | ||
1453 | new_func.is_a_board = 1; | ||
1454 | configure_existing_function(ctrl, &new_func); | ||
1455 | pciehprm_dump_func_res(&new_func); | ||
1456 | } else { | ||
1457 | configure_existing_function(ctrl, func); | ||
1458 | pciehprm_dump_func_res(func); | ||
1459 | } | ||
1460 | dbg("aCCF:existing PCI 0x%x Func ResourceDump\n", ctrl->bus); | ||
1461 | } | ||
1462 | } | ||
1463 | } | ||
1464 | |||
1465 | return 0; | ||
1466 | } | ||
1467 | |||
1468 | static int bind_pci_resources( | ||
1469 | struct controller *ctrl, | ||
1470 | struct acpi_bridge *ab | ||
1471 | ) | ||
1472 | { | ||
1473 | int status = 0; | ||
1474 | |||
1475 | if (ab->bus_head) { | ||
1476 | dbg("bapr: BUS Resources add on PCI 0x%x\n", ab->bus); | ||
1477 | status = pciehprm_add_resources (&ctrl->bus_head, ab->bus_head); | ||
1478 | if (pciehprm_delete_resources (&ab->bus_head, ctrl->bus_head)) | ||
1479 | warn("bapr: cannot sub BUS Resource on PCI 0x%x\n", ab->bus); | ||
1480 | if (status) { | ||
1481 | err("bapr: BUS Resource add on PCI 0x%x: fail=0x%x\n", ab->bus, status); | ||
1482 | return status; | ||
1483 | } | ||
1484 | } else | ||
1485 | info("bapr: No BUS Resource on PCI 0x%x.\n", ab->bus); | ||
1486 | |||
1487 | if (ab->io_head) { | ||
1488 | dbg("bapr: IO Resources add on PCI 0x%x\n", ab->bus); | ||
1489 | status = pciehprm_add_resources (&ctrl->io_head, ab->io_head); | ||
1490 | if (pciehprm_delete_resources (&ab->io_head, ctrl->io_head)) | ||
1491 | warn("bapr: cannot sub IO Resource on PCI 0x%x\n", ab->bus); | ||
1492 | if (status) { | ||
1493 | err("bapr: IO Resource add on PCI 0x%x: fail=0x%x\n", ab->bus, status); | ||
1494 | return status; | ||
1495 | } | ||
1496 | } else | ||
1497 | info("bapr: No IO Resource on PCI 0x%x.\n", ab->bus); | ||
1498 | |||
1499 | if (ab->mem_head) { | ||
1500 | dbg("bapr: MEM Resources add on PCI 0x%x\n", ab->bus); | ||
1501 | status = pciehprm_add_resources (&ctrl->mem_head, ab->mem_head); | ||
1502 | if (pciehprm_delete_resources (&ab->mem_head, ctrl->mem_head)) | ||
1503 | warn("bapr: cannot sub MEM Resource on PCI 0x%x\n", ab->bus); | ||
1504 | if (status) { | ||
1505 | err("bapr: MEM Resource add on PCI 0x%x: fail=0x%x\n", ab->bus, status); | ||
1506 | return status; | ||
1507 | } | ||
1508 | } else | ||
1509 | info("bapr: No MEM Resource on PCI 0x%x.\n", ab->bus); | ||
1510 | |||
1511 | if (ab->p_mem_head) { | ||
1512 | dbg("bapr: PMEM Resources add on PCI 0x%x\n", ab->bus); | ||
1513 | status = pciehprm_add_resources (&ctrl->p_mem_head, ab->p_mem_head); | ||
1514 | if (pciehprm_delete_resources (&ab->p_mem_head, ctrl->p_mem_head)) | ||
1515 | warn("bapr: cannot sub PMEM Resource on PCI 0x%x\n", ab->bus); | ||
1516 | if (status) { | ||
1517 | err("bapr: PMEM Resource add on PCI 0x%x: fail=0x%x\n", ab->bus, status); | ||
1518 | return status; | ||
1519 | } | ||
1520 | } else | ||
1521 | info("bapr: No PMEM Resource on PCI 0x%x.\n", ab->bus); | ||
1522 | |||
1523 | return status; | ||
1524 | } | ||
1525 | |||
1526 | static int no_pci_resources( struct acpi_bridge *ab) | ||
1527 | { | ||
1528 | return !(ab->p_mem_head || ab->mem_head || ab->io_head || ab->bus_head); | ||
1529 | } | ||
1530 | |||
1531 | static int find_pci_bridge_resources ( | ||
1532 | struct controller *ctrl, | ||
1533 | struct acpi_bridge *ab | ||
1534 | ) | ||
1535 | { | ||
1536 | int rc = 0; | ||
1537 | struct pci_func func; | ||
1538 | |||
1539 | memset(&func, 0, sizeof(struct pci_func)); | ||
1540 | |||
1541 | func.bus = ab->pbus; | ||
1542 | func.device = ab->pdevice; | ||
1543 | func.function = ab->pfunction; | ||
1544 | func.is_a_board = 1; | ||
1545 | |||
1546 | /* Get used resources for this PCI bridge */ | ||
1547 | rc = pciehp_save_used_resources (ctrl, &func, !DISABLE_CARD); | ||
1548 | |||
1549 | ab->io_head = func.io_head; | ||
1550 | ab->mem_head = func.mem_head; | ||
1551 | ab->p_mem_head = func.p_mem_head; | ||
1552 | ab->bus_head = func.bus_head; | ||
1553 | if (ab->bus_head) | ||
1554 | pciehprm_delete_resource(&ab->bus_head, ctrl->pci_dev->subordinate->number, 1); | ||
1555 | |||
1556 | return rc; | ||
1557 | } | ||
1558 | |||
1559 | static int get_pci_resources_from_bridge( | ||
1560 | struct controller *ctrl, | ||
1561 | struct acpi_bridge *ab | ||
1562 | ) | ||
1563 | { | ||
1564 | int rc = 0; | ||
1565 | |||
1566 | dbg("grfb: Get Resources for PCI 0x%x from actual PCI bridge 0x%x.\n", ctrl->bus, ab->bus); | ||
1567 | |||
1568 | rc = find_pci_bridge_resources (ctrl, ab); | ||
1569 | |||
1570 | pciehp_resource_sort_and_combine(&ab->bus_head); | ||
1571 | pciehp_resource_sort_and_combine(&ab->io_head); | ||
1572 | pciehp_resource_sort_and_combine(&ab->mem_head); | ||
1573 | pciehp_resource_sort_and_combine(&ab->p_mem_head); | ||
1574 | |||
1575 | pciehprm_add_resources (&ab->tbus_head, ab->bus_head); | ||
1576 | pciehprm_add_resources (&ab->tio_head, ab->io_head); | ||
1577 | pciehprm_add_resources (&ab->tmem_head, ab->mem_head); | ||
1578 | pciehprm_add_resources (&ab->tp_mem_head, ab->p_mem_head); | ||
1579 | |||
1580 | return rc; | ||
1581 | } | ||
1582 | |||
1583 | static int get_pci_resources( | ||
1584 | struct controller *ctrl, | ||
1585 | struct acpi_bridge *ab | ||
1586 | ) | ||
1587 | { | ||
1588 | int rc = 0; | ||
1589 | |||
1590 | if (no_pci_resources(ab)) { | ||
1591 | dbg("spbr:PCI 0x%x has no resources. Get parent resources.\n", ab->bus); | ||
1592 | rc = get_pci_resources_from_bridge(ctrl, ab); | ||
1593 | } | ||
1594 | |||
1595 | return rc; | ||
1596 | } | ||
1597 | |||
1598 | /* | ||
1599 | * Get resources for this ctrl. | ||
1600 | * 1. get total resources from ACPI _CRS or bridge (this ctrl) | ||
1601 | * 2. find used resources of existing adapters | ||
1602 | * 3. subtract used resources from total resources | ||
1603 | */ | ||
1604 | int pciehprm_find_available_resources( struct controller *ctrl) | ||
1605 | { | ||
1606 | int rc = 0; | ||
1607 | struct acpi_bridge *ab; | ||
1608 | |||
1609 | ab = find_acpi_bridge_by_bus(acpi_bridges_head, ctrl->seg, ctrl->pci_dev->subordinate->number); | ||
1610 | if (!ab) { | ||
1611 | err("pfar:cannot locate acpi bridge of PCI 0x%x.\n", ctrl->pci_dev->subordinate->number); | ||
1612 | return -1; | ||
1613 | } | ||
1614 | if (no_pci_resources(ab)) { | ||
1615 | rc = get_pci_resources(ctrl, ab); | ||
1616 | if (rc) { | ||
1617 | err("pfar:cannot get pci resources of PCI 0x%x.\n", ctrl->pci_dev->subordinate->number); | ||
1618 | return -1; | ||
1619 | } | ||
1620 | } | ||
1621 | |||
1622 | rc = bind_pci_resources(ctrl, ab); | ||
1623 | dbg("pfar:pre-Bind PCI 0x%x Ctrl Resource Dump\n", ctrl->pci_dev->subordinate->number); | ||
1624 | pciehprm_dump_ctrl_res(ctrl); | ||
1625 | |||
1626 | bind_pci_resources_to_slots (ctrl); | ||
1627 | |||
1628 | dbg("pfar:post-Bind PCI 0x%x Ctrl Resource Dump\n", ctrl->pci_dev->subordinate->number); | ||
1629 | pciehprm_dump_ctrl_res(ctrl); | ||
1630 | |||
1631 | return rc; | ||
1632 | } | ||
1633 | |||
1634 | int pciehprm_set_hpp( | ||
1635 | struct controller *ctrl, | ||
1636 | struct pci_func *func, | ||
1637 | u8 card_type | ||
1638 | ) | ||
1639 | { | ||
1640 | struct acpi_bridge *ab; | ||
1641 | struct pci_bus lpci_bus, *pci_bus; | ||
1642 | int rc = 0; | ||
1643 | unsigned int devfn; | ||
1644 | u8 cls= 0x08; /* default cache line size */ | ||
1645 | u8 lt = 0x40; /* default latency timer */ | ||
1646 | u8 ep = 0; | ||
1647 | u8 es = 0; | ||
1648 | |||
1649 | memcpy(&lpci_bus, ctrl->pci_bus, sizeof(lpci_bus)); | ||
1650 | pci_bus = &lpci_bus; | ||
1651 | pci_bus->number = func->bus; | ||
1652 | devfn = PCI_DEVFN(func->device, func->function); | ||
1653 | |||
1654 | ab = find_acpi_bridge_by_bus(acpi_bridges_head, ctrl->seg, ctrl->bus); | ||
1655 | |||
1656 | if (ab) { | ||
1657 | if (ab->_hpp) { | ||
1658 | lt = (u8)ab->_hpp->latency_timer; | ||
1659 | cls = (u8)ab->_hpp->cache_line_size; | ||
1660 | ep = (u8)ab->_hpp->enable_perr; | ||
1661 | es = (u8)ab->_hpp->enable_serr; | ||
1662 | } else | ||
1663 | dbg("_hpp: no _hpp for B/D/F=%#x/%#x/%#x. use default value\n", func->bus, func->device, func->function); | ||
1664 | } else | ||
1665 | dbg("_hpp: no acpi bridge for B/D/F = %#x/%#x/%#x. use default value\n", func->bus, func->device, func->function); | ||
1666 | |||
1667 | |||
1668 | if (card_type == PCI_HEADER_TYPE_BRIDGE) { | ||
1669 | /* set subordinate Latency Timer */ | ||
1670 | rc |= pci_bus_write_config_byte(pci_bus, devfn, PCI_SEC_LATENCY_TIMER, lt); | ||
1671 | } | 252 | } |
1672 | |||
1673 | /* set base Latency Timer */ | ||
1674 | rc |= pci_bus_write_config_byte(pci_bus, devfn, PCI_LATENCY_TIMER, lt); | ||
1675 | dbg(" set latency timer =0x%02x: %x\n", lt, rc); | ||
1676 | |||
1677 | rc |= pci_bus_write_config_byte(pci_bus, devfn, PCI_CACHE_LINE_SIZE, cls); | ||
1678 | dbg(" set cache_line_size=0x%02x: %x\n", cls, rc); | ||
1679 | |||
1680 | return rc; | ||
1681 | } | 253 | } |
1682 | 254 | ||
1683 | void pciehprm_enable_card( | ||
1684 | struct controller *ctrl, | ||
1685 | struct pci_func *func, | ||
1686 | u8 card_type) | ||
1687 | { | ||
1688 | u16 command, cmd, bcommand, bcmd; | ||
1689 | struct pci_bus lpci_bus, *pci_bus; | ||
1690 | struct acpi_bridge *ab; | ||
1691 | unsigned int devfn; | ||
1692 | int rc; | ||
1693 | |||
1694 | memcpy(&lpci_bus, ctrl->pci_bus, sizeof(lpci_bus)); | ||
1695 | pci_bus = &lpci_bus; | ||
1696 | pci_bus->number = func->bus; | ||
1697 | devfn = PCI_DEVFN(func->device, func->function); | ||
1698 | |||
1699 | rc = pci_bus_read_config_word(pci_bus, devfn, PCI_COMMAND, &cmd); | ||
1700 | |||
1701 | if (card_type == PCI_HEADER_TYPE_BRIDGE) { | ||
1702 | rc = pci_bus_read_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, &bcmd); | ||
1703 | } | ||
1704 | |||
1705 | command = cmd | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE | ||
1706 | | PCI_COMMAND_IO | PCI_COMMAND_MEMORY; | ||
1707 | bcommand = bcmd | PCI_BRIDGE_CTL_NO_ISA; | ||
1708 | |||
1709 | ab = find_acpi_bridge_by_bus(acpi_bridges_head, ctrl->seg, ctrl->bus); | ||
1710 | if (ab) { | ||
1711 | if (ab->_hpp) { | ||
1712 | if (ab->_hpp->enable_perr) { | ||
1713 | command |= PCI_COMMAND_PARITY; | ||
1714 | bcommand |= PCI_BRIDGE_CTL_PARITY; | ||
1715 | } else { | ||
1716 | command &= ~PCI_COMMAND_PARITY; | ||
1717 | bcommand &= ~PCI_BRIDGE_CTL_PARITY; | ||
1718 | } | ||
1719 | if (ab->_hpp->enable_serr) { | ||
1720 | command |= PCI_COMMAND_SERR; | ||
1721 | bcommand |= PCI_BRIDGE_CTL_SERR; | ||
1722 | } else { | ||
1723 | command &= ~PCI_COMMAND_SERR; | ||
1724 | bcommand &= ~PCI_BRIDGE_CTL_SERR; | ||
1725 | } | ||
1726 | } else | ||
1727 | dbg("no _hpp for B/D/F = %#x/%#x/%#x.\n", func->bus, func->device, func->function); | ||
1728 | } else | ||
1729 | dbg("no acpi bridge for B/D/F = %#x/%#x/%#x.\n", func->bus, func->device, func->function); | ||
1730 | |||
1731 | if (command != cmd) { | ||
1732 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_COMMAND, command); | ||
1733 | } | ||
1734 | if ((card_type == PCI_HEADER_TYPE_BRIDGE) && (bcommand != bcmd)) { | ||
1735 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, bcommand); | ||
1736 | } | ||
1737 | } | ||
diff --git a/drivers/pci/hotplug/pciehprm_nonacpi.c b/drivers/pci/hotplug/pciehprm_nonacpi.c index 76c727c74cc0..29180dfe8493 100644 --- a/drivers/pci/hotplug/pciehprm_nonacpi.c +++ b/drivers/pci/hotplug/pciehprm_nonacpi.c | |||
@@ -27,479 +27,21 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
33 | #include <linux/types.h> | 32 | #include <linux/types.h> |
34 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
35 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
36 | #include <linux/init.h> | ||
37 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
38 | |||
39 | #include <asm/uaccess.h> | ||
40 | #ifdef CONFIG_IA64 | ||
41 | #include <asm/iosapic.h> | ||
42 | #endif | ||
43 | |||
44 | #include "pciehp.h" | 36 | #include "pciehp.h" |
45 | #include "pciehprm.h" | ||
46 | #include "pciehprm_nonacpi.h" | ||
47 | |||
48 | 37 | ||
49 | void pciehprm_cleanup(void) | 38 | void pciehp_get_hp_params_from_firmware(struct pci_dev *dev, |
39 | struct hotplug_params *hpp) | ||
50 | { | 40 | { |
51 | return; | 41 | return; |
52 | } | 42 | } |
53 | 43 | ||
54 | int pciehprm_print_pirt(void) | 44 | int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev) |
55 | { | ||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | int pciehprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum) | ||
60 | { | ||
61 | |||
62 | *sun = (u8) (ctrl->first_slot); | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | |||
67 | static void print_pci_resource ( struct pci_resource *aprh) | ||
68 | { | ||
69 | struct pci_resource *res; | ||
70 | |||
71 | for (res = aprh; res; res = res->next) | ||
72 | dbg(" base= 0x%x length= 0x%x\n", res->base, res->length); | ||
73 | } | ||
74 | |||
75 | |||
76 | static void phprm_dump_func_res( struct pci_func *fun) | ||
77 | { | ||
78 | struct pci_func *func = fun; | ||
79 | |||
80 | if (func->bus_head) { | ||
81 | dbg(": BUS Resources:\n"); | ||
82 | print_pci_resource (func->bus_head); | ||
83 | } | ||
84 | if (func->io_head) { | ||
85 | dbg(": IO Resources:\n"); | ||
86 | print_pci_resource (func->io_head); | ||
87 | } | ||
88 | if (func->mem_head) { | ||
89 | dbg(": MEM Resources:\n"); | ||
90 | print_pci_resource (func->mem_head); | ||
91 | } | ||
92 | if (func->p_mem_head) { | ||
93 | dbg(": PMEM Resources:\n"); | ||
94 | print_pci_resource (func->p_mem_head); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | static int phprm_get_used_resources ( | ||
99 | struct controller *ctrl, | ||
100 | struct pci_func *func | ||
101 | ) | ||
102 | { | ||
103 | return pciehp_save_used_resources (ctrl, func, !DISABLE_CARD); | ||
104 | } | ||
105 | |||
106 | static int phprm_delete_resource( | ||
107 | struct pci_resource **aprh, | ||
108 | ulong base, | ||
109 | ulong size) | ||
110 | { | ||
111 | struct pci_resource *res; | ||
112 | struct pci_resource *prevnode; | ||
113 | struct pci_resource *split_node; | ||
114 | ulong tbase; | ||
115 | |||
116 | pciehp_resource_sort_and_combine(aprh); | ||
117 | |||
118 | for (res = *aprh; res; res = res->next) { | ||
119 | if (res->base > base) | ||
120 | continue; | ||
121 | |||
122 | if ((res->base + res->length) < (base + size)) | ||
123 | continue; | ||
124 | |||
125 | if (res->base < base) { | ||
126 | tbase = base; | ||
127 | |||
128 | if ((res->length - (tbase - res->base)) < size) | ||
129 | continue; | ||
130 | |||
131 | split_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
132 | if (!split_node) | ||
133 | return -ENOMEM; | ||
134 | |||
135 | split_node->base = res->base; | ||
136 | split_node->length = tbase - res->base; | ||
137 | res->base = tbase; | ||
138 | res->length -= split_node->length; | ||
139 | |||
140 | split_node->next = res->next; | ||
141 | res->next = split_node; | ||
142 | } | ||
143 | |||
144 | if (res->length >= size) { | ||
145 | split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
146 | if (!split_node) | ||
147 | return -ENOMEM; | ||
148 | |||
149 | split_node->base = res->base + size; | ||
150 | split_node->length = res->length - size; | ||
151 | res->length = size; | ||
152 | |||
153 | split_node->next = res->next; | ||
154 | res->next = split_node; | ||
155 | } | ||
156 | |||
157 | if (*aprh == res) { | ||
158 | *aprh = res->next; | ||
159 | } else { | ||
160 | prevnode = *aprh; | ||
161 | while (prevnode->next != res) | ||
162 | prevnode = prevnode->next; | ||
163 | |||
164 | prevnode->next = res->next; | ||
165 | } | ||
166 | res->next = NULL; | ||
167 | kfree(res); | ||
168 | break; | ||
169 | } | ||
170 | |||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | |||
175 | static int phprm_delete_resources( | ||
176 | struct pci_resource **aprh, | ||
177 | struct pci_resource *this | ||
178 | ) | ||
179 | { | ||
180 | struct pci_resource *res; | ||
181 | |||
182 | for (res = this; res; res = res->next) | ||
183 | phprm_delete_resource(aprh, res->base, res->length); | ||
184 | |||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | |||
189 | static int configure_existing_function( | ||
190 | struct controller *ctrl, | ||
191 | struct pci_func *func | ||
192 | ) | ||
193 | { | ||
194 | int rc; | ||
195 | |||
196 | /* see how much resources the func has used. */ | ||
197 | rc = phprm_get_used_resources (ctrl, func); | ||
198 | |||
199 | if (!rc) { | ||
200 | /* subtract the resources used by the func from ctrl resources */ | ||
201 | rc = phprm_delete_resources (&ctrl->bus_head, func->bus_head); | ||
202 | rc |= phprm_delete_resources (&ctrl->io_head, func->io_head); | ||
203 | rc |= phprm_delete_resources (&ctrl->mem_head, func->mem_head); | ||
204 | rc |= phprm_delete_resources (&ctrl->p_mem_head, func->p_mem_head); | ||
205 | if (rc) | ||
206 | warn("aCEF: cannot del used resources\n"); | ||
207 | } else | ||
208 | err("aCEF: cannot get used resources\n"); | ||
209 | |||
210 | return rc; | ||
211 | } | ||
212 | |||
213 | static int pciehprm_delete_resource( | ||
214 | struct pci_resource **aprh, | ||
215 | ulong base, | ||
216 | ulong size) | ||
217 | { | ||
218 | struct pci_resource *res; | ||
219 | struct pci_resource *prevnode; | ||
220 | struct pci_resource *split_node; | ||
221 | ulong tbase; | ||
222 | |||
223 | pciehp_resource_sort_and_combine(aprh); | ||
224 | |||
225 | for (res = *aprh; res; res = res->next) { | ||
226 | if (res->base > base) | ||
227 | continue; | ||
228 | |||
229 | if ((res->base + res->length) < (base + size)) | ||
230 | continue; | ||
231 | |||
232 | if (res->base < base) { | ||
233 | tbase = base; | ||
234 | |||
235 | if ((res->length - (tbase - res->base)) < size) | ||
236 | continue; | ||
237 | |||
238 | split_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
239 | if (!split_node) | ||
240 | return -ENOMEM; | ||
241 | |||
242 | split_node->base = res->base; | ||
243 | split_node->length = tbase - res->base; | ||
244 | res->base = tbase; | ||
245 | res->length -= split_node->length; | ||
246 | |||
247 | split_node->next = res->next; | ||
248 | res->next = split_node; | ||
249 | } | ||
250 | |||
251 | if (res->length >= size) { | ||
252 | split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
253 | if (!split_node) | ||
254 | return -ENOMEM; | ||
255 | |||
256 | split_node->base = res->base + size; | ||
257 | split_node->length = res->length - size; | ||
258 | res->length = size; | ||
259 | |||
260 | split_node->next = res->next; | ||
261 | res->next = split_node; | ||
262 | } | ||
263 | |||
264 | if (*aprh == res) { | ||
265 | *aprh = res->next; | ||
266 | } else { | ||
267 | prevnode = *aprh; | ||
268 | while (prevnode->next != res) | ||
269 | prevnode = prevnode->next; | ||
270 | |||
271 | prevnode->next = res->next; | ||
272 | } | ||
273 | res->next = NULL; | ||
274 | kfree(res); | ||
275 | break; | ||
276 | } | ||
277 | |||
278 | return 0; | ||
279 | } | ||
280 | |||
281 | static int bind_pci_resources_to_slots ( struct controller *ctrl) | ||
282 | { | 45 | { |
283 | struct pci_func *func, new_func; | ||
284 | int busn = ctrl->slot_bus; | ||
285 | int devn, funn; | ||
286 | u32 vid; | ||
287 | |||
288 | for (devn = 0; devn < 32; devn++) { | ||
289 | for (funn = 0; funn < 8; funn++) { | ||
290 | /* | ||
291 | if (devn == ctrl->device && funn == ctrl->function) | ||
292 | continue; | ||
293 | */ | ||
294 | /* find out if this entry is for an occupied slot */ | ||
295 | vid = 0xFFFFFFFF; | ||
296 | |||
297 | pci_bus_read_config_dword(ctrl->pci_dev->subordinate, PCI_DEVFN(devn, funn), PCI_VENDOR_ID, &vid); | ||
298 | |||
299 | if (vid != 0xFFFFFFFF) { | ||
300 | dbg("%s: vid = %x bus %x dev %x fun %x\n", __FUNCTION__, | ||
301 | vid, busn, devn, funn); | ||
302 | func = pciehp_slot_find(busn, devn, funn); | ||
303 | dbg("%s: func = %p\n", __FUNCTION__,func); | ||
304 | if (!func) { | ||
305 | memset(&new_func, 0, sizeof(struct pci_func)); | ||
306 | new_func.bus = busn; | ||
307 | new_func.device = devn; | ||
308 | new_func.function = funn; | ||
309 | new_func.is_a_board = 1; | ||
310 | configure_existing_function(ctrl, &new_func); | ||
311 | phprm_dump_func_res(&new_func); | ||
312 | } else { | ||
313 | configure_existing_function(ctrl, func); | ||
314 | phprm_dump_func_res(func); | ||
315 | } | ||
316 | dbg("aCCF:existing PCI 0x%x Func ResourceDump\n", ctrl->bus); | ||
317 | } | ||
318 | } | ||
319 | } | ||
320 | |||
321 | return 0; | 46 | return 0; |
322 | } | 47 | } |
323 | |||
324 | static void phprm_dump_ctrl_res( struct controller *ctlr) | ||
325 | { | ||
326 | struct controller *ctrl = ctlr; | ||
327 | |||
328 | if (ctrl->bus_head) { | ||
329 | dbg(": BUS Resources:\n"); | ||
330 | print_pci_resource (ctrl->bus_head); | ||
331 | } | ||
332 | if (ctrl->io_head) { | ||
333 | dbg(": IO Resources:\n"); | ||
334 | print_pci_resource (ctrl->io_head); | ||
335 | } | ||
336 | if (ctrl->mem_head) { | ||
337 | dbg(": MEM Resources:\n"); | ||
338 | print_pci_resource (ctrl->mem_head); | ||
339 | } | ||
340 | if (ctrl->p_mem_head) { | ||
341 | dbg(": PMEM Resources:\n"); | ||
342 | print_pci_resource (ctrl->p_mem_head); | ||
343 | } | ||
344 | } | ||
345 | |||
346 | /* | ||
347 | * phprm_find_available_resources | ||
348 | * | ||
349 | * Finds available memory, IO, and IRQ resources for programming | ||
350 | * devices which may be added to the system | ||
351 | * this function is for hot plug ADD! | ||
352 | * | ||
353 | * returns 0 if success | ||
354 | */ | ||
355 | int pciehprm_find_available_resources(struct controller *ctrl) | ||
356 | { | ||
357 | struct pci_func func; | ||
358 | u32 rc; | ||
359 | |||
360 | memset(&func, 0, sizeof(struct pci_func)); | ||
361 | |||
362 | func.bus = ctrl->bus; | ||
363 | func.device = ctrl->device; | ||
364 | func.function = ctrl->function; | ||
365 | func.is_a_board = 1; | ||
366 | |||
367 | /* Get resources for this PCI bridge */ | ||
368 | rc = pciehp_save_used_resources (ctrl, &func, !DISABLE_CARD); | ||
369 | dbg("%s: pciehp_save_used_resources rc = %d\n", __FUNCTION__, rc); | ||
370 | |||
371 | if (func.mem_head) | ||
372 | func.mem_head->next = ctrl->mem_head; | ||
373 | ctrl->mem_head = func.mem_head; | ||
374 | |||
375 | if (func.p_mem_head) | ||
376 | func.p_mem_head->next = ctrl->p_mem_head; | ||
377 | ctrl->p_mem_head = func.p_mem_head; | ||
378 | |||
379 | if (func.io_head) | ||
380 | func.io_head->next = ctrl->io_head; | ||
381 | ctrl->io_head = func.io_head; | ||
382 | |||
383 | if(func.bus_head) | ||
384 | func.bus_head->next = ctrl->bus_head; | ||
385 | ctrl->bus_head = func.bus_head; | ||
386 | |||
387 | if (ctrl->bus_head) | ||
388 | pciehprm_delete_resource(&ctrl->bus_head, ctrl->pci_dev->subordinate->number, 1); | ||
389 | |||
390 | dbg("%s:pre-Bind PCI 0x%x Ctrl Resource Dump\n", __FUNCTION__, ctrl->bus); | ||
391 | phprm_dump_ctrl_res(ctrl); | ||
392 | |||
393 | dbg("%s: before bind_pci_resources_to slots\n", __FUNCTION__); | ||
394 | |||
395 | bind_pci_resources_to_slots (ctrl); | ||
396 | |||
397 | dbg("%s:post-Bind PCI 0x%x Ctrl Resource Dump\n", __FUNCTION__, ctrl->bus); | ||
398 | phprm_dump_ctrl_res(ctrl); | ||
399 | |||
400 | return (rc); | ||
401 | } | ||
402 | |||
403 | int pciehprm_set_hpp( | ||
404 | struct controller *ctrl, | ||
405 | struct pci_func *func, | ||
406 | u8 card_type) | ||
407 | { | ||
408 | u32 rc; | ||
409 | u8 temp_byte; | ||
410 | struct pci_bus lpci_bus, *pci_bus; | ||
411 | unsigned int devfn; | ||
412 | memcpy(&lpci_bus, ctrl->pci_bus, sizeof(lpci_bus)); | ||
413 | pci_bus = &lpci_bus; | ||
414 | pci_bus->number = func->bus; | ||
415 | devfn = PCI_DEVFN(func->device, func->function); | ||
416 | |||
417 | temp_byte = 0x40; /* hard coded value for LT */ | ||
418 | if (card_type == PCI_HEADER_TYPE_BRIDGE) { | ||
419 | /* set subordinate Latency Timer */ | ||
420 | rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_SEC_LATENCY_TIMER, temp_byte); | ||
421 | |||
422 | if (rc) { | ||
423 | dbg("%s: set secondary LT error. b:d:f(%02x:%02x:%02x)\n", __FUNCTION__, | ||
424 | func->bus, func->device, func->function); | ||
425 | return rc; | ||
426 | } | ||
427 | } | ||
428 | |||
429 | /* set base Latency Timer */ | ||
430 | rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_LATENCY_TIMER, temp_byte); | ||
431 | |||
432 | if (rc) { | ||
433 | dbg("%s: set LT error. b:d:f(%02x:%02x:%02x)\n", __FUNCTION__, func->bus, func->device, func->function); | ||
434 | return rc; | ||
435 | } | ||
436 | |||
437 | /* set Cache Line size */ | ||
438 | temp_byte = 0x08; /* hard coded value for CLS */ | ||
439 | |||
440 | rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_CACHE_LINE_SIZE, temp_byte); | ||
441 | |||
442 | if (rc) { | ||
443 | dbg("%s: set CLS error. b:d:f(%02x:%02x:%02x)\n", __FUNCTION__, func->bus, func->device, func->function); | ||
444 | } | ||
445 | |||
446 | /* set enable_perr */ | ||
447 | /* set enable_serr */ | ||
448 | |||
449 | return rc; | ||
450 | } | ||
451 | |||
452 | void pciehprm_enable_card( | ||
453 | struct controller *ctrl, | ||
454 | struct pci_func *func, | ||
455 | u8 card_type) | ||
456 | { | ||
457 | u16 command, bcommand; | ||
458 | struct pci_bus lpci_bus, *pci_bus; | ||
459 | unsigned int devfn; | ||
460 | int rc; | ||
461 | |||
462 | memcpy(&lpci_bus, ctrl->pci_bus, sizeof(lpci_bus)); | ||
463 | pci_bus = &lpci_bus; | ||
464 | pci_bus->number = func->bus; | ||
465 | devfn = PCI_DEVFN(func->device, func->function); | ||
466 | |||
467 | rc = pci_bus_read_config_word(pci_bus, devfn, PCI_COMMAND, &command); | ||
468 | |||
469 | command |= PCI_COMMAND_PARITY | PCI_COMMAND_SERR | ||
470 | | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE | ||
471 | | PCI_COMMAND_IO | PCI_COMMAND_MEMORY; | ||
472 | |||
473 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_COMMAND, command); | ||
474 | |||
475 | if (card_type == PCI_HEADER_TYPE_BRIDGE) { | ||
476 | |||
477 | rc = pci_bus_read_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, &bcommand); | ||
478 | |||
479 | bcommand |= PCI_BRIDGE_CTL_PARITY | PCI_BRIDGE_CTL_SERR | ||
480 | | PCI_BRIDGE_CTL_NO_ISA; | ||
481 | |||
482 | rc = pci_bus_write_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, bcommand); | ||
483 | } | ||
484 | } | ||
485 | |||
486 | static int legacy_pciehprm_init_pci(void) | ||
487 | { | ||
488 | return 0; | ||
489 | } | ||
490 | |||
491 | int pciehprm_init(enum php_ctlr_type ctrl_type) | ||
492 | { | ||
493 | int retval; | ||
494 | |||
495 | switch (ctrl_type) { | ||
496 | case PCI: | ||
497 | retval = legacy_pciehprm_init_pci(); | ||
498 | break; | ||
499 | default: | ||
500 | retval = -ENODEV; | ||
501 | break; | ||
502 | } | ||
503 | |||
504 | return retval; | ||
505 | } | ||
diff --git a/drivers/pci/hotplug/pciehprm_nonacpi.h b/drivers/pci/hotplug/pciehprm_nonacpi.h deleted file mode 100644 index b10603b0e958..000000000000 --- a/drivers/pci/hotplug/pciehprm_nonacpi.h +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | /* | ||
2 | * PCIEHPRM NONACPI: PHP Resource Manager for Non-ACPI/Legacy platform | ||
3 | * | ||
4 | * Copyright (C) 1995,2001 Compaq Computer Corporation | ||
5 | * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com) | ||
6 | * Copyright (C) 2001 IBM Corp. | ||
7 | * Copyright (C) 2003-2004 Intel Corporation | ||
8 | * | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or (at | ||
14 | * your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, but | ||
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
19 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
20 | * details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | * | ||
26 | * Send feedback to <greg@kroah.com>, <kristen.c.accardi@intel.com> | ||
27 | * | ||
28 | */ | ||
29 | |||
30 | #ifndef _PCIEHPRM_NONACPI_H_ | ||
31 | #define _PCIEHPRM_NONACPI_H_ | ||
32 | |||
33 | struct irq_info { | ||
34 | u8 bus, devfn; /* bus, device and function */ | ||
35 | struct { | ||
36 | u8 link; /* IRQ line ID, chipset dependent, 0=not routed */ | ||
37 | u16 bitmap; /* Available IRQs */ | ||
38 | } __attribute__ ((packed)) irq[4]; | ||
39 | u8 slot; /* slot number, 0=onboard */ | ||
40 | u8 rfu; | ||
41 | } __attribute__ ((packed)); | ||
42 | |||
43 | struct irq_routing_table { | ||
44 | u32 signature; /* PIRQ_SIGNATURE should be here */ | ||
45 | u16 version; /* PIRQ_VERSION */ | ||
46 | u16 size; /* Table size in bytes */ | ||
47 | u8 rtr_bus, rtr_devfn; /* Where the interrupt router lies */ | ||
48 | u16 exclusive_irqs; /* IRQs devoted exclusively to PCI usage */ | ||
49 | u16 rtr_vendor, rtr_device; /* Vendor and device ID of interrupt router */ | ||
50 | u32 miniport_data; /* Crap */ | ||
51 | u8 rfu[11]; | ||
52 | u8 checksum; /* Modulo 256 checksum must give zero */ | ||
53 | struct irq_info slots[0]; | ||
54 | } __attribute__ ((packed)); | ||
55 | |||
56 | #endif /* _PCIEHPRM_NONACPI_H_ */ | ||
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c index fcb66b9a0e28..cc03609f45d0 100644 --- a/drivers/pci/hotplug/rpadlpar_core.c +++ b/drivers/pci/hotplug/rpadlpar_core.c | |||
@@ -134,43 +134,6 @@ static void rpadlpar_claim_one_bus(struct pci_bus *b) | |||
134 | rpadlpar_claim_one_bus(child_bus); | 134 | rpadlpar_claim_one_bus(child_bus); |
135 | } | 135 | } |
136 | 136 | ||
137 | static int pci_add_secondary_bus(struct device_node *dn, | ||
138 | struct pci_dev *bridge_dev) | ||
139 | { | ||
140 | struct pci_dn *pdn = dn->data; | ||
141 | struct pci_controller *hose = pdn->phb; | ||
142 | struct pci_bus *child; | ||
143 | u8 sec_busno; | ||
144 | |||
145 | /* Get busno of downstream bus */ | ||
146 | pci_read_config_byte(bridge_dev, PCI_SECONDARY_BUS, &sec_busno); | ||
147 | |||
148 | /* Allocate and add to children of bridge_dev->bus */ | ||
149 | child = pci_add_new_bus(bridge_dev->bus, bridge_dev, sec_busno); | ||
150 | if (!child) { | ||
151 | printk(KERN_ERR "%s: could not add secondary bus\n", __FUNCTION__); | ||
152 | return -ENOMEM; | ||
153 | } | ||
154 | |||
155 | sprintf(child->name, "PCI Bus #%02x", child->number); | ||
156 | |||
157 | /* Fixup subordinate bridge bases and resources */ | ||
158 | pcibios_fixup_bus(child); | ||
159 | |||
160 | /* Claim new bus resources */ | ||
161 | rpadlpar_claim_one_bus(bridge_dev->bus); | ||
162 | |||
163 | if (hose->last_busno < child->number) | ||
164 | hose->last_busno = child->number; | ||
165 | |||
166 | pdn->bussubno = child->number; | ||
167 | |||
168 | /* ioremap() for child bus, which may or may not succeed */ | ||
169 | remap_bus_range(child); | ||
170 | |||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent, | 137 | static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent, |
175 | struct device_node *dev_dn) | 138 | struct device_node *dev_dn) |
176 | { | 139 | { |
@@ -188,29 +151,41 @@ static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent, | |||
188 | static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn) | 151 | static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn) |
189 | { | 152 | { |
190 | struct pci_dn *pdn = dn->data; | 153 | struct pci_dn *pdn = dn->data; |
191 | struct pci_controller *hose = pdn->phb; | 154 | struct pci_controller *phb = pdn->phb; |
192 | struct pci_dev *dev = NULL; | 155 | struct pci_dev *dev = NULL; |
193 | 156 | ||
194 | /* Scan phb bus for EADS device, adding new one to bus->devices */ | 157 | rpaphp_eeh_init_nodes(dn); |
195 | if (!pci_scan_single_device(hose->bus, pdn->devfn)) { | 158 | /* Add EADS device to PHB bus, adding new entry to bus->devices */ |
196 | printk(KERN_ERR "%s: found no device on bus\n", __FUNCTION__); | 159 | dev = of_create_pci_dev(dn, phb->bus, pdn->devfn); |
160 | if (!dev) { | ||
161 | printk(KERN_ERR "%s: failed to create pci dev for %s\n", | ||
162 | __FUNCTION__, dn->full_name); | ||
197 | return NULL; | 163 | return NULL; |
198 | } | 164 | } |
199 | 165 | ||
166 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | ||
167 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) | ||
168 | of_scan_pci_bridge(dn, dev); | ||
169 | |||
170 | rpaphp_init_new_devs(dev->subordinate); | ||
171 | |||
172 | /* Claim new bus resources */ | ||
173 | rpadlpar_claim_one_bus(dev->bus); | ||
174 | |||
175 | /* ioremap() for child bus, which may or may not succeed */ | ||
176 | (void) remap_bus_range(dev->bus); | ||
177 | |||
200 | /* Add new devices to global lists. Register in proc, sysfs. */ | 178 | /* Add new devices to global lists. Register in proc, sysfs. */ |
201 | pci_bus_add_devices(hose->bus); | 179 | pci_bus_add_devices(phb->bus); |
202 | 180 | ||
203 | /* Confirm new bridge dev was created */ | 181 | /* Confirm new bridge dev was created */ |
204 | dev = dlpar_find_new_dev(hose->bus, dn); | 182 | dev = dlpar_find_new_dev(phb->bus, dn); |
205 | if (dev) { | 183 | if (dev) { |
206 | if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { | 184 | if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { |
207 | printk(KERN_ERR "%s: unexpected header type %d\n", | 185 | printk(KERN_ERR "%s: unexpected header type %d\n", |
208 | __FUNCTION__, dev->hdr_type); | 186 | __FUNCTION__, dev->hdr_type); |
209 | return NULL; | 187 | return NULL; |
210 | } | 188 | } |
211 | |||
212 | if (pci_add_secondary_bus(dn, dev)) | ||
213 | return NULL; | ||
214 | } | 189 | } |
215 | 190 | ||
216 | return dev; | 191 | return dev; |
@@ -219,7 +194,6 @@ static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn) | |||
219 | static int dlpar_add_pci_slot(char *drc_name, struct device_node *dn) | 194 | static int dlpar_add_pci_slot(char *drc_name, struct device_node *dn) |
220 | { | 195 | { |
221 | struct pci_dev *dev; | 196 | struct pci_dev *dev; |
222 | int rc; | ||
223 | 197 | ||
224 | if (rpaphp_find_pci_bus(dn)) | 198 | if (rpaphp_find_pci_bus(dn)) |
225 | return -EINVAL; | 199 | return -EINVAL; |
@@ -232,15 +206,6 @@ static int dlpar_add_pci_slot(char *drc_name, struct device_node *dn) | |||
232 | return -EIO; | 206 | return -EIO; |
233 | } | 207 | } |
234 | 208 | ||
235 | if (dn->child) { | ||
236 | rc = rpaphp_config_pci_adapter(dev->subordinate); | ||
237 | if (rc < 0) { | ||
238 | printk(KERN_ERR "%s: unable to enable slot %s\n", | ||
239 | __FUNCTION__, drc_name); | ||
240 | return -EIO; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | /* Add hotplug slot */ | 209 | /* Add hotplug slot */ |
245 | if (rpaphp_add_slot(dn)) { | 210 | if (rpaphp_add_slot(dn)) { |
246 | printk(KERN_ERR "%s: unable to add hotplug slot %s\n", | 211 | printk(KERN_ERR "%s: unable to add hotplug slot %s\n", |
@@ -306,7 +271,7 @@ static int dlpar_add_phb(char *drc_name, struct device_node *dn) | |||
306 | { | 271 | { |
307 | struct pci_controller *phb; | 272 | struct pci_controller *phb; |
308 | 273 | ||
309 | if (PCI_DN(dn)->phb) { | 274 | if (PCI_DN(dn) && PCI_DN(dn)->phb) { |
310 | /* PHB already exists */ | 275 | /* PHB already exists */ |
311 | return -EINVAL; | 276 | return -EINVAL; |
312 | } | 277 | } |
@@ -435,6 +400,8 @@ int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn) | |||
435 | __FUNCTION__, drc_name); | 400 | __FUNCTION__, drc_name); |
436 | return -EIO; | 401 | return -EIO; |
437 | } | 402 | } |
403 | } else { | ||
404 | rpaphp_unconfig_pci_adapter(bus); | ||
438 | } | 405 | } |
439 | 406 | ||
440 | if (unmap_bus_range(bus)) { | 407 | if (unmap_bus_range(bus)) { |
diff --git a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h index 71ea5f9bb284..57ea71a7bda5 100644 --- a/drivers/pci/hotplug/rpaphp.h +++ b/drivers/pci/hotplug/rpaphp.h | |||
@@ -93,6 +93,8 @@ extern int rpaphp_claim_resource(struct pci_dev *dev, int resource); | |||
93 | extern int rpaphp_enable_pci_slot(struct slot *slot); | 93 | extern int rpaphp_enable_pci_slot(struct slot *slot); |
94 | extern int register_pci_slot(struct slot *slot); | 94 | extern int register_pci_slot(struct slot *slot); |
95 | extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value); | 95 | extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value); |
96 | extern void rpaphp_init_new_devs(struct pci_bus *bus); | ||
97 | extern void rpaphp_eeh_init_nodes(struct device_node *dn); | ||
96 | 98 | ||
97 | extern int rpaphp_config_pci_adapter(struct pci_bus *bus); | 99 | extern int rpaphp_config_pci_adapter(struct pci_bus *bus); |
98 | extern int rpaphp_unconfig_pci_adapter(struct pci_bus *bus); | 100 | extern int rpaphp_unconfig_pci_adapter(struct pci_bus *bus); |
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c index f7c12d7dfcfc..a7859a84d1ae 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c | |||
@@ -154,8 +154,7 @@ exit: | |||
154 | } | 154 | } |
155 | 155 | ||
156 | /* Must be called before pci_bus_add_devices */ | 156 | /* Must be called before pci_bus_add_devices */ |
157 | static void | 157 | void rpaphp_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus) |
158 | rpaphp_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus) | ||
159 | { | 158 | { |
160 | struct pci_dev *dev; | 159 | struct pci_dev *dev; |
161 | 160 | ||
@@ -184,6 +183,20 @@ rpaphp_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus) | |||
184 | } | 183 | } |
185 | } | 184 | } |
186 | 185 | ||
186 | static void rpaphp_eeh_add_bus_device(struct pci_bus *bus) | ||
187 | { | ||
188 | struct pci_dev *dev; | ||
189 | |||
190 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
191 | eeh_add_device_late(dev); | ||
192 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | ||
193 | struct pci_bus *subbus = dev->subordinate; | ||
194 | if (subbus) | ||
195 | rpaphp_eeh_add_bus_device (subbus); | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | |||
187 | static int rpaphp_pci_config_bridge(struct pci_dev *dev) | 200 | static int rpaphp_pci_config_bridge(struct pci_dev *dev) |
188 | { | 201 | { |
189 | u8 sec_busno; | 202 | u8 sec_busno; |
@@ -217,6 +230,13 @@ static int rpaphp_pci_config_bridge(struct pci_dev *dev) | |||
217 | return 0; | 230 | return 0; |
218 | } | 231 | } |
219 | 232 | ||
233 | void rpaphp_init_new_devs(struct pci_bus *bus) | ||
234 | { | ||
235 | rpaphp_fixup_new_pci_devices(bus, 0); | ||
236 | rpaphp_eeh_add_bus_device(bus); | ||
237 | } | ||
238 | EXPORT_SYMBOL_GPL(rpaphp_init_new_devs); | ||
239 | |||
220 | /***************************************************************************** | 240 | /***************************************************************************** |
221 | rpaphp_pci_config_slot() will configure all devices under the | 241 | rpaphp_pci_config_slot() will configure all devices under the |
222 | given slot->dn and return the the first pci_dev. | 242 | given slot->dn and return the the first pci_dev. |
@@ -233,36 +253,51 @@ rpaphp_pci_config_slot(struct pci_bus *bus) | |||
233 | if (!dn || !dn->child) | 253 | if (!dn || !dn->child) |
234 | return NULL; | 254 | return NULL; |
235 | 255 | ||
236 | slotno = PCI_SLOT(PCI_DN(dn->child)->devfn); | 256 | if (systemcfg->platform == PLATFORM_PSERIES_LPAR) { |
257 | of_scan_bus(dn, bus); | ||
258 | if (list_empty(&bus->devices)) { | ||
259 | err("%s: No new device found\n", __FUNCTION__); | ||
260 | return NULL; | ||
261 | } | ||
237 | 262 | ||
238 | /* pci_scan_slot should find all children */ | 263 | rpaphp_init_new_devs(bus); |
239 | num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); | ||
240 | if (num) { | ||
241 | rpaphp_fixup_new_pci_devices(bus, 1); | ||
242 | pci_bus_add_devices(bus); | 264 | pci_bus_add_devices(bus); |
243 | } | 265 | dev = list_entry(&bus->devices, struct pci_dev, bus_list); |
244 | if (list_empty(&bus->devices)) { | 266 | } else { |
245 | err("%s: No new device found\n", __FUNCTION__); | 267 | slotno = PCI_SLOT(PCI_DN(dn->child)->devfn); |
246 | return NULL; | 268 | |
247 | } | 269 | /* pci_scan_slot should find all children */ |
248 | list_for_each_entry(dev, &bus->devices, bus_list) { | 270 | num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); |
249 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) | 271 | if (num) { |
250 | rpaphp_pci_config_bridge(dev); | 272 | rpaphp_fixup_new_pci_devices(bus, 1); |
273 | pci_bus_add_devices(bus); | ||
274 | } | ||
275 | if (list_empty(&bus->devices)) { | ||
276 | err("%s: No new device found\n", __FUNCTION__); | ||
277 | return NULL; | ||
278 | } | ||
279 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
280 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) | ||
281 | rpaphp_pci_config_bridge(dev); | ||
282 | |||
283 | rpaphp_eeh_add_bus_device(bus); | ||
284 | } | ||
251 | } | 285 | } |
252 | 286 | ||
253 | return dev; | 287 | return dev; |
254 | } | 288 | } |
255 | 289 | ||
256 | static void enable_eeh(struct device_node *dn) | 290 | void rpaphp_eeh_init_nodes(struct device_node *dn) |
257 | { | 291 | { |
258 | struct device_node *sib; | 292 | struct device_node *sib; |
259 | 293 | ||
260 | for (sib = dn->child; sib; sib = sib->sibling) | 294 | for (sib = dn->child; sib; sib = sib->sibling) |
261 | enable_eeh(sib); | 295 | rpaphp_eeh_init_nodes(sib); |
262 | eeh_add_device_early(dn); | 296 | eeh_add_device_early(dn); |
263 | return; | 297 | return; |
264 | 298 | ||
265 | } | 299 | } |
300 | EXPORT_SYMBOL_GPL(rpaphp_eeh_init_nodes); | ||
266 | 301 | ||
267 | static void print_slot_pci_funcs(struct pci_bus *bus) | 302 | static void print_slot_pci_funcs(struct pci_bus *bus) |
268 | { | 303 | { |
@@ -289,7 +324,7 @@ int rpaphp_config_pci_adapter(struct pci_bus *bus) | |||
289 | if (!dn) | 324 | if (!dn) |
290 | goto exit; | 325 | goto exit; |
291 | 326 | ||
292 | enable_eeh(dn); | 327 | rpaphp_eeh_init_nodes(dn); |
293 | dev = rpaphp_pci_config_slot(bus); | 328 | dev = rpaphp_pci_config_slot(bus); |
294 | if (!dev) { | 329 | if (!dev) { |
295 | err("%s: can't find any devices.\n", __FUNCTION__); | 330 | err("%s: can't find any devices.\n", __FUNCTION__); |
@@ -331,6 +366,7 @@ int rpaphp_unconfig_pci_adapter(struct pci_bus *bus) | |||
331 | } | 366 | } |
332 | return 0; | 367 | return 0; |
333 | } | 368 | } |
369 | EXPORT_SYMBOL_GPL(rpaphp_unconfig_pci_adapter); | ||
334 | 370 | ||
335 | static int setup_pci_hotplug_slot_info(struct slot *slot) | 371 | static int setup_pci_hotplug_slot_info(struct slot *slot) |
336 | { | 372 | { |
@@ -444,8 +480,8 @@ int rpaphp_enable_pci_slot(struct slot *slot) | |||
444 | retval = rpaphp_config_pci_adapter(slot->bus); | 480 | retval = rpaphp_config_pci_adapter(slot->bus); |
445 | if (!retval) { | 481 | if (!retval) { |
446 | slot->state = CONFIGURED; | 482 | slot->state = CONFIGURED; |
447 | dbg("%s: PCI devices in slot[%s] has been configured\n", | 483 | info("%s: devices in slot[%s] configured\n", |
448 | __FUNCTION__, slot->name); | 484 | __FUNCTION__, slot->name); |
449 | } else { | 485 | } else { |
450 | slot->state = NOT_CONFIGURED; | 486 | slot->state = NOT_CONFIGURED; |
451 | dbg("%s: no pci_dev struct for adapter in slot[%s]\n", | 487 | dbg("%s: no pci_dev struct for adapter in slot[%s]\n", |
diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c index b8e95acea3b6..38009bc0fd5d 100644 --- a/drivers/pci/hotplug/shpchp_pci.c +++ b/drivers/pci/hotplug/shpchp_pci.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include "../pci.h" | 34 | #include "../pci.h" |
35 | #include "shpchp.h" | 35 | #include "shpchp.h" |
36 | 36 | ||
37 | void program_fw_provided_values(struct pci_dev *dev) | 37 | static void program_fw_provided_values(struct pci_dev *dev) |
38 | { | 38 | { |
39 | u16 pci_cmd, pci_bctl; | 39 | u16 pci_cmd, pci_bctl; |
40 | struct pci_dev *cdev; | 40 | struct pci_dev *cdev; |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index a2033552423c..202b7507a357 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include "pci.h" | 23 | #include "pci.h" |
24 | #include "msi.h" | 24 | #include "msi.h" |
25 | 25 | ||
26 | #define MSI_TARGET_CPU first_cpu(cpu_online_map) | ||
27 | |||
26 | static DEFINE_SPINLOCK(msi_lock); | 28 | static DEFINE_SPINLOCK(msi_lock); |
27 | static struct msi_desc* msi_desc[NR_IRQS] = { [0 ... NR_IRQS-1] = NULL }; | 29 | static struct msi_desc* msi_desc[NR_IRQS] = { [0 ... NR_IRQS-1] = NULL }; |
28 | static kmem_cache_t* msi_cachep; | 30 | static kmem_cache_t* msi_cachep; |
@@ -92,6 +94,7 @@ static void set_msi_affinity(unsigned int vector, cpumask_t cpu_mask) | |||
92 | struct msi_desc *entry; | 94 | struct msi_desc *entry; |
93 | struct msg_address address; | 95 | struct msg_address address; |
94 | unsigned int irq = vector; | 96 | unsigned int irq = vector; |
97 | unsigned int dest_cpu = first_cpu(cpu_mask); | ||
95 | 98 | ||
96 | entry = (struct msi_desc *)msi_desc[vector]; | 99 | entry = (struct msi_desc *)msi_desc[vector]; |
97 | if (!entry || !entry->dev) | 100 | if (!entry || !entry->dev) |
@@ -108,9 +111,9 @@ static void set_msi_affinity(unsigned int vector, cpumask_t cpu_mask) | |||
108 | pci_read_config_dword(entry->dev, msi_lower_address_reg(pos), | 111 | pci_read_config_dword(entry->dev, msi_lower_address_reg(pos), |
109 | &address.lo_address.value); | 112 | &address.lo_address.value); |
110 | address.lo_address.value &= MSI_ADDRESS_DEST_ID_MASK; | 113 | address.lo_address.value &= MSI_ADDRESS_DEST_ID_MASK; |
111 | address.lo_address.value |= (cpu_mask_to_apicid(cpu_mask) << | 114 | address.lo_address.value |= (cpu_physical_id(dest_cpu) << |
112 | MSI_TARGET_CPU_SHIFT); | 115 | MSI_TARGET_CPU_SHIFT); |
113 | entry->msi_attrib.current_cpu = cpu_mask_to_apicid(cpu_mask); | 116 | entry->msi_attrib.current_cpu = cpu_physical_id(dest_cpu); |
114 | pci_write_config_dword(entry->dev, msi_lower_address_reg(pos), | 117 | pci_write_config_dword(entry->dev, msi_lower_address_reg(pos), |
115 | address.lo_address.value); | 118 | address.lo_address.value); |
116 | set_native_irq_info(irq, cpu_mask); | 119 | set_native_irq_info(irq, cpu_mask); |
@@ -123,9 +126,9 @@ static void set_msi_affinity(unsigned int vector, cpumask_t cpu_mask) | |||
123 | 126 | ||
124 | address.lo_address.value = readl(entry->mask_base + offset); | 127 | address.lo_address.value = readl(entry->mask_base + offset); |
125 | address.lo_address.value &= MSI_ADDRESS_DEST_ID_MASK; | 128 | address.lo_address.value &= MSI_ADDRESS_DEST_ID_MASK; |
126 | address.lo_address.value |= (cpu_mask_to_apicid(cpu_mask) << | 129 | address.lo_address.value |= (cpu_physical_id(dest_cpu) << |
127 | MSI_TARGET_CPU_SHIFT); | 130 | MSI_TARGET_CPU_SHIFT); |
128 | entry->msi_attrib.current_cpu = cpu_mask_to_apicid(cpu_mask); | 131 | entry->msi_attrib.current_cpu = cpu_physical_id(dest_cpu); |
129 | writel(address.lo_address.value, entry->mask_base + offset); | 132 | writel(address.lo_address.value, entry->mask_base + offset); |
130 | set_native_irq_info(irq, cpu_mask); | 133 | set_native_irq_info(irq, cpu_mask); |
131 | break; | 134 | break; |
@@ -259,14 +262,15 @@ static void msi_data_init(struct msg_data *msi_data, | |||
259 | static void msi_address_init(struct msg_address *msi_address) | 262 | static void msi_address_init(struct msg_address *msi_address) |
260 | { | 263 | { |
261 | unsigned int dest_id; | 264 | unsigned int dest_id; |
265 | unsigned long dest_phys_id = cpu_physical_id(MSI_TARGET_CPU); | ||
262 | 266 | ||
263 | memset(msi_address, 0, sizeof(struct msg_address)); | 267 | memset(msi_address, 0, sizeof(struct msg_address)); |
264 | msi_address->hi_address = (u32)0; | 268 | msi_address->hi_address = (u32)0; |
265 | dest_id = (MSI_ADDRESS_HEADER << MSI_ADDRESS_HEADER_SHIFT); | 269 | dest_id = (MSI_ADDRESS_HEADER << MSI_ADDRESS_HEADER_SHIFT); |
266 | msi_address->lo_address.u.dest_mode = MSI_DEST_MODE; | 270 | msi_address->lo_address.u.dest_mode = MSI_PHYSICAL_MODE; |
267 | msi_address->lo_address.u.redirection_hint = MSI_REDIRECTION_HINT_MODE; | 271 | msi_address->lo_address.u.redirection_hint = MSI_REDIRECTION_HINT_MODE; |
268 | msi_address->lo_address.u.dest_id = dest_id; | 272 | msi_address->lo_address.u.dest_id = dest_id; |
269 | msi_address->lo_address.value |= (MSI_TARGET_CPU << MSI_TARGET_CPU_SHIFT); | 273 | msi_address->lo_address.value |= (dest_phys_id << MSI_TARGET_CPU_SHIFT); |
270 | } | 274 | } |
271 | 275 | ||
272 | static int msi_free_vector(struct pci_dev* dev, int vector, int reassign); | 276 | static int msi_free_vector(struct pci_dev* dev, int vector, int reassign); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index e9e37abe1f76..a9b00cc2d885 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -91,9 +91,7 @@ acpi_query_osc ( | |||
91 | static acpi_status | 91 | static acpi_status |
92 | acpi_run_osc ( | 92 | acpi_run_osc ( |
93 | acpi_handle handle, | 93 | acpi_handle handle, |
94 | u32 level, | 94 | void *context) |
95 | void *context, | ||
96 | void **retval ) | ||
97 | { | 95 | { |
98 | acpi_status status; | 96 | acpi_status status; |
99 | struct acpi_object_list input; | 97 | struct acpi_object_list input; |
@@ -184,7 +182,7 @@ EXPORT_SYMBOL(pci_osc_support_set); | |||
184 | * | 182 | * |
185 | * Attempt to take control from Firmware on requested control bits. | 183 | * Attempt to take control from Firmware on requested control bits. |
186 | **/ | 184 | **/ |
187 | acpi_status pci_osc_control_set(u32 flags) | 185 | acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) |
188 | { | 186 | { |
189 | acpi_status status; | 187 | acpi_status status; |
190 | u32 ctrlset; | 188 | u32 ctrlset; |
@@ -198,10 +196,7 @@ acpi_status pci_osc_control_set(u32 flags) | |||
198 | return AE_SUPPORT; | 196 | return AE_SUPPORT; |
199 | } | 197 | } |
200 | ctrlset_buf[OSC_CONTROL_TYPE] |= ctrlset; | 198 | ctrlset_buf[OSC_CONTROL_TYPE] |= ctrlset; |
201 | status = acpi_get_devices ( PCI_ROOT_HID_STRING, | 199 | status = acpi_run_osc(handle, ctrlset_buf); |
202 | acpi_run_osc, | ||
203 | ctrlset_buf, | ||
204 | NULL ); | ||
205 | if (ACPI_FAILURE (status)) { | 200 | if (ACPI_FAILURE (status)) { |
206 | ctrlset_buf[OSC_CONTROL_TYPE] &= ~ctrlset; | 201 | ctrlset_buf[OSC_CONTROL_TYPE] &= ~ctrlset; |
207 | } | 202 | } |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 94e68c54d273..a9046d4b8af3 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -37,7 +37,7 @@ struct pci_dynid { | |||
37 | * Adds a new dynamic pci device ID to this driver, | 37 | * Adds a new dynamic pci device ID to this driver, |
38 | * and causes the driver to probe for all devices again. | 38 | * and causes the driver to probe for all devices again. |
39 | */ | 39 | */ |
40 | static inline ssize_t | 40 | static ssize_t |
41 | store_new_id(struct device_driver *driver, const char *buf, size_t count) | 41 | store_new_id(struct device_driver *driver, const char *buf, size_t count) |
42 | { | 42 | { |
43 | struct pci_dynid *dynid; | 43 | struct pci_dynid *dynid; |
@@ -364,15 +364,16 @@ static struct kobj_type pci_driver_kobj_type = { | |||
364 | }; | 364 | }; |
365 | 365 | ||
366 | /** | 366 | /** |
367 | * pci_register_driver - register a new pci driver | 367 | * __pci_register_driver - register a new pci driver |
368 | * @drv: the driver structure to register | 368 | * @drv: the driver structure to register |
369 | * @owner: owner module of drv | ||
369 | * | 370 | * |
370 | * Adds the driver structure to the list of registered drivers. | 371 | * Adds the driver structure to the list of registered drivers. |
371 | * Returns a negative value on error, otherwise 0. | 372 | * Returns a negative value on error, otherwise 0. |
372 | * If no error occurred, the driver remains registered even if | 373 | * If no error occurred, the driver remains registered even if |
373 | * no device was claimed during registration. | 374 | * no device was claimed during registration. |
374 | */ | 375 | */ |
375 | int pci_register_driver(struct pci_driver *drv) | 376 | int __pci_register_driver(struct pci_driver *drv, struct module *owner) |
376 | { | 377 | { |
377 | int error; | 378 | int error; |
378 | 379 | ||
@@ -389,7 +390,7 @@ int pci_register_driver(struct pci_driver *drv) | |||
389 | printk(KERN_WARNING "Warning: PCI driver %s has a struct " | 390 | printk(KERN_WARNING "Warning: PCI driver %s has a struct " |
390 | "device_driver shutdown method, please update!\n", | 391 | "device_driver shutdown method, please update!\n", |
391 | drv->name); | 392 | drv->name); |
392 | drv->driver.owner = drv->owner; | 393 | drv->driver.owner = owner; |
393 | drv->driver.kobj.ktype = &pci_driver_kobj_type; | 394 | drv->driver.kobj.ktype = &pci_driver_kobj_type; |
394 | 395 | ||
395 | spin_lock_init(&drv->dynids.lock); | 396 | spin_lock_init(&drv->dynids.lock); |
@@ -526,7 +527,7 @@ postcore_initcall(pci_driver_init); | |||
526 | 527 | ||
527 | EXPORT_SYMBOL(pci_match_id); | 528 | EXPORT_SYMBOL(pci_match_id); |
528 | EXPORT_SYMBOL(pci_match_device); | 529 | EXPORT_SYMBOL(pci_match_device); |
529 | EXPORT_SYMBOL(pci_register_driver); | 530 | EXPORT_SYMBOL(__pci_register_driver); |
530 | EXPORT_SYMBOL(pci_unregister_driver); | 531 | EXPORT_SYMBOL(pci_unregister_driver); |
531 | EXPORT_SYMBOL(pci_dev_driver); | 532 | EXPORT_SYMBOL(pci_dev_driver); |
532 | EXPORT_SYMBOL(pci_bus_type); | 533 | EXPORT_SYMBOL(pci_bus_type); |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e74d75843047..8e287a828d5d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -63,11 +63,38 @@ pci_max_busnr(void) | |||
63 | return max; | 63 | return max; |
64 | } | 64 | } |
65 | 65 | ||
66 | static int __pci_find_next_cap(struct pci_bus *bus, unsigned int devfn, u8 pos, int cap) | ||
67 | { | ||
68 | u8 id; | ||
69 | int ttl = 48; | ||
70 | |||
71 | while (ttl--) { | ||
72 | pci_bus_read_config_byte(bus, devfn, pos, &pos); | ||
73 | if (pos < 0x40) | ||
74 | break; | ||
75 | pos &= ~3; | ||
76 | pci_bus_read_config_byte(bus, devfn, pos + PCI_CAP_LIST_ID, | ||
77 | &id); | ||
78 | if (id == 0xff) | ||
79 | break; | ||
80 | if (id == cap) | ||
81 | return pos; | ||
82 | pos += PCI_CAP_LIST_NEXT; | ||
83 | } | ||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap) | ||
88 | { | ||
89 | return __pci_find_next_cap(dev->bus, dev->devfn, | ||
90 | pos + PCI_CAP_LIST_NEXT, cap); | ||
91 | } | ||
92 | EXPORT_SYMBOL_GPL(pci_find_next_capability); | ||
93 | |||
66 | static int __pci_bus_find_cap(struct pci_bus *bus, unsigned int devfn, u8 hdr_type, int cap) | 94 | static int __pci_bus_find_cap(struct pci_bus *bus, unsigned int devfn, u8 hdr_type, int cap) |
67 | { | 95 | { |
68 | u16 status; | 96 | u16 status; |
69 | u8 pos, id; | 97 | u8 pos; |
70 | int ttl = 48; | ||
71 | 98 | ||
72 | pci_bus_read_config_word(bus, devfn, PCI_STATUS, &status); | 99 | pci_bus_read_config_word(bus, devfn, PCI_STATUS, &status); |
73 | if (!(status & PCI_STATUS_CAP_LIST)) | 100 | if (!(status & PCI_STATUS_CAP_LIST)) |
@@ -76,24 +103,15 @@ static int __pci_bus_find_cap(struct pci_bus *bus, unsigned int devfn, u8 hdr_ty | |||
76 | switch (hdr_type) { | 103 | switch (hdr_type) { |
77 | case PCI_HEADER_TYPE_NORMAL: | 104 | case PCI_HEADER_TYPE_NORMAL: |
78 | case PCI_HEADER_TYPE_BRIDGE: | 105 | case PCI_HEADER_TYPE_BRIDGE: |
79 | pci_bus_read_config_byte(bus, devfn, PCI_CAPABILITY_LIST, &pos); | 106 | pos = PCI_CAPABILITY_LIST; |
80 | break; | 107 | break; |
81 | case PCI_HEADER_TYPE_CARDBUS: | 108 | case PCI_HEADER_TYPE_CARDBUS: |
82 | pci_bus_read_config_byte(bus, devfn, PCI_CB_CAPABILITY_LIST, &pos); | 109 | pos = PCI_CB_CAPABILITY_LIST; |
83 | break; | 110 | break; |
84 | default: | 111 | default: |
85 | return 0; | 112 | return 0; |
86 | } | 113 | } |
87 | while (ttl-- && pos >= 0x40) { | 114 | return __pci_find_next_cap(bus, devfn, pos, cap); |
88 | pos &= ~3; | ||
89 | pci_bus_read_config_byte(bus, devfn, pos + PCI_CAP_LIST_ID, &id); | ||
90 | if (id == 0xff) | ||
91 | break; | ||
92 | if (id == cap) | ||
93 | return pos; | ||
94 | pci_bus_read_config_byte(bus, devfn, pos + PCI_CAP_LIST_NEXT, &pos); | ||
95 | } | ||
96 | return 0; | ||
97 | } | 115 | } |
98 | 116 | ||
99 | /** | 117 | /** |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 5627ce1d2b32..3a4f49f4effb 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -462,11 +462,11 @@ static void __devinit quirk_vt82c686_acpi(struct pci_dev *dev) | |||
462 | 462 | ||
463 | pci_read_config_word(dev, 0x70, &hm); | 463 | pci_read_config_word(dev, 0x70, &hm); |
464 | hm &= PCI_BASE_ADDRESS_IO_MASK; | 464 | hm &= PCI_BASE_ADDRESS_IO_MASK; |
465 | quirk_io_region(dev, hm, 128, PCI_BRIDGE_RESOURCES + 1, "vt82c868 HW-mon"); | 465 | quirk_io_region(dev, hm, 128, PCI_BRIDGE_RESOURCES + 1, "vt82c686 HW-mon"); |
466 | 466 | ||
467 | pci_read_config_dword(dev, 0x90, &smb); | 467 | pci_read_config_dword(dev, 0x90, &smb); |
468 | smb &= PCI_BASE_ADDRESS_IO_MASK; | 468 | smb &= PCI_BASE_ADDRESS_IO_MASK; |
469 | quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 2, "vt82c868 SMB"); | 469 | quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 2, "vt82c686 SMB"); |
470 | } | 470 | } |
471 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi ); | 471 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi ); |
472 | 472 | ||
@@ -1243,6 +1243,21 @@ static void __devinit quirk_netmos(struct pci_dev *dev) | |||
1243 | } | 1243 | } |
1244 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, quirk_netmos); | 1244 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, quirk_netmos); |
1245 | 1245 | ||
1246 | |||
1247 | static void __devinit fixup_rev1_53c810(struct pci_dev* dev) | ||
1248 | { | ||
1249 | /* rev 1 ncr53c810 chips don't set the class at all which means | ||
1250 | * they don't get their resources remapped. Fix that here. | ||
1251 | */ | ||
1252 | |||
1253 | if (dev->class == PCI_CLASS_NOT_DEFINED) { | ||
1254 | printk(KERN_INFO "NCR 53c810 rev 1 detected, setting PCI class.\n"); | ||
1255 | dev->class = PCI_CLASS_STORAGE_SCSI; | ||
1256 | } | ||
1257 | } | ||
1258 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810); | ||
1259 | |||
1260 | |||
1246 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end) | 1261 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end) |
1247 | { | 1262 | { |
1248 | while (f < end) { | 1263 | while (f < end) { |
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index ccf20039e909..309eb557f9a3 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -156,7 +156,7 @@ config TCIC | |||
156 | 156 | ||
157 | config PCMCIA_M8XX | 157 | config PCMCIA_M8XX |
158 | tristate "MPC8xx PCMCIA support" | 158 | tristate "MPC8xx PCMCIA support" |
159 | depends on PCMCIA && PPC | 159 | depends on PCMCIA && PPC && 8xx |
160 | select PCCARD_NONSTATIC | 160 | select PCCARD_NONSTATIC |
161 | help | 161 | help |
162 | Say Y here to include support for PowerPC 8xx series PCMCIA | 162 | Say Y here to include support for PowerPC 8xx series PCMCIA |
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index fe37541abbfe..bcecf5133b7e 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -25,7 +25,7 @@ obj-$(CONFIG_PD6729) += pd6729.o | |||
25 | obj-$(CONFIG_I82365) += i82365.o | 25 | obj-$(CONFIG_I82365) += i82365.o |
26 | obj-$(CONFIG_I82092) += i82092.o | 26 | obj-$(CONFIG_I82092) += i82092.o |
27 | obj-$(CONFIG_TCIC) += tcic.o | 27 | obj-$(CONFIG_TCIC) += tcic.o |
28 | obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o | 28 | obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o |
29 | obj-$(CONFIG_HD64465_PCMCIA) += hd64465_ss.o | 29 | obj-$(CONFIG_HD64465_PCMCIA) += hd64465_ss.o |
30 | obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_core.o sa1100_cs.o | 30 | obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_core.o sa1100_cs.o |
31 | obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_core.o sa1111_cs.o | 31 | obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_core.o sa1111_cs.o |
@@ -47,10 +47,10 @@ au1x00_ss-$(CONFIG_MIPS_PB1200) += au1000_db1x00.o | |||
47 | au1x00_ss-$(CONFIG_MIPS_PB1500) += au1000_pb1x00.o | 47 | au1x00_ss-$(CONFIG_MIPS_PB1500) += au1000_pb1x00.o |
48 | au1x00_ss-$(CONFIG_MIPS_DB1000) += au1000_db1x00.o | 48 | au1x00_ss-$(CONFIG_MIPS_DB1000) += au1000_db1x00.o |
49 | au1x00_ss-$(CONFIG_MIPS_DB1100) += au1000_db1x00.o | 49 | au1x00_ss-$(CONFIG_MIPS_DB1100) += au1000_db1x00.o |
50 | au1x00_ss-$(CONFIG_MIPS_DB1200) += au1000_db1x00.o | 50 | au1x00_ss-$(CONFIG_MIPS_DB1200) += au1000_db1x00.o |
51 | au1x00_ss-$(CONFIG_MIPS_DB1500) += au1000_db1x00.o | 51 | au1x00_ss-$(CONFIG_MIPS_DB1500) += au1000_db1x00.o |
52 | au1x00_ss-$(CONFIG_MIPS_DB1550) += au1000_db1x00.o | 52 | au1x00_ss-$(CONFIG_MIPS_DB1550) += au1000_db1x00.o |
53 | au1x00_ss-$(CONFIG_MIPS_XXS1500) += au1000_xxs1500.o | 53 | au1x00_ss-$(CONFIG_MIPS_XXS1500) += au1000_xxs1500.o |
54 | 54 | ||
55 | sa1111_cs-y += sa1111_generic.o | 55 | sa1111_cs-y += sa1111_generic.o |
56 | sa1111_cs-$(CONFIG_ASSABET_NEPONSET) += sa1100_neponset.o | 56 | sa1111_cs-$(CONFIG_ASSABET_NEPONSET) += sa1100_neponset.o |
diff --git a/drivers/pcmcia/au1000_db1x00.c b/drivers/pcmcia/au1000_db1x00.c index 24cfee1a412c..abc13f28ba3f 100644 --- a/drivers/pcmcia/au1000_db1x00.c +++ b/drivers/pcmcia/au1000_db1x00.c | |||
@@ -30,6 +30,7 @@ | |||
30 | * | 30 | * |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/config.h> | ||
33 | #include <linux/module.h> | 34 | #include <linux/module.h> |
34 | #include <linux/kernel.h> | 35 | #include <linux/kernel.h> |
35 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
diff --git a/drivers/pcmcia/au1000_generic.h b/drivers/pcmcia/au1000_generic.h index b0e7908392a7..f2c970b5f4ff 100644 --- a/drivers/pcmcia/au1000_generic.h +++ b/drivers/pcmcia/au1000_generic.h | |||
@@ -22,6 +22,8 @@ | |||
22 | #define __ASM_AU1000_PCMCIA_H | 22 | #define __ASM_AU1000_PCMCIA_H |
23 | 23 | ||
24 | /* include the world */ | 24 | /* include the world */ |
25 | #include <linux/config.h> | ||
26 | |||
25 | #include <pcmcia/cs_types.h> | 27 | #include <pcmcia/cs_types.h> |
26 | #include <pcmcia/cs.h> | 28 | #include <pcmcia/cs.h> |
27 | #include <pcmcia/ss.h> | 29 | #include <pcmcia/ss.h> |
diff --git a/drivers/pcmcia/au1000_pb1x00.c b/drivers/pcmcia/au1000_pb1x00.c index 86c0808d6a05..fd5522ede867 100644 --- a/drivers/pcmcia/au1000_pb1x00.c +++ b/drivers/pcmcia/au1000_pb1x00.c | |||
@@ -21,6 +21,7 @@ | |||
21 | * with this program; if not, write to the Free Software Foundation, Inc., | 21 | * with this program; if not, write to the Free Software Foundation, Inc., |
22 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | 22 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. |
23 | */ | 23 | */ |
24 | #include <linux/config.h> | ||
24 | #include <linux/module.h> | 25 | #include <linux/module.h> |
25 | #include <linux/init.h> | 26 | #include <linux/init.h> |
26 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
diff --git a/drivers/pcmcia/au1000_xxs1500.c b/drivers/pcmcia/au1000_xxs1500.c index 01a895bc9a47..01874b0bb03b 100644 --- a/drivers/pcmcia/au1000_xxs1500.c +++ b/drivers/pcmcia/au1000_xxs1500.c | |||
@@ -27,7 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/config.h> | ||
31 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
32 | #include <linux/ioport.h> | 31 | #include <linux/ioport.h> |
33 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index 7ce455d01cc9..4ddd76239b34 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c | |||
@@ -1366,6 +1366,7 @@ static int __init init_i82365(void) | |||
1366 | if (sockets == 0) { | 1366 | if (sockets == 0) { |
1367 | printk("not found.\n"); | 1367 | printk("not found.\n"); |
1368 | platform_device_unregister(&i82365_device); | 1368 | platform_device_unregister(&i82365_device); |
1369 | release_region(i365_base, 2); | ||
1369 | driver_unregister(&i82365_driver); | 1370 | driver_unregister(&i82365_driver); |
1370 | return -ENODEV; | 1371 | return -ENODEV; |
1371 | } | 1372 | } |
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index f8bed87cf2f1..6d9f71cfcb34 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c | |||
@@ -39,7 +39,6 @@ | |||
39 | 39 | ||
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | #include <asm/bitops.h> | 41 | #include <asm/bitops.h> |
42 | #include <asm/segment.h> | ||
43 | #include <asm/system.h> | 42 | #include <asm/system.h> |
44 | 43 | ||
45 | #include <linux/kernel.h> | 44 | #include <linux/kernel.h> |
@@ -50,6 +49,7 @@ | |||
50 | #include <linux/ioport.h> | 49 | #include <linux/ioport.h> |
51 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
52 | #include <linux/interrupt.h> | 51 | #include <linux/interrupt.h> |
52 | #include <linux/platform_device.h> | ||
53 | 53 | ||
54 | #include <asm/mpc8xx.h> | 54 | #include <asm/mpc8xx.h> |
55 | #include <asm/8xx_immap.h> | 55 | #include <asm/8xx_immap.h> |
@@ -546,29 +546,11 @@ static void m8xx_shutdown(void) | |||
546 | free_irq(pcmcia_schlvl, NULL); | 546 | free_irq(pcmcia_schlvl, NULL); |
547 | } | 547 | } |
548 | 548 | ||
549 | /* copied from tcic.c */ | ||
550 | |||
551 | static int m8xx_drv_suspend(struct device *dev, pm_message_t state, u32 level) | ||
552 | { | ||
553 | int ret = 0; | ||
554 | if (level == SUSPEND_SAVE_STATE) | ||
555 | ret = pcmcia_socket_dev_suspend(dev, state); | ||
556 | return ret; | ||
557 | } | ||
558 | |||
559 | static int m8xx_drv_resume(struct device *dev, u32 level) | ||
560 | { | ||
561 | int ret = 0; | ||
562 | if (level == RESUME_RESTORE_STATE) | ||
563 | ret = pcmcia_socket_dev_resume(dev); | ||
564 | return ret; | ||
565 | } | ||
566 | |||
567 | static struct device_driver m8xx_driver = { | 549 | static struct device_driver m8xx_driver = { |
568 | .name = "m8xx-pcmcia", | 550 | .name = "m8xx-pcmcia", |
569 | .bus = &platform_bus_type, | 551 | .bus = &platform_bus_type, |
570 | .suspend = m8xx_drv_suspend, | 552 | .suspend = pcmcia_socket_dev_suspend, |
571 | .resume = m8xx_drv_resume, | 553 | .resume = pcmcia_socket_dev_resume, |
572 | }; | 554 | }; |
573 | 555 | ||
574 | static struct platform_device m8xx_device = { | 556 | static struct platform_device m8xx_device = { |
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 1c8ad2fcad8a..da8c515743e8 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * Author(s): Original Code written by | 8 | * Author(s): Original Code written by |
9 | * DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) | 9 | * DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) |
10 | * Rewritten by | 10 | * Rewritten by |
11 | * Frank Pavlic (pavlic@de.ibm.com) and | 11 | * Frank Pavlic (fpavlic@de.ibm.com) and |
12 | * Martin Schwidefsky <schwidefsky@de.ibm.com> | 12 | * Martin Schwidefsky <schwidefsky@de.ibm.com> |
13 | * | 13 | * |
14 | * $Revision: 1.99 $ $Date: 2005/05/11 08:10:17 $ | 14 | * $Revision: 1.99 $ $Date: 2005/05/11 08:10:17 $ |
@@ -2342,6 +2342,6 @@ __exit lcs_cleanup_module(void) | |||
2342 | module_init(lcs_init_module); | 2342 | module_init(lcs_init_module); |
2343 | module_exit(lcs_cleanup_module); | 2343 | module_exit(lcs_cleanup_module); |
2344 | 2344 | ||
2345 | MODULE_AUTHOR("Frank Pavlic <pavlic@de.ibm.com>"); | 2345 | MODULE_AUTHOR("Frank Pavlic <fpavlic@de.ibm.com>"); |
2346 | MODULE_LICENSE("GPL"); | 2346 | MODULE_LICENSE("GPL"); |
2347 | 2347 | ||
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h index 38a2441564d7..d238c7ed103b 100644 --- a/drivers/s390/net/qeth.h +++ b/drivers/s390/net/qeth.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/trdevice.h> | 8 | #include <linux/trdevice.h> |
9 | #include <linux/etherdevice.h> | 9 | #include <linux/etherdevice.h> |
10 | #include <linux/if_vlan.h> | 10 | #include <linux/if_vlan.h> |
11 | #include <linux/ctype.h> | ||
11 | 12 | ||
12 | #include <net/ipv6.h> | 13 | #include <net/ipv6.h> |
13 | #include <linux/in6.h> | 14 | #include <linux/in6.h> |
@@ -24,7 +25,7 @@ | |||
24 | 25 | ||
25 | #include "qeth_mpc.h" | 26 | #include "qeth_mpc.h" |
26 | 27 | ||
27 | #define VERSION_QETH_H "$Revision: 1.142 $" | 28 | #define VERSION_QETH_H "$Revision: 1.152 $" |
28 | 29 | ||
29 | #ifdef CONFIG_QETH_IPV6 | 30 | #ifdef CONFIG_QETH_IPV6 |
30 | #define QETH_VERSION_IPV6 ":IPv6" | 31 | #define QETH_VERSION_IPV6 ":IPv6" |
@@ -718,8 +719,6 @@ struct qeth_reply { | |||
718 | atomic_t refcnt; | 719 | atomic_t refcnt; |
719 | }; | 720 | }; |
720 | 721 | ||
721 | #define QETH_BROADCAST_WITH_ECHO 1 | ||
722 | #define QETH_BROADCAST_WITHOUT_ECHO 2 | ||
723 | 722 | ||
724 | struct qeth_card_blkt { | 723 | struct qeth_card_blkt { |
725 | int time_total; | 724 | int time_total; |
@@ -727,8 +726,10 @@ struct qeth_card_blkt { | |||
727 | int inter_packet_jumbo; | 726 | int inter_packet_jumbo; |
728 | }; | 727 | }; |
729 | 728 | ||
730 | 729 | #define QETH_BROADCAST_WITH_ECHO 0x01 | |
731 | 730 | #define QETH_BROADCAST_WITHOUT_ECHO 0x02 | |
731 | #define QETH_LAYER2_MAC_READ 0x01 | ||
732 | #define QETH_LAYER2_MAC_REGISTERED 0x02 | ||
732 | struct qeth_card_info { | 733 | struct qeth_card_info { |
733 | unsigned short unit_addr2; | 734 | unsigned short unit_addr2; |
734 | unsigned short cula; | 735 | unsigned short cula; |
@@ -736,7 +737,7 @@ struct qeth_card_info { | |||
736 | __u16 func_level; | 737 | __u16 func_level; |
737 | char mcl_level[QETH_MCL_LENGTH + 1]; | 738 | char mcl_level[QETH_MCL_LENGTH + 1]; |
738 | int guestlan; | 739 | int guestlan; |
739 | int layer2_mac_registered; | 740 | int mac_bits; |
740 | int portname_required; | 741 | int portname_required; |
741 | int portno; | 742 | int portno; |
742 | char portname[9]; | 743 | char portname[9]; |
@@ -749,6 +750,7 @@ struct qeth_card_info { | |||
749 | int unique_id; | 750 | int unique_id; |
750 | struct qeth_card_blkt blkt; | 751 | struct qeth_card_blkt blkt; |
751 | __u32 csum_mask; | 752 | __u32 csum_mask; |
753 | enum qeth_ipa_promisc_modes promisc_mode; | ||
752 | }; | 754 | }; |
753 | 755 | ||
754 | struct qeth_card_options { | 756 | struct qeth_card_options { |
@@ -775,6 +777,7 @@ struct qeth_card_options { | |||
775 | enum qeth_threads { | 777 | enum qeth_threads { |
776 | QETH_SET_IP_THREAD = 1, | 778 | QETH_SET_IP_THREAD = 1, |
777 | QETH_RECOVER_THREAD = 2, | 779 | QETH_RECOVER_THREAD = 2, |
780 | QETH_SET_PROMISC_MODE_THREAD = 4, | ||
778 | }; | 781 | }; |
779 | 782 | ||
780 | struct qeth_osn_info { | 783 | struct qeth_osn_info { |
@@ -1074,6 +1077,26 @@ qeth_get_qdio_q_format(struct qeth_card *card) | |||
1074 | } | 1077 | } |
1075 | } | 1078 | } |
1076 | 1079 | ||
1080 | static inline int | ||
1081 | qeth_isdigit(char * buf) | ||
1082 | { | ||
1083 | while (*buf) { | ||
1084 | if (!isdigit(*buf++)) | ||
1085 | return 0; | ||
1086 | } | ||
1087 | return 1; | ||
1088 | } | ||
1089 | |||
1090 | static inline int | ||
1091 | qeth_isxdigit(char * buf) | ||
1092 | { | ||
1093 | while (*buf) { | ||
1094 | if (!isxdigit(*buf++)) | ||
1095 | return 0; | ||
1096 | } | ||
1097 | return 1; | ||
1098 | } | ||
1099 | |||
1077 | static inline void | 1100 | static inline void |
1078 | qeth_ipaddr4_to_string(const __u8 *addr, char *buf) | 1101 | qeth_ipaddr4_to_string(const __u8 *addr, char *buf) |
1079 | { | 1102 | { |
@@ -1090,18 +1113,27 @@ qeth_string_to_ipaddr4(const char *buf, __u8 *addr) | |||
1090 | int i; | 1113 | int i; |
1091 | 1114 | ||
1092 | start = buf; | 1115 | start = buf; |
1093 | for (i = 0; i < 3; i++) { | 1116 | for (i = 0; i < 4; i++) { |
1094 | if (!(end = strchr(start, '.'))) | 1117 | if (i == 3) { |
1118 | end = strchr(start,0xa); | ||
1119 | if (end) | ||
1120 | len = end - start; | ||
1121 | else | ||
1122 | len = strlen(start); | ||
1123 | } | ||
1124 | else { | ||
1125 | end = strchr(start, '.'); | ||
1126 | len = end - start; | ||
1127 | } | ||
1128 | if ((len <= 0) || (len > 3)) | ||
1095 | return -EINVAL; | 1129 | return -EINVAL; |
1096 | len = end - start; | ||
1097 | memset(abuf, 0, 4); | 1130 | memset(abuf, 0, 4); |
1098 | strncpy(abuf, start, len); | 1131 | strncpy(abuf, start, len); |
1132 | if (!qeth_isdigit(abuf)) | ||
1133 | return -EINVAL; | ||
1099 | addr[i] = simple_strtoul(abuf, &tmp, 10); | 1134 | addr[i] = simple_strtoul(abuf, &tmp, 10); |
1100 | start = end + 1; | 1135 | start = end + 1; |
1101 | } | 1136 | } |
1102 | memset(abuf, 0, 4); | ||
1103 | strcpy(abuf, start); | ||
1104 | addr[3] = simple_strtoul(abuf, &tmp, 10); | ||
1105 | return 0; | 1137 | return 0; |
1106 | } | 1138 | } |
1107 | 1139 | ||
@@ -1128,18 +1160,27 @@ qeth_string_to_ipaddr6(const char *buf, __u8 *addr) | |||
1128 | 1160 | ||
1129 | tmp_addr = (u16 *)addr; | 1161 | tmp_addr = (u16 *)addr; |
1130 | start = buf; | 1162 | start = buf; |
1131 | for (i = 0; i < 7; i++) { | 1163 | for (i = 0; i < 8; i++) { |
1132 | if (!(end = strchr(start, ':'))) | 1164 | if (i == 7) { |
1165 | end = strchr(start,0xa); | ||
1166 | if (end) | ||
1167 | len = end - start; | ||
1168 | else | ||
1169 | len = strlen(start); | ||
1170 | } | ||
1171 | else { | ||
1172 | end = strchr(start, ':'); | ||
1173 | len = end - start; | ||
1174 | } | ||
1175 | if ((len <= 0) || (len > 4)) | ||
1133 | return -EINVAL; | 1176 | return -EINVAL; |
1134 | len = end - start; | ||
1135 | memset(abuf, 0, 5); | 1177 | memset(abuf, 0, 5); |
1136 | strncpy(abuf, start, len); | 1178 | strncpy(abuf, start, len); |
1179 | if (!qeth_isxdigit(abuf)) | ||
1180 | return -EINVAL; | ||
1137 | tmp_addr[i] = simple_strtoul(abuf, &tmp, 16); | 1181 | tmp_addr[i] = simple_strtoul(abuf, &tmp, 16); |
1138 | start = end + 1; | 1182 | start = end + 1; |
1139 | } | 1183 | } |
1140 | memset(abuf, 0, 5); | ||
1141 | strcpy(abuf, start); | ||
1142 | tmp_addr[7] = simple_strtoul(abuf, &tmp, 16); | ||
1143 | return 0; | 1184 | return 0; |
1144 | } | 1185 | } |
1145 | 1186 | ||
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 692003c9f896..99cceb242ec4 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * linux/drivers/s390/net/qeth_main.c ($Revision: 1.224 $) | 3 | * linux/drivers/s390/net/qeth_main.c ($Revision: 1.242 $) |
4 | * | 4 | * |
5 | * Linux on zSeries OSA Express and HiperSockets support | 5 | * Linux on zSeries OSA Express and HiperSockets support |
6 | * | 6 | * |
@@ -9,10 +9,10 @@ | |||
9 | * Author(s): Original Code written by | 9 | * Author(s): Original Code written by |
10 | * Utz Bacher (utz.bacher@de.ibm.com) | 10 | * Utz Bacher (utz.bacher@de.ibm.com) |
11 | * Rewritten by | 11 | * Rewritten by |
12 | * Frank Pavlic (pavlic@de.ibm.com) and | 12 | * Frank Pavlic (fpavlic@de.ibm.com) and |
13 | * Thomas Spatzier <tspat@de.ibm.com> | 13 | * Thomas Spatzier <tspat@de.ibm.com> |
14 | * | 14 | * |
15 | * $Revision: 1.224 $ $Date: 2005/05/04 20:19:18 $ | 15 | * $Revision: 1.242 $ $Date: 2005/05/04 20:19:18 $ |
16 | * | 16 | * |
17 | * This program is free software; you can redistribute it and/or modify | 17 | * This program is free software; you can redistribute it and/or modify |
18 | * it under the terms of the GNU General Public License as published by | 18 | * it under the terms of the GNU General Public License as published by |
@@ -72,7 +72,7 @@ | |||
72 | #include "qeth_eddp.h" | 72 | #include "qeth_eddp.h" |
73 | #include "qeth_tso.h" | 73 | #include "qeth_tso.h" |
74 | 74 | ||
75 | #define VERSION_QETH_C "$Revision: 1.224 $" | 75 | #define VERSION_QETH_C "$Revision: 1.242 $" |
76 | static const char *version = "qeth S/390 OSA-Express driver"; | 76 | static const char *version = "qeth S/390 OSA-Express driver"; |
77 | 77 | ||
78 | /** | 78 | /** |
@@ -160,6 +160,9 @@ static void | |||
160 | qeth_set_multicast_list(struct net_device *); | 160 | qeth_set_multicast_list(struct net_device *); |
161 | 161 | ||
162 | static void | 162 | static void |
163 | qeth_setadp_promisc_mode(struct qeth_card *); | ||
164 | |||
165 | static void | ||
163 | qeth_notify_processes(void) | 166 | qeth_notify_processes(void) |
164 | { | 167 | { |
165 | /*notify all registered processes */ | 168 | /*notify all registered processes */ |
@@ -602,11 +605,20 @@ __qeth_ref_ip_on_card(struct qeth_card *card, struct qeth_ipaddr *todo, | |||
602 | int found = 0; | 605 | int found = 0; |
603 | 606 | ||
604 | list_for_each_entry(addr, &card->ip_list, entry) { | 607 | list_for_each_entry(addr, &card->ip_list, entry) { |
608 | if (card->options.layer2) { | ||
609 | if ((addr->type == todo->type) && | ||
610 | (memcmp(&addr->mac, &todo->mac, | ||
611 | OSA_ADDR_LEN) == 0)) { | ||
612 | found = 1; | ||
613 | break; | ||
614 | } | ||
615 | continue; | ||
616 | } | ||
605 | if ((addr->proto == QETH_PROT_IPV4) && | 617 | if ((addr->proto == QETH_PROT_IPV4) && |
606 | (todo->proto == QETH_PROT_IPV4) && | 618 | (todo->proto == QETH_PROT_IPV4) && |
607 | (addr->type == todo->type) && | 619 | (addr->type == todo->type) && |
608 | (addr->u.a4.addr == todo->u.a4.addr) && | 620 | (addr->u.a4.addr == todo->u.a4.addr) && |
609 | (addr->u.a4.mask == todo->u.a4.mask) ){ | 621 | (addr->u.a4.mask == todo->u.a4.mask)) { |
610 | found = 1; | 622 | found = 1; |
611 | break; | 623 | break; |
612 | } | 624 | } |
@@ -615,12 +627,12 @@ __qeth_ref_ip_on_card(struct qeth_card *card, struct qeth_ipaddr *todo, | |||
615 | (addr->type == todo->type) && | 627 | (addr->type == todo->type) && |
616 | (addr->u.a6.pfxlen == todo->u.a6.pfxlen) && | 628 | (addr->u.a6.pfxlen == todo->u.a6.pfxlen) && |
617 | (memcmp(&addr->u.a6.addr, &todo->u.a6.addr, | 629 | (memcmp(&addr->u.a6.addr, &todo->u.a6.addr, |
618 | sizeof(struct in6_addr)) == 0)) { | 630 | sizeof(struct in6_addr)) == 0)) { |
619 | found = 1; | 631 | found = 1; |
620 | break; | 632 | break; |
621 | } | 633 | } |
622 | } | 634 | } |
623 | if (found){ | 635 | if (found) { |
624 | addr->users += todo->users; | 636 | addr->users += todo->users; |
625 | if (addr->users <= 0){ | 637 | if (addr->users <= 0){ |
626 | *__addr = addr; | 638 | *__addr = addr; |
@@ -632,7 +644,7 @@ __qeth_ref_ip_on_card(struct qeth_card *card, struct qeth_ipaddr *todo, | |||
632 | return 0; | 644 | return 0; |
633 | } | 645 | } |
634 | } | 646 | } |
635 | if (todo->users > 0){ | 647 | if (todo->users > 0) { |
636 | /* for VIPA and RXIP limit refcount to 1 */ | 648 | /* for VIPA and RXIP limit refcount to 1 */ |
637 | if (todo->type != QETH_IP_TYPE_NORMAL) | 649 | if (todo->type != QETH_IP_TYPE_NORMAL) |
638 | todo->users = 1; | 650 | todo->users = 1; |
@@ -682,12 +694,22 @@ __qeth_insert_ip_todo(struct qeth_card *card, struct qeth_ipaddr *addr, int add) | |||
682 | if ((addr->type == QETH_IP_TYPE_DEL_ALL_MC) && | 694 | if ((addr->type == QETH_IP_TYPE_DEL_ALL_MC) && |
683 | (tmp->type == QETH_IP_TYPE_DEL_ALL_MC)) | 695 | (tmp->type == QETH_IP_TYPE_DEL_ALL_MC)) |
684 | return 0; | 696 | return 0; |
697 | if (card->options.layer2) { | ||
698 | if ((tmp->type == addr->type) && | ||
699 | (tmp->is_multicast == addr->is_multicast) && | ||
700 | (memcmp(&tmp->mac, &addr->mac, | ||
701 | OSA_ADDR_LEN) == 0)) { | ||
702 | found = 1; | ||
703 | break; | ||
704 | } | ||
705 | continue; | ||
706 | } | ||
685 | if ((tmp->proto == QETH_PROT_IPV4) && | 707 | if ((tmp->proto == QETH_PROT_IPV4) && |
686 | (addr->proto == QETH_PROT_IPV4) && | 708 | (addr->proto == QETH_PROT_IPV4) && |
687 | (tmp->type == addr->type) && | 709 | (tmp->type == addr->type) && |
688 | (tmp->is_multicast == addr->is_multicast) && | 710 | (tmp->is_multicast == addr->is_multicast) && |
689 | (tmp->u.a4.addr == addr->u.a4.addr) && | 711 | (tmp->u.a4.addr == addr->u.a4.addr) && |
690 | (tmp->u.a4.mask == addr->u.a4.mask) ){ | 712 | (tmp->u.a4.mask == addr->u.a4.mask)) { |
691 | found = 1; | 713 | found = 1; |
692 | break; | 714 | break; |
693 | } | 715 | } |
@@ -697,7 +719,7 @@ __qeth_insert_ip_todo(struct qeth_card *card, struct qeth_ipaddr *addr, int add) | |||
697 | (tmp->is_multicast == addr->is_multicast) && | 719 | (tmp->is_multicast == addr->is_multicast) && |
698 | (tmp->u.a6.pfxlen == addr->u.a6.pfxlen) && | 720 | (tmp->u.a6.pfxlen == addr->u.a6.pfxlen) && |
699 | (memcmp(&tmp->u.a6.addr, &addr->u.a6.addr, | 721 | (memcmp(&tmp->u.a6.addr, &addr->u.a6.addr, |
700 | sizeof(struct in6_addr)) == 0) ){ | 722 | sizeof(struct in6_addr)) == 0)) { |
701 | found = 1; | 723 | found = 1; |
702 | break; | 724 | break; |
703 | } | 725 | } |
@@ -707,7 +729,7 @@ __qeth_insert_ip_todo(struct qeth_card *card, struct qeth_ipaddr *addr, int add) | |||
707 | tmp->users += addr->users; | 729 | tmp->users += addr->users; |
708 | else | 730 | else |
709 | tmp->users += add? 1:-1; | 731 | tmp->users += add? 1:-1; |
710 | if (tmp->users == 0){ | 732 | if (tmp->users == 0) { |
711 | list_del(&tmp->entry); | 733 | list_del(&tmp->entry); |
712 | kfree(tmp); | 734 | kfree(tmp); |
713 | } | 735 | } |
@@ -738,12 +760,15 @@ qeth_delete_ip(struct qeth_card *card, struct qeth_ipaddr *addr) | |||
738 | unsigned long flags; | 760 | unsigned long flags; |
739 | int rc = 0; | 761 | int rc = 0; |
740 | 762 | ||
741 | QETH_DBF_TEXT(trace,4,"delip"); | 763 | QETH_DBF_TEXT(trace, 4, "delip"); |
742 | if (addr->proto == QETH_PROT_IPV4) | 764 | |
743 | QETH_DBF_HEX(trace,4,&addr->u.a4.addr,4); | 765 | if (card->options.layer2) |
766 | QETH_DBF_HEX(trace, 4, &addr->mac, 6); | ||
767 | else if (addr->proto == QETH_PROT_IPV4) | ||
768 | QETH_DBF_HEX(trace, 4, &addr->u.a4.addr, 4); | ||
744 | else { | 769 | else { |
745 | QETH_DBF_HEX(trace,4,&addr->u.a6.addr,8); | 770 | QETH_DBF_HEX(trace, 4, &addr->u.a6.addr, 8); |
746 | QETH_DBF_HEX(trace,4,((char *)&addr->u.a6.addr)+8,8); | 771 | QETH_DBF_HEX(trace, 4, ((char *)&addr->u.a6.addr) + 8, 8); |
747 | } | 772 | } |
748 | spin_lock_irqsave(&card->ip_lock, flags); | 773 | spin_lock_irqsave(&card->ip_lock, flags); |
749 | rc = __qeth_insert_ip_todo(card, addr, 0); | 774 | rc = __qeth_insert_ip_todo(card, addr, 0); |
@@ -757,12 +782,14 @@ qeth_add_ip(struct qeth_card *card, struct qeth_ipaddr *addr) | |||
757 | unsigned long flags; | 782 | unsigned long flags; |
758 | int rc = 0; | 783 | int rc = 0; |
759 | 784 | ||
760 | QETH_DBF_TEXT(trace,4,"addip"); | 785 | QETH_DBF_TEXT(trace, 4, "addip"); |
761 | if (addr->proto == QETH_PROT_IPV4) | 786 | if (card->options.layer2) |
762 | QETH_DBF_HEX(trace,4,&addr->u.a4.addr,4); | 787 | QETH_DBF_HEX(trace, 4, &addr->mac, 6); |
788 | else if (addr->proto == QETH_PROT_IPV4) | ||
789 | QETH_DBF_HEX(trace, 4, &addr->u.a4.addr, 4); | ||
763 | else { | 790 | else { |
764 | QETH_DBF_HEX(trace,4,&addr->u.a6.addr,8); | 791 | QETH_DBF_HEX(trace, 4, &addr->u.a6.addr, 8); |
765 | QETH_DBF_HEX(trace,4,((char *)&addr->u.a6.addr)+8,8); | 792 | QETH_DBF_HEX(trace, 4, ((char *)&addr->u.a6.addr) + 8, 8); |
766 | } | 793 | } |
767 | spin_lock_irqsave(&card->ip_lock, flags); | 794 | spin_lock_irqsave(&card->ip_lock, flags); |
768 | rc = __qeth_insert_ip_todo(card, addr, 1); | 795 | rc = __qeth_insert_ip_todo(card, addr, 1); |
@@ -775,7 +802,7 @@ __qeth_delete_all_mc(struct qeth_card *card, unsigned long *flags) | |||
775 | { | 802 | { |
776 | struct qeth_ipaddr *addr, *tmp; | 803 | struct qeth_ipaddr *addr, *tmp; |
777 | int rc; | 804 | int rc; |
778 | 805 | again: | |
779 | list_for_each_entry_safe(addr, tmp, &card->ip_list, entry) { | 806 | list_for_each_entry_safe(addr, tmp, &card->ip_list, entry) { |
780 | if (addr->is_multicast) { | 807 | if (addr->is_multicast) { |
781 | spin_unlock_irqrestore(&card->ip_lock, *flags); | 808 | spin_unlock_irqrestore(&card->ip_lock, *flags); |
@@ -784,6 +811,7 @@ __qeth_delete_all_mc(struct qeth_card *card, unsigned long *flags) | |||
784 | if (!rc) { | 811 | if (!rc) { |
785 | list_del(&addr->entry); | 812 | list_del(&addr->entry); |
786 | kfree(addr); | 813 | kfree(addr); |
814 | goto again; | ||
787 | } | 815 | } |
788 | } | 816 | } |
789 | } | 817 | } |
@@ -851,6 +879,7 @@ qeth_set_ip_addr_list(struct qeth_card *card) | |||
851 | 879 | ||
852 | static void qeth_delete_mc_addresses(struct qeth_card *); | 880 | static void qeth_delete_mc_addresses(struct qeth_card *); |
853 | static void qeth_add_multicast_ipv4(struct qeth_card *); | 881 | static void qeth_add_multicast_ipv4(struct qeth_card *); |
882 | static void qeth_layer2_add_multicast(struct qeth_card *); | ||
854 | #ifdef CONFIG_QETH_IPV6 | 883 | #ifdef CONFIG_QETH_IPV6 |
855 | static void qeth_add_multicast_ipv6(struct qeth_card *); | 884 | static void qeth_add_multicast_ipv6(struct qeth_card *); |
856 | #endif | 885 | #endif |
@@ -939,6 +968,24 @@ qeth_register_ip_addresses(void *ptr) | |||
939 | return 0; | 968 | return 0; |
940 | } | 969 | } |
941 | 970 | ||
971 | /* | ||
972 | * Drive the SET_PROMISC_MODE thread | ||
973 | */ | ||
974 | static int | ||
975 | qeth_set_promisc_mode(void *ptr) | ||
976 | { | ||
977 | struct qeth_card *card = (struct qeth_card *) ptr; | ||
978 | |||
979 | daemonize("qeth_setprm"); | ||
980 | QETH_DBF_TEXT(trace,4,"setprm1"); | ||
981 | if (!qeth_do_run_thread(card, QETH_SET_PROMISC_MODE_THREAD)) | ||
982 | return 0; | ||
983 | QETH_DBF_TEXT(trace,4,"setprm2"); | ||
984 | qeth_setadp_promisc_mode(card); | ||
985 | qeth_clear_thread_running_bit(card, QETH_SET_PROMISC_MODE_THREAD); | ||
986 | return 0; | ||
987 | } | ||
988 | |||
942 | static int | 989 | static int |
943 | qeth_recover(void *ptr) | 990 | qeth_recover(void *ptr) |
944 | { | 991 | { |
@@ -1005,6 +1052,8 @@ qeth_start_kernel_thread(struct qeth_card *card) | |||
1005 | 1052 | ||
1006 | if (qeth_do_start_thread(card, QETH_SET_IP_THREAD)) | 1053 | if (qeth_do_start_thread(card, QETH_SET_IP_THREAD)) |
1007 | kernel_thread(qeth_register_ip_addresses, (void *)card,SIGCHLD); | 1054 | kernel_thread(qeth_register_ip_addresses, (void *)card,SIGCHLD); |
1055 | if (qeth_do_start_thread(card, QETH_SET_PROMISC_MODE_THREAD)) | ||
1056 | kernel_thread(qeth_set_promisc_mode, (void *)card, SIGCHLD); | ||
1008 | if (qeth_do_start_thread(card, QETH_RECOVER_THREAD)) | 1057 | if (qeth_do_start_thread(card, QETH_RECOVER_THREAD)) |
1009 | kernel_thread(qeth_recover, (void *) card, SIGCHLD); | 1058 | kernel_thread(qeth_recover, (void *) card, SIGCHLD); |
1010 | } | 1059 | } |
@@ -3749,7 +3798,7 @@ qeth_open(struct net_device *dev) | |||
3749 | 3798 | ||
3750 | if ( (card->info.type != QETH_CARD_TYPE_OSN) && | 3799 | if ( (card->info.type != QETH_CARD_TYPE_OSN) && |
3751 | (card->options.layer2) && | 3800 | (card->options.layer2) && |
3752 | (!card->info.layer2_mac_registered)) { | 3801 | (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED))) { |
3753 | QETH_DBF_TEXT(trace,4,"nomacadr"); | 3802 | QETH_DBF_TEXT(trace,4,"nomacadr"); |
3754 | return -EPERM; | 3803 | return -EPERM; |
3755 | } | 3804 | } |
@@ -4311,6 +4360,8 @@ qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue, | |||
4311 | out: | 4360 | out: |
4312 | if (flush_count) | 4361 | if (flush_count) |
4313 | qeth_flush_buffers(queue, 0, start_index, flush_count); | 4362 | qeth_flush_buffers(queue, 0, start_index, flush_count); |
4363 | else if (!atomic_read(&queue->set_pci_flags_count)) | ||
4364 | atomic_swap(&queue->state, QETH_OUT_Q_LOCKED_FLUSH); | ||
4314 | /* | 4365 | /* |
4315 | * queue->state will go from LOCKED -> UNLOCKED or from | 4366 | * queue->state will go from LOCKED -> UNLOCKED or from |
4316 | * LOCKED_FLUSH -> LOCKED if output_handler wanted to 'notify' us | 4367 | * LOCKED_FLUSH -> LOCKED if output_handler wanted to 'notify' us |
@@ -4975,6 +5026,10 @@ qeth_default_setassparms_cb(struct qeth_card *, struct qeth_reply *, | |||
4975 | unsigned long); | 5026 | unsigned long); |
4976 | 5027 | ||
4977 | static int | 5028 | static int |
5029 | qeth_default_setadapterparms_cb(struct qeth_card *card, | ||
5030 | struct qeth_reply *reply, | ||
5031 | unsigned long data); | ||
5032 | static int | ||
4978 | qeth_send_setassparms(struct qeth_card *, struct qeth_cmd_buffer *, | 5033 | qeth_send_setassparms(struct qeth_card *, struct qeth_cmd_buffer *, |
4979 | __u16, long, | 5034 | __u16, long, |
4980 | int (*reply_cb) | 5035 | int (*reply_cb) |
@@ -5301,8 +5356,7 @@ qeth_free_vlan_addresses4(struct qeth_card *card, unsigned short vid) | |||
5301 | struct qeth_ipaddr *addr; | 5356 | struct qeth_ipaddr *addr; |
5302 | 5357 | ||
5303 | QETH_DBF_TEXT(trace, 4, "frvaddr4"); | 5358 | QETH_DBF_TEXT(trace, 4, "frvaddr4"); |
5304 | if (!card->vlangrp) | 5359 | |
5305 | return; | ||
5306 | rcu_read_lock(); | 5360 | rcu_read_lock(); |
5307 | in_dev = __in_dev_get_rcu(card->vlangrp->vlan_devices[vid]); | 5361 | in_dev = __in_dev_get_rcu(card->vlangrp->vlan_devices[vid]); |
5308 | if (!in_dev) | 5362 | if (!in_dev) |
@@ -5330,8 +5384,7 @@ qeth_free_vlan_addresses6(struct qeth_card *card, unsigned short vid) | |||
5330 | struct qeth_ipaddr *addr; | 5384 | struct qeth_ipaddr *addr; |
5331 | 5385 | ||
5332 | QETH_DBF_TEXT(trace, 4, "frvaddr6"); | 5386 | QETH_DBF_TEXT(trace, 4, "frvaddr6"); |
5333 | if (!card->vlangrp) | 5387 | |
5334 | return; | ||
5335 | in6_dev = in6_dev_get(card->vlangrp->vlan_devices[vid]); | 5388 | in6_dev = in6_dev_get(card->vlangrp->vlan_devices[vid]); |
5336 | if (!in6_dev) | 5389 | if (!in6_dev) |
5337 | return; | 5390 | return; |
@@ -5351,10 +5404,38 @@ qeth_free_vlan_addresses6(struct qeth_card *card, unsigned short vid) | |||
5351 | } | 5404 | } |
5352 | 5405 | ||
5353 | static void | 5406 | static void |
5407 | qeth_free_vlan_addresses(struct qeth_card *card, unsigned short vid) | ||
5408 | { | ||
5409 | if (card->options.layer2 || !card->vlangrp) | ||
5410 | return; | ||
5411 | qeth_free_vlan_addresses4(card, vid); | ||
5412 | qeth_free_vlan_addresses6(card, vid); | ||
5413 | } | ||
5414 | |||
5415 | static int | ||
5416 | qeth_layer2_send_setdelvlan_cb(struct qeth_card *card, | ||
5417 | struct qeth_reply *reply, | ||
5418 | unsigned long data) | ||
5419 | { | ||
5420 | struct qeth_ipa_cmd *cmd; | ||
5421 | |||
5422 | QETH_DBF_TEXT(trace, 2, "L2sdvcb"); | ||
5423 | cmd = (struct qeth_ipa_cmd *) data; | ||
5424 | if (cmd->hdr.return_code) { | ||
5425 | PRINT_ERR("Error in processing VLAN %i on %s: 0x%x. " | ||
5426 | "Continuing\n",cmd->data.setdelvlan.vlan_id, | ||
5427 | QETH_CARD_IFNAME(card), cmd->hdr.return_code); | ||
5428 | QETH_DBF_TEXT_(trace, 2, "L2VL%4x", cmd->hdr.command); | ||
5429 | QETH_DBF_TEXT_(trace, 2, "L2%s", CARD_BUS_ID(card)); | ||
5430 | QETH_DBF_TEXT_(trace, 2, "err%d", cmd->hdr.return_code); | ||
5431 | } | ||
5432 | return 0; | ||
5433 | } | ||
5434 | |||
5435 | static int | ||
5354 | qeth_layer2_send_setdelvlan(struct qeth_card *card, __u16 i, | 5436 | qeth_layer2_send_setdelvlan(struct qeth_card *card, __u16 i, |
5355 | enum qeth_ipa_cmds ipacmd) | 5437 | enum qeth_ipa_cmds ipacmd) |
5356 | { | 5438 | { |
5357 | int rc; | ||
5358 | struct qeth_ipa_cmd *cmd; | 5439 | struct qeth_ipa_cmd *cmd; |
5359 | struct qeth_cmd_buffer *iob; | 5440 | struct qeth_cmd_buffer *iob; |
5360 | 5441 | ||
@@ -5362,15 +5443,8 @@ qeth_layer2_send_setdelvlan(struct qeth_card *card, __u16 i, | |||
5362 | iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); | 5443 | iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); |
5363 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 5444 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
5364 | cmd->data.setdelvlan.vlan_id = i; | 5445 | cmd->data.setdelvlan.vlan_id = i; |
5365 | 5446 | return qeth_send_ipa_cmd(card, iob, | |
5366 | rc = qeth_send_ipa_cmd(card, iob, NULL, NULL); | 5447 | qeth_layer2_send_setdelvlan_cb, NULL); |
5367 | if (rc) { | ||
5368 | PRINT_ERR("Error in processing VLAN %i on %s: 0x%x. " | ||
5369 | "Continuing\n",i, QETH_CARD_IFNAME(card), rc); | ||
5370 | QETH_DBF_TEXT_(trace, 2, "L2VL%4x", ipacmd); | ||
5371 | QETH_DBF_TEXT_(trace, 2, "L2%s", CARD_BUS_ID(card)); | ||
5372 | QETH_DBF_TEXT_(trace, 2, "err%d", rc); | ||
5373 | } | ||
5374 | } | 5448 | } |
5375 | 5449 | ||
5376 | static void | 5450 | static void |
@@ -5420,8 +5494,7 @@ qeth_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
5420 | qeth_free_vlan_skbs(card, vid); | 5494 | qeth_free_vlan_skbs(card, vid); |
5421 | spin_lock_irqsave(&card->vlanlock, flags); | 5495 | spin_lock_irqsave(&card->vlanlock, flags); |
5422 | /* unregister IP addresses of vlan device */ | 5496 | /* unregister IP addresses of vlan device */ |
5423 | qeth_free_vlan_addresses4(card, vid); | 5497 | qeth_free_vlan_addresses(card, vid); |
5424 | qeth_free_vlan_addresses6(card, vid); | ||
5425 | if (card->vlangrp) | 5498 | if (card->vlangrp) |
5426 | card->vlangrp->vlan_devices[vid] = NULL; | 5499 | card->vlangrp->vlan_devices[vid] = NULL; |
5427 | spin_unlock_irqrestore(&card->vlanlock, flags); | 5500 | spin_unlock_irqrestore(&card->vlanlock, flags); |
@@ -5430,6 +5503,59 @@ qeth_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
5430 | qeth_set_multicast_list(card->dev); | 5503 | qeth_set_multicast_list(card->dev); |
5431 | } | 5504 | } |
5432 | #endif | 5505 | #endif |
5506 | /** | ||
5507 | * Examine hardware response to SET_PROMISC_MODE | ||
5508 | */ | ||
5509 | static int | ||
5510 | qeth_setadp_promisc_mode_cb(struct qeth_card *card, | ||
5511 | struct qeth_reply *reply, | ||
5512 | unsigned long data) | ||
5513 | { | ||
5514 | struct qeth_ipa_cmd *cmd; | ||
5515 | struct qeth_ipacmd_setadpparms *setparms; | ||
5516 | |||
5517 | QETH_DBF_TEXT(trace,4,"prmadpcb"); | ||
5518 | |||
5519 | cmd = (struct qeth_ipa_cmd *) data; | ||
5520 | setparms = &(cmd->data.setadapterparms); | ||
5521 | |||
5522 | qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd); | ||
5523 | if (cmd->hdr.return_code) { | ||
5524 | QETH_DBF_TEXT_(trace,4,"prmrc%2.2x",cmd->hdr.return_code); | ||
5525 | setparms->data.mode = SET_PROMISC_MODE_OFF; | ||
5526 | } | ||
5527 | card->info.promisc_mode = setparms->data.mode; | ||
5528 | return 0; | ||
5529 | } | ||
5530 | /* | ||
5531 | * Set promiscuous mode (on or off) (SET_PROMISC_MODE command) | ||
5532 | */ | ||
5533 | static void | ||
5534 | qeth_setadp_promisc_mode(struct qeth_card *card) | ||
5535 | { | ||
5536 | enum qeth_ipa_promisc_modes mode; | ||
5537 | struct net_device *dev = card->dev; | ||
5538 | struct qeth_cmd_buffer *iob; | ||
5539 | struct qeth_ipa_cmd *cmd; | ||
5540 | |||
5541 | QETH_DBF_TEXT(trace, 4, "setprom"); | ||
5542 | |||
5543 | if (((dev->flags & IFF_PROMISC) && | ||
5544 | (card->info.promisc_mode == SET_PROMISC_MODE_ON)) || | ||
5545 | (!(dev->flags & IFF_PROMISC) && | ||
5546 | (card->info.promisc_mode == SET_PROMISC_MODE_OFF))) | ||
5547 | return; | ||
5548 | mode = SET_PROMISC_MODE_OFF; | ||
5549 | if (dev->flags & IFF_PROMISC) | ||
5550 | mode = SET_PROMISC_MODE_ON; | ||
5551 | QETH_DBF_TEXT_(trace, 4, "mode:%x", mode); | ||
5552 | |||
5553 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_PROMISC_MODE, | ||
5554 | sizeof(struct qeth_ipacmd_setadpparms)); | ||
5555 | cmd = (struct qeth_ipa_cmd *)(iob->data + IPA_PDU_HEADER_SIZE); | ||
5556 | cmd->data.setadapterparms.data.mode = mode; | ||
5557 | qeth_send_ipa_cmd(card, iob, qeth_setadp_promisc_mode_cb, NULL); | ||
5558 | } | ||
5433 | 5559 | ||
5434 | /** | 5560 | /** |
5435 | * set multicast address on card | 5561 | * set multicast address on card |
@@ -5444,12 +5570,22 @@ qeth_set_multicast_list(struct net_device *dev) | |||
5444 | 5570 | ||
5445 | QETH_DBF_TEXT(trace,3,"setmulti"); | 5571 | QETH_DBF_TEXT(trace,3,"setmulti"); |
5446 | qeth_delete_mc_addresses(card); | 5572 | qeth_delete_mc_addresses(card); |
5573 | if (card->options.layer2) { | ||
5574 | qeth_layer2_add_multicast(card); | ||
5575 | goto out; | ||
5576 | } | ||
5447 | qeth_add_multicast_ipv4(card); | 5577 | qeth_add_multicast_ipv4(card); |
5448 | #ifdef CONFIG_QETH_IPV6 | 5578 | #ifdef CONFIG_QETH_IPV6 |
5449 | qeth_add_multicast_ipv6(card); | 5579 | qeth_add_multicast_ipv6(card); |
5450 | #endif | 5580 | #endif |
5581 | out: | ||
5451 | if (qeth_set_thread_start_bit(card, QETH_SET_IP_THREAD) == 0) | 5582 | if (qeth_set_thread_start_bit(card, QETH_SET_IP_THREAD) == 0) |
5452 | schedule_work(&card->kernel_thread_starter); | 5583 | schedule_work(&card->kernel_thread_starter); |
5584 | if (!qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) | ||
5585 | return; | ||
5586 | if (qeth_set_thread_start_bit(card, QETH_SET_PROMISC_MODE_THREAD)==0) | ||
5587 | schedule_work(&card->kernel_thread_starter); | ||
5588 | |||
5453 | } | 5589 | } |
5454 | 5590 | ||
5455 | static int | 5591 | static int |
@@ -5657,6 +5793,24 @@ qeth_add_multicast_ipv4(struct qeth_card *card) | |||
5657 | in_dev_put(in4_dev); | 5793 | in_dev_put(in4_dev); |
5658 | } | 5794 | } |
5659 | 5795 | ||
5796 | static void | ||
5797 | qeth_layer2_add_multicast(struct qeth_card *card) | ||
5798 | { | ||
5799 | struct qeth_ipaddr *ipm; | ||
5800 | struct dev_mc_list *dm; | ||
5801 | |||
5802 | QETH_DBF_TEXT(trace,4,"L2addmc"); | ||
5803 | for (dm = card->dev->mc_list; dm; dm = dm->next) { | ||
5804 | ipm = qeth_get_addr_buffer(QETH_PROT_IPV4); | ||
5805 | if (!ipm) | ||
5806 | continue; | ||
5807 | memcpy(ipm->mac,dm->dmi_addr,MAX_ADDR_LEN); | ||
5808 | ipm->is_multicast = 1; | ||
5809 | if (!qeth_add_ip(card, ipm)) | ||
5810 | kfree(ipm); | ||
5811 | } | ||
5812 | } | ||
5813 | |||
5660 | #ifdef CONFIG_QETH_IPV6 | 5814 | #ifdef CONFIG_QETH_IPV6 |
5661 | static inline void | 5815 | static inline void |
5662 | qeth_add_mc6(struct qeth_card *card, struct inet6_dev *in6_dev) | 5816 | qeth_add_mc6(struct qeth_card *card, struct inet6_dev *in6_dev) |
@@ -5825,10 +5979,10 @@ qeth_layer2_send_setmac_cb(struct qeth_card *card, | |||
5825 | PRINT_WARN("Error in registering MAC address on " \ | 5979 | PRINT_WARN("Error in registering MAC address on " \ |
5826 | "device %s: x%x\n", CARD_BUS_ID(card), | 5980 | "device %s: x%x\n", CARD_BUS_ID(card), |
5827 | cmd->hdr.return_code); | 5981 | cmd->hdr.return_code); |
5828 | card->info.layer2_mac_registered = 0; | 5982 | card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; |
5829 | cmd->hdr.return_code = -EIO; | 5983 | cmd->hdr.return_code = -EIO; |
5830 | } else { | 5984 | } else { |
5831 | card->info.layer2_mac_registered = 1; | 5985 | card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED; |
5832 | memcpy(card->dev->dev_addr,cmd->data.setdelmac.mac, | 5986 | memcpy(card->dev->dev_addr,cmd->data.setdelmac.mac, |
5833 | OSA_ADDR_LEN); | 5987 | OSA_ADDR_LEN); |
5834 | PRINT_INFO("MAC address %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x " | 5988 | PRINT_INFO("MAC address %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x " |
@@ -5866,7 +6020,7 @@ qeth_layer2_send_delmac_cb(struct qeth_card *card, | |||
5866 | cmd->hdr.return_code = -EIO; | 6020 | cmd->hdr.return_code = -EIO; |
5867 | return 0; | 6021 | return 0; |
5868 | } | 6022 | } |
5869 | card->info.layer2_mac_registered = 0; | 6023 | card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; |
5870 | 6024 | ||
5871 | return 0; | 6025 | return 0; |
5872 | } | 6026 | } |
@@ -5874,7 +6028,7 @@ static int | |||
5874 | qeth_layer2_send_delmac(struct qeth_card *card, __u8 *mac) | 6028 | qeth_layer2_send_delmac(struct qeth_card *card, __u8 *mac) |
5875 | { | 6029 | { |
5876 | QETH_DBF_TEXT(trace, 2, "L2Delmac"); | 6030 | QETH_DBF_TEXT(trace, 2, "L2Delmac"); |
5877 | if (!card->info.layer2_mac_registered) | 6031 | if (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED)) |
5878 | return 0; | 6032 | return 0; |
5879 | return qeth_layer2_send_setdelmac(card, mac, IPA_CMD_DELVMAC, | 6033 | return qeth_layer2_send_setdelmac(card, mac, IPA_CMD_DELVMAC, |
5880 | qeth_layer2_send_delmac_cb); | 6034 | qeth_layer2_send_delmac_cb); |
@@ -5896,7 +6050,7 @@ qeth_layer2_set_mac_address(struct net_device *dev, void *p) | |||
5896 | card = (struct qeth_card *) dev->priv; | 6050 | card = (struct qeth_card *) dev->priv; |
5897 | 6051 | ||
5898 | if (!card->options.layer2) { | 6052 | if (!card->options.layer2) { |
5899 | PRINT_WARN("Setting MAC address on %s is not supported" | 6053 | PRINT_WARN("Setting MAC address on %s is not supported " |
5900 | "in Layer 3 mode.\n", dev->name); | 6054 | "in Layer 3 mode.\n", dev->name); |
5901 | QETH_DBF_TEXT(trace, 3, "setmcLY3"); | 6055 | QETH_DBF_TEXT(trace, 3, "setmcLY3"); |
5902 | return -EOPNOTSUPP; | 6056 | return -EOPNOTSUPP; |
@@ -6441,6 +6595,8 @@ qeth_default_setadapterparms_cb(struct qeth_card *card, | |||
6441 | return 0; | 6595 | return 0; |
6442 | } | 6596 | } |
6443 | 6597 | ||
6598 | |||
6599 | |||
6444 | static int | 6600 | static int |
6445 | qeth_query_setadapterparms_cb(struct qeth_card *card, struct qeth_reply *reply, | 6601 | qeth_query_setadapterparms_cb(struct qeth_card *card, struct qeth_reply *reply, |
6446 | unsigned long data) | 6602 | unsigned long data) |
@@ -6481,8 +6637,13 @@ qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, | |||
6481 | QETH_DBF_TEXT(trace,4,"chgmaccb"); | 6637 | QETH_DBF_TEXT(trace,4,"chgmaccb"); |
6482 | 6638 | ||
6483 | cmd = (struct qeth_ipa_cmd *) data; | 6639 | cmd = (struct qeth_ipa_cmd *) data; |
6484 | memcpy(card->dev->dev_addr, | 6640 | if (!card->options.layer2 || card->info.guestlan || |
6485 | &cmd->data.setadapterparms.data.change_addr.addr,OSA_ADDR_LEN); | 6641 | !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) { |
6642 | memcpy(card->dev->dev_addr, | ||
6643 | &cmd->data.setadapterparms.data.change_addr.addr, | ||
6644 | OSA_ADDR_LEN); | ||
6645 | card->info.mac_bits |= QETH_LAYER2_MAC_READ; | ||
6646 | } | ||
6486 | qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd); | 6647 | qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd); |
6487 | return 0; | 6648 | return 0; |
6488 | } | 6649 | } |
@@ -6602,6 +6763,12 @@ qeth_layer2_initialize(struct qeth_card *card) | |||
6602 | QETH_DBF_TEXT(setup, 2, "doL2init"); | 6763 | QETH_DBF_TEXT(setup, 2, "doL2init"); |
6603 | QETH_DBF_TEXT_(setup, 2, "doL2%s", CARD_BUS_ID(card)); | 6764 | QETH_DBF_TEXT_(setup, 2, "doL2%s", CARD_BUS_ID(card)); |
6604 | 6765 | ||
6766 | rc = qeth_query_setadapterparms(card); | ||
6767 | if (rc) { | ||
6768 | PRINT_WARN("could not query adapter parameters on device %s: " | ||
6769 | "x%x\n", CARD_BUS_ID(card), rc); | ||
6770 | } | ||
6771 | |||
6605 | rc = qeth_setadpparms_change_macaddr(card); | 6772 | rc = qeth_setadpparms_change_macaddr(card); |
6606 | if (rc) { | 6773 | if (rc) { |
6607 | PRINT_WARN("couldn't get MAC address on " | 6774 | PRINT_WARN("couldn't get MAC address on " |
@@ -8548,7 +8715,7 @@ EXPORT_SYMBOL(qeth_osn_deregister); | |||
8548 | EXPORT_SYMBOL(qeth_osn_assist); | 8715 | EXPORT_SYMBOL(qeth_osn_assist); |
8549 | module_init(qeth_init); | 8716 | module_init(qeth_init); |
8550 | module_exit(qeth_exit); | 8717 | module_exit(qeth_exit); |
8551 | MODULE_AUTHOR("Frank Pavlic <pavlic@de.ibm.com>"); | 8718 | MODULE_AUTHOR("Frank Pavlic <fpavlic@de.ibm.com>"); |
8552 | MODULE_DESCRIPTION("Linux on zSeries OSA Express and HiperSockets support\n" \ | 8719 | MODULE_DESCRIPTION("Linux on zSeries OSA Express and HiperSockets support\n" \ |
8553 | "Copyright 2000,2003 IBM Corporation\n"); | 8720 | "Copyright 2000,2003 IBM Corporation\n"); |
8554 | 8721 | ||
diff --git a/drivers/s390/net/qeth_mpc.c b/drivers/s390/net/qeth_mpc.c index 30e053d3cac2..f0a080a9e515 100644 --- a/drivers/s390/net/qeth_mpc.c +++ b/drivers/s390/net/qeth_mpc.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Linux on zSeries OSA Express and HiperSockets support | 4 | * Linux on zSeries OSA Express and HiperSockets support |
5 | * | 5 | * |
6 | * Copyright 2000,2003 IBM Corporation | 6 | * Copyright 2000,2003 IBM Corporation |
7 | * Author(s): Frank Pavlic <pavlic@de.ibm.com> | 7 | * Author(s): Frank Pavlic <fpavlic@de.ibm.com> |
8 | * Thomas Spatzier <tspat@de.ibm.com> | 8 | * Thomas Spatzier <tspat@de.ibm.com> |
9 | * | 9 | * |
10 | */ | 10 | */ |
diff --git a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h index 7edc5f1fc0d2..5f71486e708c 100644 --- a/drivers/s390/net/qeth_mpc.h +++ b/drivers/s390/net/qeth_mpc.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright 2000,2003 IBM Corporation | 6 | * Copyright 2000,2003 IBM Corporation |
7 | * Author(s): Utz Bacher <utz.bacher@de.ibm.com> | 7 | * Author(s): Utz Bacher <utz.bacher@de.ibm.com> |
8 | * Thomas Spatzier <tspat@de.ibm.com> | 8 | * Thomas Spatzier <tspat@de.ibm.com> |
9 | * Frank Pavlic <pavlic@de.ibm.com> | 9 | * Frank Pavlic <fpavlic@de.ibm.com> |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | #ifndef __QETH_MPC_H__ | 12 | #ifndef __QETH_MPC_H__ |
@@ -14,7 +14,7 @@ | |||
14 | 14 | ||
15 | #include <asm/qeth.h> | 15 | #include <asm/qeth.h> |
16 | 16 | ||
17 | #define VERSION_QETH_MPC_H "$Revision: 1.43 $" | 17 | #define VERSION_QETH_MPC_H "$Revision: 1.44 $" |
18 | 18 | ||
19 | extern const char *VERSION_QETH_MPC_C; | 19 | extern const char *VERSION_QETH_MPC_C; |
20 | 20 | ||
@@ -217,7 +217,7 @@ enum qeth_ipa_setadp_cmd { | |||
217 | IPA_SETADP_SEND_OSA_MESSAGE = 0x0100, | 217 | IPA_SETADP_SEND_OSA_MESSAGE = 0x0100, |
218 | IPA_SETADP_SET_SNMP_CONTROL = 0x0200, | 218 | IPA_SETADP_SET_SNMP_CONTROL = 0x0200, |
219 | IPA_SETADP_READ_SNMP_PARMS = 0x0400, | 219 | IPA_SETADP_READ_SNMP_PARMS = 0x0400, |
220 | IPA_SETADP_WRITE_SNMP_PARMS = 0x0800, | 220 | IPA_SETADP_SET_PROMISC_MODE = 0x0800, |
221 | IPA_SETADP_QUERY_CARD_INFO = 0x1000, | 221 | IPA_SETADP_QUERY_CARD_INFO = 0x1000, |
222 | }; | 222 | }; |
223 | enum qeth_ipa_mac_ops { | 223 | enum qeth_ipa_mac_ops { |
@@ -232,9 +232,12 @@ enum qeth_ipa_addr_ops { | |||
232 | CHANGE_ADDR_ADD_ADDR = 1, | 232 | CHANGE_ADDR_ADD_ADDR = 1, |
233 | CHANGE_ADDR_DEL_ADDR = 2, | 233 | CHANGE_ADDR_DEL_ADDR = 2, |
234 | CHANGE_ADDR_FLUSH_ADDR_TABLE = 4, | 234 | CHANGE_ADDR_FLUSH_ADDR_TABLE = 4, |
235 | |||
236 | |||
237 | }; | 235 | }; |
236 | enum qeth_ipa_promisc_modes { | ||
237 | SET_PROMISC_MODE_OFF = 0, | ||
238 | SET_PROMISC_MODE_ON = 1, | ||
239 | }; | ||
240 | |||
238 | /* (SET)DELIP(M) IPA stuff ***************************************************/ | 241 | /* (SET)DELIP(M) IPA stuff ***************************************************/ |
239 | struct qeth_ipacmd_setdelip4 { | 242 | struct qeth_ipacmd_setdelip4 { |
240 | __u8 ip_addr[4]; | 243 | __u8 ip_addr[4]; |
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index f91a02db5743..ddd6019ba092 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.55 $) | 3 | * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.58 $) |
4 | * | 4 | * |
5 | * Linux on zSeries OSA Express and HiperSockets support | 5 | * Linux on zSeries OSA Express and HiperSockets support |
6 | * This file contains code related to sysfs. | 6 | * This file contains code related to sysfs. |
@@ -8,7 +8,7 @@ | |||
8 | * Copyright 2000,2003 IBM Corporation | 8 | * Copyright 2000,2003 IBM Corporation |
9 | * | 9 | * |
10 | * Author(s): Thomas Spatzier <tspat@de.ibm.com> | 10 | * Author(s): Thomas Spatzier <tspat@de.ibm.com> |
11 | * Frank Pavlic <pavlic@de.ibm.com> | 11 | * Frank Pavlic <fpavlic@de.ibm.com> |
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | #include <linux/list.h> | 14 | #include <linux/list.h> |
@@ -20,7 +20,7 @@ | |||
20 | #include "qeth_mpc.h" | 20 | #include "qeth_mpc.h" |
21 | #include "qeth_fs.h" | 21 | #include "qeth_fs.h" |
22 | 22 | ||
23 | const char *VERSION_QETH_SYS_C = "$Revision: 1.55 $"; | 23 | const char *VERSION_QETH_SYS_C = "$Revision: 1.58 $"; |
24 | 24 | ||
25 | /*****************************************************************************/ | 25 | /*****************************************************************************/ |
26 | /* */ | 26 | /* */ |
@@ -1117,7 +1117,7 @@ qeth_parse_ipatoe(const char* buf, enum qeth_prot_versions proto, | |||
1117 | start = buf; | 1117 | start = buf; |
1118 | /* get address string */ | 1118 | /* get address string */ |
1119 | end = strchr(start, '/'); | 1119 | end = strchr(start, '/'); |
1120 | if (!end){ | 1120 | if (!end || (end-start >= 49)){ |
1121 | PRINT_WARN("Invalid format for ipato_addx/delx. " | 1121 | PRINT_WARN("Invalid format for ipato_addx/delx. " |
1122 | "Use <ip addr>/<mask bits>\n"); | 1122 | "Use <ip addr>/<mask bits>\n"); |
1123 | return -EINVAL; | 1123 | return -EINVAL; |
diff --git a/drivers/s390/net/qeth_tso.h b/drivers/s390/net/qeth_tso.h index ad33e6f466f1..e245af3c4cbd 100644 --- a/drivers/s390/net/qeth_tso.h +++ b/drivers/s390/net/qeth_tso.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Copyright 2004 IBM Corporation | 6 | * Copyright 2004 IBM Corporation |
7 | * | 7 | * |
8 | * Author(s): Frank Pavlic <pavlic@de.ibm.com> | 8 | * Author(s): Frank Pavlic <fpavlic@de.ibm.com> |
9 | * | 9 | * |
10 | * $Revision: 1.7 $ $Date: 2005/05/04 20:19:18 $ | 10 | * $Revision: 1.7 $ $Date: 2005/05/04 20:19:18 $ |
11 | * | 11 | * |
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c index 2c86a4b809cd..c3a51d1fae5d 100644 --- a/drivers/sbus/char/display7seg.c +++ b/drivers/sbus/char/display7seg.c | |||
@@ -119,7 +119,7 @@ static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
119 | { | 119 | { |
120 | __u8 regs = readb(d7s_regs); | 120 | __u8 regs = readb(d7s_regs); |
121 | __u8 ireg = 0; | 121 | __u8 ireg = 0; |
122 | int error = 0 | 122 | int error = 0; |
123 | 123 | ||
124 | if (D7S_MINOR != iminor(file->f_dentry->d_inode)) | 124 | if (D7S_MINOR != iminor(file->f_dentry->d_inode)) |
125 | return -ENODEV; | 125 | return -ENODEV; |
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 10c470e7d316..57ef7ae387d9 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -255,7 +255,7 @@ static struct ata_port_info ahci_port_info[] = { | |||
255 | }, | 255 | }, |
256 | }; | 256 | }; |
257 | 257 | ||
258 | static struct pci_device_id ahci_pci_tbl[] = { | 258 | static const struct pci_device_id ahci_pci_tbl[] = { |
259 | { PCI_VENDOR_ID_INTEL, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 259 | { PCI_VENDOR_ID_INTEL, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
260 | board_ahci }, /* ICH6 */ | 260 | board_ahci }, /* ICH6 */ |
261 | { PCI_VENDOR_ID_INTEL, 0x2653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 261 | { PCI_VENDOR_ID_INTEL, 0x2653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index a1bd8d95623c..855428ff37e9 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -95,7 +95,7 @@ static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); | |||
95 | 95 | ||
96 | static unsigned int in_module_init = 1; | 96 | static unsigned int in_module_init = 1; |
97 | 97 | ||
98 | static struct pci_device_id piix_pci_tbl[] = { | 98 | static const struct pci_device_id piix_pci_tbl[] = { |
99 | #ifdef ATA_ENABLE_PATA | 99 | #ifdef ATA_ENABLE_PATA |
100 | { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix4_pata }, | 100 | { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix4_pata }, |
101 | { 0x8086, 0x24db, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata }, | 101 | { 0x8086, 0x24db, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata }, |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index a74b4071a662..e51d9a8a2796 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -4563,6 +4563,7 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int | |||
4563 | 4563 | ||
4564 | probe_ent->irq = pdev->irq; | 4564 | probe_ent->irq = pdev->irq; |
4565 | probe_ent->irq_flags = SA_SHIRQ; | 4565 | probe_ent->irq_flags = SA_SHIRQ; |
4566 | probe_ent->private_data = port[0]->private_data; | ||
4566 | 4567 | ||
4567 | if (ports & ATA_PORT_PRIMARY) { | 4568 | if (ports & ATA_PORT_PRIMARY) { |
4568 | probe_ent->port[p].cmd_addr = pci_resource_start(pdev, 0); | 4569 | probe_ent->port[p].cmd_addr = pci_resource_start(pdev, 0); |
@@ -4599,6 +4600,7 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, stru | |||
4599 | probe_ent->legacy_mode = 1; | 4600 | probe_ent->legacy_mode = 1; |
4600 | probe_ent->n_ports = 1; | 4601 | probe_ent->n_ports = 1; |
4601 | probe_ent->hard_port_no = port_num; | 4602 | probe_ent->hard_port_no = port_num; |
4603 | probe_ent->private_data = port->private_data; | ||
4602 | 4604 | ||
4603 | switch(port_num) | 4605 | switch(port_num) |
4604 | { | 4606 | { |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index bb30fcdc9297..7e37f488f591 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -1129,6 +1129,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1129 | * length 0 means transfer 0 block of data. | 1129 | * length 0 means transfer 0 block of data. |
1130 | * However, for ATA R/W commands, sector count 0 means | 1130 | * However, for ATA R/W commands, sector count 0 means |
1131 | * 256 or 65536 sectors, not 0 sectors as in SCSI. | 1131 | * 256 or 65536 sectors, not 0 sectors as in SCSI. |
1132 | * | ||
1133 | * WARNING: one or two older ATA drives treat 0 as 0... | ||
1132 | */ | 1134 | */ |
1133 | goto nothing_to_do; | 1135 | goto nothing_to_do; |
1134 | 1136 | ||
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index c90723860a04..07498118359d 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -1704,7 +1704,6 @@ MODULE_DEVICE_TABLE(pci, lpfc_id_table); | |||
1704 | 1704 | ||
1705 | static struct pci_driver lpfc_driver = { | 1705 | static struct pci_driver lpfc_driver = { |
1706 | .name = LPFC_DRIVER_NAME, | 1706 | .name = LPFC_DRIVER_NAME, |
1707 | .owner = THIS_MODULE, | ||
1708 | .id_table = lpfc_id_table, | 1707 | .id_table = lpfc_id_table, |
1709 | .probe = lpfc_pci_probe_one, | 1708 | .probe = lpfc_pci_probe_one, |
1710 | .remove = __devexit_p(lpfc_pci_remove_one), | 1709 | .remove = __devexit_p(lpfc_pci_remove_one), |
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c index 78b4ff117af6..f557f17ca00c 100644 --- a/drivers/scsi/pdc_adma.c +++ b/drivers/scsi/pdc_adma.c | |||
@@ -190,7 +190,7 @@ static struct ata_port_info adma_port_info[] = { | |||
190 | }, | 190 | }, |
191 | }; | 191 | }; |
192 | 192 | ||
193 | static struct pci_device_id adma_ata_pci_tbl[] = { | 193 | static const struct pci_device_id adma_ata_pci_tbl[] = { |
194 | { PCI_VENDOR_ID_PDC, 0x1841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 194 | { PCI_VENDOR_ID_PDC, 0x1841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
195 | board_1841_idx }, | 195 | board_1841_idx }, |
196 | 196 | ||
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 93d55233af7b..257c128f4aaa 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -349,7 +349,7 @@ static struct ata_port_info mv_port_info[] = { | |||
349 | }, | 349 | }, |
350 | }; | 350 | }; |
351 | 351 | ||
352 | static struct pci_device_id mv_pci_tbl[] = { | 352 | static const struct pci_device_id mv_pci_tbl[] = { |
353 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x}, | 353 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x}, |
354 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x}, | 354 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x}, |
355 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_508x}, | 355 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_508x}, |
@@ -359,6 +359,8 @@ static struct pci_device_id mv_pci_tbl[] = { | |||
359 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6041), 0, 0, chip_604x}, | 359 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6041), 0, 0, chip_604x}, |
360 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6080), 0, 0, chip_608x}, | 360 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6080), 0, 0, chip_608x}, |
361 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6081), 0, 0, chip_608x}, | 361 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6081), 0, 0, chip_608x}, |
362 | |||
363 | {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x0241), 0, 0, chip_604x}, | ||
362 | {} /* terminate list */ | 364 | {} /* terminate list */ |
363 | }; | 365 | }; |
364 | 366 | ||
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c index 37a4fae95ed4..4954896dfdb9 100644 --- a/drivers/scsi/sata_nv.c +++ b/drivers/scsi/sata_nv.c | |||
@@ -137,7 +137,7 @@ enum nv_host_type | |||
137 | CK804 | 137 | CK804 |
138 | }; | 138 | }; |
139 | 139 | ||
140 | static struct pci_device_id nv_pci_tbl[] = { | 140 | static const struct pci_device_id nv_pci_tbl[] = { |
141 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA, | 141 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA, |
142 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, NFORCE2 }, | 142 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, NFORCE2 }, |
143 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA, | 143 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA, |
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index 9edc9d91efc3..242d906987ad 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -193,7 +193,7 @@ static struct ata_port_info pdc_port_info[] = { | |||
193 | }, | 193 | }, |
194 | }; | 194 | }; |
195 | 195 | ||
196 | static struct pci_device_id pdc_ata_pci_tbl[] = { | 196 | static const struct pci_device_id pdc_ata_pci_tbl[] = { |
197 | { PCI_VENDOR_ID_PROMISE, 0x3371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 197 | { PCI_VENDOR_ID_PROMISE, 0x3371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
198 | board_2037x }, | 198 | board_2037x }, |
199 | { PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 199 | { PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index d274ab235781..b2f6324a2eb2 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c | |||
@@ -184,7 +184,7 @@ static struct ata_port_info qs_port_info[] = { | |||
184 | }, | 184 | }, |
185 | }; | 185 | }; |
186 | 186 | ||
187 | static struct pci_device_id qs_ata_pci_tbl[] = { | 187 | static const struct pci_device_id qs_ata_pci_tbl[] = { |
188 | { PCI_VENDOR_ID_PDC, 0x2068, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 188 | { PCI_VENDOR_ID_PDC, 0x2068, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
189 | board_2068_idx }, | 189 | board_2068_idx }, |
190 | 190 | ||
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index d0e3c3c6c25f..36091868560d 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c | |||
@@ -87,7 +87,7 @@ static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | |||
87 | static void sil_post_set_mode (struct ata_port *ap); | 87 | static void sil_post_set_mode (struct ata_port *ap); |
88 | 88 | ||
89 | 89 | ||
90 | static struct pci_device_id sil_pci_tbl[] = { | 90 | static const struct pci_device_id sil_pci_tbl[] = { |
91 | { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 91 | { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
92 | { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, | 92 | { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, |
93 | { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, | 93 | { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 4682a50650b4..d3198d9a72c1 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -240,7 +240,7 @@ static void sil24_port_stop(struct ata_port *ap); | |||
240 | static void sil24_host_stop(struct ata_host_set *host_set); | 240 | static void sil24_host_stop(struct ata_host_set *host_set); |
241 | static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 241 | static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
242 | 242 | ||
243 | static struct pci_device_id sil24_pci_tbl[] = { | 243 | static const struct pci_device_id sil24_pci_tbl[] = { |
244 | { 0x1095, 0x3124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3124 }, | 244 | { 0x1095, 0x3124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3124 }, |
245 | { 0x1095, 0x3132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3132 }, | 245 | { 0x1095, 0x3132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3132 }, |
246 | { 0x1095, 0x3131, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3131 }, | 246 | { 0x1095, 0x3131, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3131 }, |
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c index 42d7c4e92501..32e12620b162 100644 --- a/drivers/scsi/sata_sis.c +++ b/drivers/scsi/sata_sis.c | |||
@@ -67,7 +67,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | |||
67 | static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg); | 67 | static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg); |
68 | static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 68 | static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); |
69 | 69 | ||
70 | static struct pci_device_id sis_pci_tbl[] = { | 70 | static const struct pci_device_id sis_pci_tbl[] = { |
71 | { PCI_VENDOR_ID_SI, 0x180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 }, | 71 | { PCI_VENDOR_ID_SI, 0x180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 }, |
72 | { PCI_VENDOR_ID_SI, 0x181, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 }, | 72 | { PCI_VENDOR_ID_SI, 0x181, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 }, |
73 | { PCI_VENDOR_ID_SI, 0x182, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 }, | 73 | { PCI_VENDOR_ID_SI, 0x182, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 }, |
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index 9895d1caefcf..57e5a9d964c3 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c | |||
@@ -466,7 +466,7 @@ err_out: | |||
466 | * 0x24a is device ID for BCM5785 (aka HT1000) HT southbridge integrated SATA | 466 | * 0x24a is device ID for BCM5785 (aka HT1000) HT southbridge integrated SATA |
467 | * controller | 467 | * controller |
468 | * */ | 468 | * */ |
469 | static struct pci_device_id k2_sata_pci_tbl[] = { | 469 | static const struct pci_device_id k2_sata_pci_tbl[] = { |
470 | { 0x1166, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, | 470 | { 0x1166, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, |
471 | { 0x1166, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, | 471 | { 0x1166, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, |
472 | { 0x1166, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, | 472 | { 0x1166, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, |
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index d5a38784352b..b4bbe48acab0 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c | |||
@@ -229,7 +229,7 @@ static struct ata_port_info pdc_port_info[] = { | |||
229 | 229 | ||
230 | }; | 230 | }; |
231 | 231 | ||
232 | static struct pci_device_id pdc_sata_pci_tbl[] = { | 232 | static const struct pci_device_id pdc_sata_pci_tbl[] = { |
233 | { PCI_VENDOR_ID_PROMISE, 0x6622, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 233 | { PCI_VENDOR_ID_PROMISE, 0x6622, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
234 | board_20621 }, | 234 | board_20621 }, |
235 | { } /* terminate list */ | 235 | { } /* terminate list */ |
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c index cf0baaa4e045..b2422a0f25c8 100644 --- a/drivers/scsi/sata_uli.c +++ b/drivers/scsi/sata_uli.c | |||
@@ -55,7 +55,7 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | |||
55 | static u32 uli_scr_read (struct ata_port *ap, unsigned int sc_reg); | 55 | static u32 uli_scr_read (struct ata_port *ap, unsigned int sc_reg); |
56 | static void uli_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 56 | static void uli_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); |
57 | 57 | ||
58 | static struct pci_device_id uli_pci_tbl[] = { | 58 | static const struct pci_device_id uli_pci_tbl[] = { |
59 | { PCI_VENDOR_ID_AL, 0x5289, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5289 }, | 59 | { PCI_VENDOR_ID_AL, 0x5289, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5289 }, |
60 | { PCI_VENDOR_ID_AL, 0x5287, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5287 }, | 60 | { PCI_VENDOR_ID_AL, 0x5287, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5287 }, |
61 | { PCI_VENDOR_ID_AL, 0x5281, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5281 }, | 61 | { PCI_VENDOR_ID_AL, 0x5281, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5281 }, |
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c index ab19d2ba2a4b..c76215692da2 100644 --- a/drivers/scsi/sata_via.c +++ b/drivers/scsi/sata_via.c | |||
@@ -75,7 +75,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
75 | static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg); | 75 | static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg); |
76 | static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 76 | static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); |
77 | 77 | ||
78 | static struct pci_device_id svia_pci_tbl[] = { | 78 | static const struct pci_device_id svia_pci_tbl[] = { |
79 | { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 }, | 79 | { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 }, |
80 | { 0x1106, 0x3249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6421 }, | 80 | { 0x1106, 0x3249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6421 }, |
81 | 81 | ||
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index ce8a2fd7da84..77a6e4b9262d 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c | |||
@@ -400,7 +400,7 @@ err_out: | |||
400 | * 0x8086/0x3200 is the Intel 31244, which is supposed to be identical | 400 | * 0x8086/0x3200 is the Intel 31244, which is supposed to be identical |
401 | * compatibility is untested as of yet | 401 | * compatibility is untested as of yet |
402 | */ | 402 | */ |
403 | static struct pci_device_id vsc_sata_pci_tbl[] = { | 403 | static const struct pci_device_id vsc_sata_pci_tbl[] = { |
404 | { 0x1725, 0x7174, PCI_ANY_ID, PCI_ANY_ID, 0x10600, 0xFFFFFF, 0 }, | 404 | { 0x1725, 0x7174, PCI_ANY_ID, PCI_ANY_ID, 0x10600, 0xFFFFFF, 0 }, |
405 | { 0x8086, 0x3200, PCI_ANY_ID, PCI_ANY_ID, 0x10600, 0xFFFFFF, 0 }, | 405 | { 0x8086, 0x3200, PCI_ANY_ID, PCI_ANY_ID, 0x10600, 0xFFFFFF, 0 }, |
406 | { } | 406 | { } |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 98820603e75f..3742753241ee 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -2381,9 +2381,9 @@ void serial8250_resume_port(int line) | |||
2381 | * list is terminated with a zero flags entry, which means we expect | 2381 | * list is terminated with a zero flags entry, which means we expect |
2382 | * all entries to have at least UPF_BOOT_AUTOCONF set. | 2382 | * all entries to have at least UPF_BOOT_AUTOCONF set. |
2383 | */ | 2383 | */ |
2384 | static int __devinit serial8250_probe(struct device *dev) | 2384 | static int __devinit serial8250_probe(struct platform_device *dev) |
2385 | { | 2385 | { |
2386 | struct plat_serial8250_port *p = dev->platform_data; | 2386 | struct plat_serial8250_port *p = dev->dev.platform_data; |
2387 | struct uart_port port; | 2387 | struct uart_port port; |
2388 | int ret, i; | 2388 | int ret, i; |
2389 | 2389 | ||
@@ -2399,12 +2399,12 @@ static int __devinit serial8250_probe(struct device *dev) | |||
2399 | port.flags = p->flags; | 2399 | port.flags = p->flags; |
2400 | port.mapbase = p->mapbase; | 2400 | port.mapbase = p->mapbase; |
2401 | port.hub6 = p->hub6; | 2401 | port.hub6 = p->hub6; |
2402 | port.dev = dev; | 2402 | port.dev = &dev->dev; |
2403 | if (share_irqs) | 2403 | if (share_irqs) |
2404 | port.flags |= UPF_SHARE_IRQ; | 2404 | port.flags |= UPF_SHARE_IRQ; |
2405 | ret = serial8250_register_port(&port); | 2405 | ret = serial8250_register_port(&port); |
2406 | if (ret < 0) { | 2406 | if (ret < 0) { |
2407 | dev_err(dev, "unable to register port at index %d " | 2407 | dev_err(&dev->dev, "unable to register port at index %d " |
2408 | "(IO%lx MEM%lx IRQ%d): %d\n", i, | 2408 | "(IO%lx MEM%lx IRQ%d): %d\n", i, |
2409 | p->iobase, p->mapbase, p->irq, ret); | 2409 | p->iobase, p->mapbase, p->irq, ret); |
2410 | } | 2410 | } |
@@ -2415,54 +2415,55 @@ static int __devinit serial8250_probe(struct device *dev) | |||
2415 | /* | 2415 | /* |
2416 | * Remove serial ports registered against a platform device. | 2416 | * Remove serial ports registered against a platform device. |
2417 | */ | 2417 | */ |
2418 | static int __devexit serial8250_remove(struct device *dev) | 2418 | static int __devexit serial8250_remove(struct platform_device *dev) |
2419 | { | 2419 | { |
2420 | int i; | 2420 | int i; |
2421 | 2421 | ||
2422 | for (i = 0; i < UART_NR; i++) { | 2422 | for (i = 0; i < UART_NR; i++) { |
2423 | struct uart_8250_port *up = &serial8250_ports[i]; | 2423 | struct uart_8250_port *up = &serial8250_ports[i]; |
2424 | 2424 | ||
2425 | if (up->port.dev == dev) | 2425 | if (up->port.dev == &dev->dev) |
2426 | serial8250_unregister_port(i); | 2426 | serial8250_unregister_port(i); |
2427 | } | 2427 | } |
2428 | return 0; | 2428 | return 0; |
2429 | } | 2429 | } |
2430 | 2430 | ||
2431 | static int serial8250_suspend(struct device *dev, pm_message_t state) | 2431 | static int serial8250_suspend(struct platform_device *dev, pm_message_t state) |
2432 | { | 2432 | { |
2433 | int i; | 2433 | int i; |
2434 | 2434 | ||
2435 | for (i = 0; i < UART_NR; i++) { | 2435 | for (i = 0; i < UART_NR; i++) { |
2436 | struct uart_8250_port *up = &serial8250_ports[i]; | 2436 | struct uart_8250_port *up = &serial8250_ports[i]; |
2437 | 2437 | ||
2438 | if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) | 2438 | if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev) |
2439 | uart_suspend_port(&serial8250_reg, &up->port); | 2439 | uart_suspend_port(&serial8250_reg, &up->port); |
2440 | } | 2440 | } |
2441 | 2441 | ||
2442 | return 0; | 2442 | return 0; |
2443 | } | 2443 | } |
2444 | 2444 | ||
2445 | static int serial8250_resume(struct device *dev) | 2445 | static int serial8250_resume(struct platform_device *dev) |
2446 | { | 2446 | { |
2447 | int i; | 2447 | int i; |
2448 | 2448 | ||
2449 | for (i = 0; i < UART_NR; i++) { | 2449 | for (i = 0; i < UART_NR; i++) { |
2450 | struct uart_8250_port *up = &serial8250_ports[i]; | 2450 | struct uart_8250_port *up = &serial8250_ports[i]; |
2451 | 2451 | ||
2452 | if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) | 2452 | if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev) |
2453 | uart_resume_port(&serial8250_reg, &up->port); | 2453 | uart_resume_port(&serial8250_reg, &up->port); |
2454 | } | 2454 | } |
2455 | 2455 | ||
2456 | return 0; | 2456 | return 0; |
2457 | } | 2457 | } |
2458 | 2458 | ||
2459 | static struct device_driver serial8250_isa_driver = { | 2459 | static struct platform_driver serial8250_isa_driver = { |
2460 | .name = "serial8250", | ||
2461 | .bus = &platform_bus_type, | ||
2462 | .probe = serial8250_probe, | 2460 | .probe = serial8250_probe, |
2463 | .remove = __devexit_p(serial8250_remove), | 2461 | .remove = __devexit_p(serial8250_remove), |
2464 | .suspend = serial8250_suspend, | 2462 | .suspend = serial8250_suspend, |
2465 | .resume = serial8250_resume, | 2463 | .resume = serial8250_resume, |
2464 | .driver = { | ||
2465 | .name = "serial8250", | ||
2466 | }, | ||
2466 | }; | 2467 | }; |
2467 | 2468 | ||
2468 | /* | 2469 | /* |
@@ -2608,7 +2609,7 @@ static int __init serial8250_init(void) | |||
2608 | 2609 | ||
2609 | serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); | 2610 | serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); |
2610 | 2611 | ||
2611 | ret = driver_register(&serial8250_isa_driver); | 2612 | ret = platform_driver_register(&serial8250_isa_driver); |
2612 | if (ret == 0) | 2613 | if (ret == 0) |
2613 | goto out; | 2614 | goto out; |
2614 | 2615 | ||
@@ -2630,7 +2631,7 @@ static void __exit serial8250_exit(void) | |||
2630 | */ | 2631 | */ |
2631 | serial8250_isa_devs = NULL; | 2632 | serial8250_isa_devs = NULL; |
2632 | 2633 | ||
2633 | driver_unregister(&serial8250_isa_driver); | 2634 | platform_driver_unregister(&serial8250_isa_driver); |
2634 | platform_device_unregister(isa_dev); | 2635 | platform_device_unregister(isa_dev); |
2635 | 2636 | ||
2636 | uart_unregister_driver(&serial8250_reg); | 2637 | uart_unregister_driver(&serial8250_reg); |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 4a54ff584700..355cd93a8a87 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -921,9 +921,9 @@ static struct uart_driver imx_reg = { | |||
921 | .cons = IMX_CONSOLE, | 921 | .cons = IMX_CONSOLE, |
922 | }; | 922 | }; |
923 | 923 | ||
924 | static int serial_imx_suspend(struct device *_dev, pm_message_t state) | 924 | static int serial_imx_suspend(struct platform_device *dev, pm_message_t state) |
925 | { | 925 | { |
926 | struct imx_port *sport = dev_get_drvdata(_dev); | 926 | struct imx_port *sport = platform_get_drvdata(dev); |
927 | 927 | ||
928 | if (sport) | 928 | if (sport) |
929 | uart_suspend_port(&imx_reg, &sport->port); | 929 | uart_suspend_port(&imx_reg, &sport->port); |
@@ -931,9 +931,9 @@ static int serial_imx_suspend(struct device *_dev, pm_message_t state) | |||
931 | return 0; | 931 | return 0; |
932 | } | 932 | } |
933 | 933 | ||
934 | static int serial_imx_resume(struct device *_dev) | 934 | static int serial_imx_resume(struct platform_device *dev) |
935 | { | 935 | { |
936 | struct imx_port *sport = dev_get_drvdata(_dev); | 936 | struct imx_port *sport = platform_get_drvdata(dev); |
937 | 937 | ||
938 | if (sport) | 938 | if (sport) |
939 | uart_resume_port(&imx_reg, &sport->port); | 939 | uart_resume_port(&imx_reg, &sport->port); |
@@ -941,21 +941,19 @@ static int serial_imx_resume(struct device *_dev) | |||
941 | return 0; | 941 | return 0; |
942 | } | 942 | } |
943 | 943 | ||
944 | static int serial_imx_probe(struct device *_dev) | 944 | static int serial_imx_probe(struct platform_device *dev) |
945 | { | 945 | { |
946 | struct platform_device *dev = to_platform_device(_dev); | 946 | imx_ports[dev->id].port.dev = &dev->dev; |
947 | |||
948 | imx_ports[dev->id].port.dev = _dev; | ||
949 | uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); | 947 | uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); |
950 | dev_set_drvdata(_dev, &imx_ports[dev->id]); | 948 | platform_set_drvdata(dev, &imx_ports[dev->id]); |
951 | return 0; | 949 | return 0; |
952 | } | 950 | } |
953 | 951 | ||
954 | static int serial_imx_remove(struct device *_dev) | 952 | static int serial_imx_remove(struct platform_device *dev) |
955 | { | 953 | { |
956 | struct imx_port *sport = dev_get_drvdata(_dev); | 954 | struct imx_port *sport = platform_get_drvdata(dev); |
957 | 955 | ||
958 | dev_set_drvdata(_dev, NULL); | 956 | platform_set_drvdata(dev, NULL); |
959 | 957 | ||
960 | if (sport) | 958 | if (sport) |
961 | uart_remove_one_port(&imx_reg, &sport->port); | 959 | uart_remove_one_port(&imx_reg, &sport->port); |
@@ -963,14 +961,15 @@ static int serial_imx_remove(struct device *_dev) | |||
963 | return 0; | 961 | return 0; |
964 | } | 962 | } |
965 | 963 | ||
966 | static struct device_driver serial_imx_driver = { | 964 | static struct platform_driver serial_imx_driver = { |
967 | .name = "imx-uart", | ||
968 | .bus = &platform_bus_type, | ||
969 | .probe = serial_imx_probe, | 965 | .probe = serial_imx_probe, |
970 | .remove = serial_imx_remove, | 966 | .remove = serial_imx_remove, |
971 | 967 | ||
972 | .suspend = serial_imx_suspend, | 968 | .suspend = serial_imx_suspend, |
973 | .resume = serial_imx_resume, | 969 | .resume = serial_imx_resume, |
970 | .driver = { | ||
971 | .name = "imx-uart", | ||
972 | }, | ||
974 | }; | 973 | }; |
975 | 974 | ||
976 | static int __init imx_serial_init(void) | 975 | static int __init imx_serial_init(void) |
@@ -985,7 +984,7 @@ static int __init imx_serial_init(void) | |||
985 | if (ret) | 984 | if (ret) |
986 | return ret; | 985 | return ret; |
987 | 986 | ||
988 | ret = driver_register(&serial_imx_driver); | 987 | ret = platform_driver_register(&serial_imx_driver); |
989 | if (ret != 0) | 988 | if (ret != 0) |
990 | uart_unregister_driver(&imx_reg); | 989 | uart_unregister_driver(&imx_reg); |
991 | 990 | ||
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 0dd08a09e7e6..5d3cb8486447 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
@@ -717,10 +717,9 @@ static struct uart_driver mpc52xx_uart_driver = { | |||
717 | /* ======================================================================== */ | 717 | /* ======================================================================== */ |
718 | 718 | ||
719 | static int __devinit | 719 | static int __devinit |
720 | mpc52xx_uart_probe(struct device *dev) | 720 | mpc52xx_uart_probe(struct platform_device *dev) |
721 | { | 721 | { |
722 | struct platform_device *pdev = to_platform_device(dev); | 722 | struct resource *res = dev->resource; |
723 | struct resource *res = pdev->resource; | ||
724 | 723 | ||
725 | struct uart_port *port = NULL; | 724 | struct uart_port *port = NULL; |
726 | int i, idx, ret; | 725 | int i, idx, ret; |
@@ -761,17 +760,17 @@ mpc52xx_uart_probe(struct device *dev) | |||
761 | /* Add the port to the uart sub-system */ | 760 | /* Add the port to the uart sub-system */ |
762 | ret = uart_add_one_port(&mpc52xx_uart_driver, port); | 761 | ret = uart_add_one_port(&mpc52xx_uart_driver, port); |
763 | if (!ret) | 762 | if (!ret) |
764 | dev_set_drvdata(dev, (void*)port); | 763 | platform_set_drvdata(dev, (void*)port); |
765 | 764 | ||
766 | return ret; | 765 | return ret; |
767 | } | 766 | } |
768 | 767 | ||
769 | static int | 768 | static int |
770 | mpc52xx_uart_remove(struct device *dev) | 769 | mpc52xx_uart_remove(struct platform_device *dev) |
771 | { | 770 | { |
772 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); | 771 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); |
773 | 772 | ||
774 | dev_set_drvdata(dev, NULL); | 773 | platform_set_drvdata(dev, NULL); |
775 | 774 | ||
776 | if (port) | 775 | if (port) |
777 | uart_remove_one_port(&mpc52xx_uart_driver, port); | 776 | uart_remove_one_port(&mpc52xx_uart_driver, port); |
@@ -781,9 +780,9 @@ mpc52xx_uart_remove(struct device *dev) | |||
781 | 780 | ||
782 | #ifdef CONFIG_PM | 781 | #ifdef CONFIG_PM |
783 | static int | 782 | static int |
784 | mpc52xx_uart_suspend(struct device *dev, pm_message_t state) | 783 | mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state) |
785 | { | 784 | { |
786 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); | 785 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); |
787 | 786 | ||
788 | if (sport) | 787 | if (sport) |
789 | uart_suspend_port(&mpc52xx_uart_driver, port); | 788 | uart_suspend_port(&mpc52xx_uart_driver, port); |
@@ -792,9 +791,9 @@ mpc52xx_uart_suspend(struct device *dev, pm_message_t state) | |||
792 | } | 791 | } |
793 | 792 | ||
794 | static int | 793 | static int |
795 | mpc52xx_uart_resume(struct device *dev) | 794 | mpc52xx_uart_resume(struct platform_device *dev) |
796 | { | 795 | { |
797 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); | 796 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); |
798 | 797 | ||
799 | if (port) | 798 | if (port) |
800 | uart_resume_port(&mpc52xx_uart_driver, port); | 799 | uart_resume_port(&mpc52xx_uart_driver, port); |
@@ -803,15 +802,16 @@ mpc52xx_uart_resume(struct device *dev) | |||
803 | } | 802 | } |
804 | #endif | 803 | #endif |
805 | 804 | ||
806 | static struct device_driver mpc52xx_uart_platform_driver = { | 805 | static struct platform_driver mpc52xx_uart_platform_driver = { |
807 | .name = "mpc52xx-psc", | ||
808 | .bus = &platform_bus_type, | ||
809 | .probe = mpc52xx_uart_probe, | 806 | .probe = mpc52xx_uart_probe, |
810 | .remove = mpc52xx_uart_remove, | 807 | .remove = mpc52xx_uart_remove, |
811 | #ifdef CONFIG_PM | 808 | #ifdef CONFIG_PM |
812 | .suspend = mpc52xx_uart_suspend, | 809 | .suspend = mpc52xx_uart_suspend, |
813 | .resume = mpc52xx_uart_resume, | 810 | .resume = mpc52xx_uart_resume, |
814 | #endif | 811 | #endif |
812 | .driver = { | ||
813 | .name = "mpc52xx-psc", | ||
814 | }, | ||
815 | }; | 815 | }; |
816 | 816 | ||
817 | 817 | ||
@@ -828,7 +828,7 @@ mpc52xx_uart_init(void) | |||
828 | 828 | ||
829 | ret = uart_register_driver(&mpc52xx_uart_driver); | 829 | ret = uart_register_driver(&mpc52xx_uart_driver); |
830 | if (ret == 0) { | 830 | if (ret == 0) { |
831 | ret = driver_register(&mpc52xx_uart_platform_driver); | 831 | ret = platform_driver_register(&mpc52xx_uart_platform_driver); |
832 | if (ret) | 832 | if (ret) |
833 | uart_unregister_driver(&mpc52xx_uart_driver); | 833 | uart_unregister_driver(&mpc52xx_uart_driver); |
834 | } | 834 | } |
@@ -839,7 +839,7 @@ mpc52xx_uart_init(void) | |||
839 | static void __exit | 839 | static void __exit |
840 | mpc52xx_uart_exit(void) | 840 | mpc52xx_uart_exit(void) |
841 | { | 841 | { |
842 | driver_unregister(&mpc52xx_uart_platform_driver); | 842 | platform_driver_unregister(&mpc52xx_uart_platform_driver); |
843 | uart_unregister_driver(&mpc52xx_uart_driver); | 843 | uart_unregister_driver(&mpc52xx_uart_driver); |
844 | } | 844 | } |
845 | 845 | ||
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c index ba8838b234da..8f83e4007ecd 100644 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c | |||
@@ -1551,15 +1551,14 @@ mpsc_shared_unmap_regs(void) | |||
1551 | } | 1551 | } |
1552 | 1552 | ||
1553 | static int | 1553 | static int |
1554 | mpsc_shared_drv_probe(struct device *dev) | 1554 | mpsc_shared_drv_probe(struct platform_device *dev) |
1555 | { | 1555 | { |
1556 | struct platform_device *pd = to_platform_device(dev); | ||
1557 | struct mpsc_shared_pdata *pdata; | 1556 | struct mpsc_shared_pdata *pdata; |
1558 | int rc = -ENODEV; | 1557 | int rc = -ENODEV; |
1559 | 1558 | ||
1560 | if (pd->id == 0) { | 1559 | if (dev->id == 0) { |
1561 | if (!(rc = mpsc_shared_map_regs(pd))) { | 1560 | if (!(rc = mpsc_shared_map_regs(dev))) { |
1562 | pdata = (struct mpsc_shared_pdata *)dev->platform_data; | 1561 | pdata = (struct mpsc_shared_pdata *)dev->dev.platform_data; |
1563 | 1562 | ||
1564 | mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val; | 1563 | mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val; |
1565 | mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val; | 1564 | mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val; |
@@ -1577,12 +1576,11 @@ mpsc_shared_drv_probe(struct device *dev) | |||
1577 | } | 1576 | } |
1578 | 1577 | ||
1579 | static int | 1578 | static int |
1580 | mpsc_shared_drv_remove(struct device *dev) | 1579 | mpsc_shared_drv_remove(struct platform_device *dev) |
1581 | { | 1580 | { |
1582 | struct platform_device *pd = to_platform_device(dev); | ||
1583 | int rc = -ENODEV; | 1581 | int rc = -ENODEV; |
1584 | 1582 | ||
1585 | if (pd->id == 0) { | 1583 | if (dev->id == 0) { |
1586 | mpsc_shared_unmap_regs(); | 1584 | mpsc_shared_unmap_regs(); |
1587 | mpsc_shared_regs.MPSC_MRR_m = 0; | 1585 | mpsc_shared_regs.MPSC_MRR_m = 0; |
1588 | mpsc_shared_regs.MPSC_RCRR_m = 0; | 1586 | mpsc_shared_regs.MPSC_RCRR_m = 0; |
@@ -1595,11 +1593,12 @@ mpsc_shared_drv_remove(struct device *dev) | |||
1595 | return rc; | 1593 | return rc; |
1596 | } | 1594 | } |
1597 | 1595 | ||
1598 | static struct device_driver mpsc_shared_driver = { | 1596 | static struct platform_driver mpsc_shared_driver = { |
1599 | .name = MPSC_SHARED_NAME, | ||
1600 | .bus = &platform_bus_type, | ||
1601 | .probe = mpsc_shared_drv_probe, | 1597 | .probe = mpsc_shared_drv_probe, |
1602 | .remove = mpsc_shared_drv_remove, | 1598 | .remove = mpsc_shared_drv_remove, |
1599 | .driver = { | ||
1600 | .name = MPSC_SHARED_NAME, | ||
1601 | }, | ||
1603 | }; | 1602 | }; |
1604 | 1603 | ||
1605 | /* | 1604 | /* |
@@ -1732,19 +1731,18 @@ mpsc_drv_get_platform_data(struct mpsc_port_info *pi, | |||
1732 | } | 1731 | } |
1733 | 1732 | ||
1734 | static int | 1733 | static int |
1735 | mpsc_drv_probe(struct device *dev) | 1734 | mpsc_drv_probe(struct platform_device *dev) |
1736 | { | 1735 | { |
1737 | struct platform_device *pd = to_platform_device(dev); | ||
1738 | struct mpsc_port_info *pi; | 1736 | struct mpsc_port_info *pi; |
1739 | int rc = -ENODEV; | 1737 | int rc = -ENODEV; |
1740 | 1738 | ||
1741 | pr_debug("mpsc_drv_probe: Adding MPSC %d\n", pd->id); | 1739 | pr_debug("mpsc_drv_probe: Adding MPSC %d\n", dev->id); |
1742 | 1740 | ||
1743 | if (pd->id < MPSC_NUM_CTLRS) { | 1741 | if (dev->id < MPSC_NUM_CTLRS) { |
1744 | pi = &mpsc_ports[pd->id]; | 1742 | pi = &mpsc_ports[dev->id]; |
1745 | 1743 | ||
1746 | if (!(rc = mpsc_drv_map_regs(pi, pd))) { | 1744 | if (!(rc = mpsc_drv_map_regs(pi, dev))) { |
1747 | mpsc_drv_get_platform_data(pi, pd, pd->id); | 1745 | mpsc_drv_get_platform_data(pi, dev, dev->id); |
1748 | 1746 | ||
1749 | if (!(rc = mpsc_make_ready(pi))) | 1747 | if (!(rc = mpsc_make_ready(pi))) |
1750 | if (!(rc = uart_add_one_port(&mpsc_reg, | 1748 | if (!(rc = uart_add_one_port(&mpsc_reg, |
@@ -1764,27 +1762,26 @@ mpsc_drv_probe(struct device *dev) | |||
1764 | } | 1762 | } |
1765 | 1763 | ||
1766 | static int | 1764 | static int |
1767 | mpsc_drv_remove(struct device *dev) | 1765 | mpsc_drv_remove(struct platform_device *dev) |
1768 | { | 1766 | { |
1769 | struct platform_device *pd = to_platform_device(dev); | 1767 | pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id); |
1770 | 1768 | ||
1771 | pr_debug("mpsc_drv_exit: Removing MPSC %d\n", pd->id); | 1769 | if (dev->id < MPSC_NUM_CTLRS) { |
1772 | 1770 | uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port); | |
1773 | if (pd->id < MPSC_NUM_CTLRS) { | 1771 | mpsc_release_port((struct uart_port *)&mpsc_ports[dev->id].port); |
1774 | uart_remove_one_port(&mpsc_reg, &mpsc_ports[pd->id].port); | 1772 | mpsc_drv_unmap_regs(&mpsc_ports[dev->id]); |
1775 | mpsc_release_port((struct uart_port *)&mpsc_ports[pd->id].port); | ||
1776 | mpsc_drv_unmap_regs(&mpsc_ports[pd->id]); | ||
1777 | return 0; | 1773 | return 0; |
1778 | } | 1774 | } |
1779 | else | 1775 | else |
1780 | return -ENODEV; | 1776 | return -ENODEV; |
1781 | } | 1777 | } |
1782 | 1778 | ||
1783 | static struct device_driver mpsc_driver = { | 1779 | static struct platform_driver mpsc_driver = { |
1784 | .name = MPSC_CTLR_NAME, | ||
1785 | .bus = &platform_bus_type, | ||
1786 | .probe = mpsc_drv_probe, | 1780 | .probe = mpsc_drv_probe, |
1787 | .remove = mpsc_drv_remove, | 1781 | .remove = mpsc_drv_remove, |
1782 | .driver = { | ||
1783 | .name = MPSC_CTLR_NAME, | ||
1784 | }, | ||
1788 | }; | 1785 | }; |
1789 | 1786 | ||
1790 | static int __init | 1787 | static int __init |
@@ -1798,9 +1795,9 @@ mpsc_drv_init(void) | |||
1798 | memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); | 1795 | memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); |
1799 | 1796 | ||
1800 | if (!(rc = uart_register_driver(&mpsc_reg))) { | 1797 | if (!(rc = uart_register_driver(&mpsc_reg))) { |
1801 | if (!(rc = driver_register(&mpsc_shared_driver))) { | 1798 | if (!(rc = platform_driver_register(&mpsc_shared_driver))) { |
1802 | if ((rc = driver_register(&mpsc_driver))) { | 1799 | if ((rc = platform_driver_register(&mpsc_driver))) { |
1803 | driver_unregister(&mpsc_shared_driver); | 1800 | platform_driver_unregister(&mpsc_shared_driver); |
1804 | uart_unregister_driver(&mpsc_reg); | 1801 | uart_unregister_driver(&mpsc_reg); |
1805 | } | 1802 | } |
1806 | } | 1803 | } |
@@ -1815,8 +1812,8 @@ mpsc_drv_init(void) | |||
1815 | static void __exit | 1812 | static void __exit |
1816 | mpsc_drv_exit(void) | 1813 | mpsc_drv_exit(void) |
1817 | { | 1814 | { |
1818 | driver_unregister(&mpsc_driver); | 1815 | platform_driver_unregister(&mpsc_driver); |
1819 | driver_unregister(&mpsc_shared_driver); | 1816 | platform_driver_unregister(&mpsc_shared_driver); |
1820 | uart_unregister_driver(&mpsc_reg); | 1817 | uart_unregister_driver(&mpsc_reg); |
1821 | memset(mpsc_ports, 0, sizeof(mpsc_ports)); | 1818 | memset(mpsc_ports, 0, sizeof(mpsc_ports)); |
1822 | memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); | 1819 | memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); |
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index 16b2f9417af9..ff5e6309d682 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c | |||
@@ -805,9 +805,9 @@ static struct uart_driver serial_pxa_reg = { | |||
805 | .cons = PXA_CONSOLE, | 805 | .cons = PXA_CONSOLE, |
806 | }; | 806 | }; |
807 | 807 | ||
808 | static int serial_pxa_suspend(struct device *_dev, pm_message_t state) | 808 | static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state) |
809 | { | 809 | { |
810 | struct uart_pxa_port *sport = dev_get_drvdata(_dev); | 810 | struct uart_pxa_port *sport = platform_get_drvdata(dev); |
811 | 811 | ||
812 | if (sport) | 812 | if (sport) |
813 | uart_suspend_port(&serial_pxa_reg, &sport->port); | 813 | uart_suspend_port(&serial_pxa_reg, &sport->port); |
@@ -815,9 +815,9 @@ static int serial_pxa_suspend(struct device *_dev, pm_message_t state) | |||
815 | return 0; | 815 | return 0; |
816 | } | 816 | } |
817 | 817 | ||
818 | static int serial_pxa_resume(struct device *_dev) | 818 | static int serial_pxa_resume(struct platform_device *dev) |
819 | { | 819 | { |
820 | struct uart_pxa_port *sport = dev_get_drvdata(_dev); | 820 | struct uart_pxa_port *sport = platform_get_drvdata(dev); |
821 | 821 | ||
822 | if (sport) | 822 | if (sport) |
823 | uart_resume_port(&serial_pxa_reg, &sport->port); | 823 | uart_resume_port(&serial_pxa_reg, &sport->port); |
@@ -825,21 +825,19 @@ static int serial_pxa_resume(struct device *_dev) | |||
825 | return 0; | 825 | return 0; |
826 | } | 826 | } |
827 | 827 | ||
828 | static int serial_pxa_probe(struct device *_dev) | 828 | static int serial_pxa_probe(struct platform_device *dev) |
829 | { | 829 | { |
830 | struct platform_device *dev = to_platform_device(_dev); | 830 | serial_pxa_ports[dev->id].port.dev = &dev->dev; |
831 | |||
832 | serial_pxa_ports[dev->id].port.dev = _dev; | ||
833 | uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port); | 831 | uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port); |
834 | dev_set_drvdata(_dev, &serial_pxa_ports[dev->id]); | 832 | platform_set_drvdata(dev, &serial_pxa_ports[dev->id]); |
835 | return 0; | 833 | return 0; |
836 | } | 834 | } |
837 | 835 | ||
838 | static int serial_pxa_remove(struct device *_dev) | 836 | static int serial_pxa_remove(struct platform_device *dev) |
839 | { | 837 | { |
840 | struct uart_pxa_port *sport = dev_get_drvdata(_dev); | 838 | struct uart_pxa_port *sport = platform_get_drvdata(dev); |
841 | 839 | ||
842 | dev_set_drvdata(_dev, NULL); | 840 | platform_set_drvdata(dev, NULL); |
843 | 841 | ||
844 | if (sport) | 842 | if (sport) |
845 | uart_remove_one_port(&serial_pxa_reg, &sport->port); | 843 | uart_remove_one_port(&serial_pxa_reg, &sport->port); |
@@ -847,14 +845,15 @@ static int serial_pxa_remove(struct device *_dev) | |||
847 | return 0; | 845 | return 0; |
848 | } | 846 | } |
849 | 847 | ||
850 | static struct device_driver serial_pxa_driver = { | 848 | static struct platform_driver serial_pxa_driver = { |
851 | .name = "pxa2xx-uart", | ||
852 | .bus = &platform_bus_type, | ||
853 | .probe = serial_pxa_probe, | 849 | .probe = serial_pxa_probe, |
854 | .remove = serial_pxa_remove, | 850 | .remove = serial_pxa_remove, |
855 | 851 | ||
856 | .suspend = serial_pxa_suspend, | 852 | .suspend = serial_pxa_suspend, |
857 | .resume = serial_pxa_resume, | 853 | .resume = serial_pxa_resume, |
854 | .driver = { | ||
855 | .name = "pxa2xx-uart", | ||
856 | }, | ||
858 | }; | 857 | }; |
859 | 858 | ||
860 | int __init serial_pxa_init(void) | 859 | int __init serial_pxa_init(void) |
@@ -865,7 +864,7 @@ int __init serial_pxa_init(void) | |||
865 | if (ret != 0) | 864 | if (ret != 0) |
866 | return ret; | 865 | return ret; |
867 | 866 | ||
868 | ret = driver_register(&serial_pxa_driver); | 867 | ret = platform_driver_register(&serial_pxa_driver); |
869 | if (ret != 0) | 868 | if (ret != 0) |
870 | uart_unregister_driver(&serial_pxa_reg); | 869 | uart_unregister_driver(&serial_pxa_reg); |
871 | 870 | ||
@@ -874,7 +873,7 @@ int __init serial_pxa_init(void) | |||
874 | 873 | ||
875 | void __exit serial_pxa_exit(void) | 874 | void __exit serial_pxa_exit(void) |
876 | { | 875 | { |
877 | driver_unregister(&serial_pxa_driver); | 876 | platform_driver_unregister(&serial_pxa_driver); |
878 | uart_unregister_driver(&serial_pxa_reg); | 877 | uart_unregister_driver(&serial_pxa_reg); |
879 | } | 878 | } |
880 | 879 | ||
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index 036792328d49..47681c4654e4 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c | |||
@@ -1092,14 +1092,13 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, | |||
1092 | 1092 | ||
1093 | static int probe_index = 0; | 1093 | static int probe_index = 0; |
1094 | 1094 | ||
1095 | static int s3c24xx_serial_probe(struct device *_dev, | 1095 | static int s3c24xx_serial_probe(struct platform_device *dev, |
1096 | struct s3c24xx_uart_info *info) | 1096 | struct s3c24xx_uart_info *info) |
1097 | { | 1097 | { |
1098 | struct s3c24xx_uart_port *ourport; | 1098 | struct s3c24xx_uart_port *ourport; |
1099 | struct platform_device *dev = to_platform_device(_dev); | ||
1100 | int ret; | 1099 | int ret; |
1101 | 1100 | ||
1102 | dbg("s3c24xx_serial_probe(%p, %p) %d\n", _dev, info, probe_index); | 1101 | dbg("s3c24xx_serial_probe(%p, %p) %d\n", dev, info, probe_index); |
1103 | 1102 | ||
1104 | ourport = &s3c24xx_serial_ports[probe_index]; | 1103 | ourport = &s3c24xx_serial_ports[probe_index]; |
1105 | probe_index++; | 1104 | probe_index++; |
@@ -1112,7 +1111,7 @@ static int s3c24xx_serial_probe(struct device *_dev, | |||
1112 | 1111 | ||
1113 | dbg("%s: adding port\n", __FUNCTION__); | 1112 | dbg("%s: adding port\n", __FUNCTION__); |
1114 | uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); | 1113 | uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); |
1115 | dev_set_drvdata(_dev, &ourport->port); | 1114 | platform_set_drvdata(dev, &ourport->port); |
1116 | 1115 | ||
1117 | return 0; | 1116 | return 0; |
1118 | 1117 | ||
@@ -1120,9 +1119,9 @@ static int s3c24xx_serial_probe(struct device *_dev, | |||
1120 | return ret; | 1119 | return ret; |
1121 | } | 1120 | } |
1122 | 1121 | ||
1123 | static int s3c24xx_serial_remove(struct device *_dev) | 1122 | static int s3c24xx_serial_remove(struct platform_device *dev) |
1124 | { | 1123 | { |
1125 | struct uart_port *port = s3c24xx_dev_to_port(_dev); | 1124 | struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); |
1126 | 1125 | ||
1127 | if (port) | 1126 | if (port) |
1128 | uart_remove_one_port(&s3c24xx_uart_drv, port); | 1127 | uart_remove_one_port(&s3c24xx_uart_drv, port); |
@@ -1134,9 +1133,9 @@ static int s3c24xx_serial_remove(struct device *_dev) | |||
1134 | 1133 | ||
1135 | #ifdef CONFIG_PM | 1134 | #ifdef CONFIG_PM |
1136 | 1135 | ||
1137 | static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state) | 1136 | static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t state) |
1138 | { | 1137 | { |
1139 | struct uart_port *port = s3c24xx_dev_to_port(dev); | 1138 | struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); |
1140 | 1139 | ||
1141 | if (port) | 1140 | if (port) |
1142 | uart_suspend_port(&s3c24xx_uart_drv, port); | 1141 | uart_suspend_port(&s3c24xx_uart_drv, port); |
@@ -1144,9 +1143,9 @@ static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state) | |||
1144 | return 0; | 1143 | return 0; |
1145 | } | 1144 | } |
1146 | 1145 | ||
1147 | static int s3c24xx_serial_resume(struct device *dev) | 1146 | static int s3c24xx_serial_resume(struct platform_device *dev) |
1148 | { | 1147 | { |
1149 | struct uart_port *port = s3c24xx_dev_to_port(dev); | 1148 | struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); |
1150 | struct s3c24xx_uart_port *ourport = to_ourport(port); | 1149 | struct s3c24xx_uart_port *ourport = to_ourport(port); |
1151 | 1150 | ||
1152 | if (port) { | 1151 | if (port) { |
@@ -1165,11 +1164,11 @@ static int s3c24xx_serial_resume(struct device *dev) | |||
1165 | #define s3c24xx_serial_resume NULL | 1164 | #define s3c24xx_serial_resume NULL |
1166 | #endif | 1165 | #endif |
1167 | 1166 | ||
1168 | static int s3c24xx_serial_init(struct device_driver *drv, | 1167 | static int s3c24xx_serial_init(struct platform_driver *drv, |
1169 | struct s3c24xx_uart_info *info) | 1168 | struct s3c24xx_uart_info *info) |
1170 | { | 1169 | { |
1171 | dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); | 1170 | dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); |
1172 | return driver_register(drv); | 1171 | return platform_driver_register(drv); |
1173 | } | 1172 | } |
1174 | 1173 | ||
1175 | 1174 | ||
@@ -1228,19 +1227,20 @@ static struct s3c24xx_uart_info s3c2400_uart_inf = { | |||
1228 | .reset_port = s3c2400_serial_resetport, | 1227 | .reset_port = s3c2400_serial_resetport, |
1229 | }; | 1228 | }; |
1230 | 1229 | ||
1231 | static int s3c2400_serial_probe(struct device *dev) | 1230 | static int s3c2400_serial_probe(struct platform_device *dev) |
1232 | { | 1231 | { |
1233 | return s3c24xx_serial_probe(dev, &s3c2400_uart_inf); | 1232 | return s3c24xx_serial_probe(dev, &s3c2400_uart_inf); |
1234 | } | 1233 | } |
1235 | 1234 | ||
1236 | static struct device_driver s3c2400_serial_drv = { | 1235 | static struct platform_driver s3c2400_serial_drv = { |
1237 | .name = "s3c2400-uart", | ||
1238 | .owner = THIS_MODULE, | ||
1239 | .bus = &platform_bus_type, | ||
1240 | .probe = s3c2400_serial_probe, | 1236 | .probe = s3c2400_serial_probe, |
1241 | .remove = s3c24xx_serial_remove, | 1237 | .remove = s3c24xx_serial_remove, |
1242 | .suspend = s3c24xx_serial_suspend, | 1238 | .suspend = s3c24xx_serial_suspend, |
1243 | .resume = s3c24xx_serial_resume, | 1239 | .resume = s3c24xx_serial_resume, |
1240 | .driver = { | ||
1241 | .name = "s3c2400-uart", | ||
1242 | .owner = THIS_MODULE, | ||
1243 | }, | ||
1244 | }; | 1244 | }; |
1245 | 1245 | ||
1246 | static inline int s3c2400_serial_init(void) | 1246 | static inline int s3c2400_serial_init(void) |
@@ -1250,7 +1250,7 @@ static inline int s3c2400_serial_init(void) | |||
1250 | 1250 | ||
1251 | static inline void s3c2400_serial_exit(void) | 1251 | static inline void s3c2400_serial_exit(void) |
1252 | { | 1252 | { |
1253 | driver_unregister(&s3c2400_serial_drv); | 1253 | platform_driver_unregister(&s3c2400_serial_drv); |
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | #define s3c2400_uart_inf_at &s3c2400_uart_inf | 1256 | #define s3c2400_uart_inf_at &s3c2400_uart_inf |
@@ -1332,19 +1332,20 @@ static struct s3c24xx_uart_info s3c2410_uart_inf = { | |||
1332 | 1332 | ||
1333 | /* device management */ | 1333 | /* device management */ |
1334 | 1334 | ||
1335 | static int s3c2410_serial_probe(struct device *dev) | 1335 | static int s3c2410_serial_probe(struct platform_device *dev) |
1336 | { | 1336 | { |
1337 | return s3c24xx_serial_probe(dev, &s3c2410_uart_inf); | 1337 | return s3c24xx_serial_probe(dev, &s3c2410_uart_inf); |
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | static struct device_driver s3c2410_serial_drv = { | 1340 | static struct platform_driver s3c2410_serial_drv = { |
1341 | .name = "s3c2410-uart", | ||
1342 | .owner = THIS_MODULE, | ||
1343 | .bus = &platform_bus_type, | ||
1344 | .probe = s3c2410_serial_probe, | 1341 | .probe = s3c2410_serial_probe, |
1345 | .remove = s3c24xx_serial_remove, | 1342 | .remove = s3c24xx_serial_remove, |
1346 | .suspend = s3c24xx_serial_suspend, | 1343 | .suspend = s3c24xx_serial_suspend, |
1347 | .resume = s3c24xx_serial_resume, | 1344 | .resume = s3c24xx_serial_resume, |
1345 | .driver = { | ||
1346 | .name = "s3c2410-uart", | ||
1347 | .owner = THIS_MODULE, | ||
1348 | }, | ||
1348 | }; | 1349 | }; |
1349 | 1350 | ||
1350 | static inline int s3c2410_serial_init(void) | 1351 | static inline int s3c2410_serial_init(void) |
@@ -1354,7 +1355,7 @@ static inline int s3c2410_serial_init(void) | |||
1354 | 1355 | ||
1355 | static inline void s3c2410_serial_exit(void) | 1356 | static inline void s3c2410_serial_exit(void) |
1356 | { | 1357 | { |
1357 | driver_unregister(&s3c2410_serial_drv); | 1358 | platform_driver_unregister(&s3c2410_serial_drv); |
1358 | } | 1359 | } |
1359 | 1360 | ||
1360 | #define s3c2410_uart_inf_at &s3c2410_uart_inf | 1361 | #define s3c2410_uart_inf_at &s3c2410_uart_inf |
@@ -1493,20 +1494,21 @@ static struct s3c24xx_uart_info s3c2440_uart_inf = { | |||
1493 | 1494 | ||
1494 | /* device management */ | 1495 | /* device management */ |
1495 | 1496 | ||
1496 | static int s3c2440_serial_probe(struct device *dev) | 1497 | static int s3c2440_serial_probe(struct platform_device *dev) |
1497 | { | 1498 | { |
1498 | dbg("s3c2440_serial_probe: dev=%p\n", dev); | 1499 | dbg("s3c2440_serial_probe: dev=%p\n", dev); |
1499 | return s3c24xx_serial_probe(dev, &s3c2440_uart_inf); | 1500 | return s3c24xx_serial_probe(dev, &s3c2440_uart_inf); |
1500 | } | 1501 | } |
1501 | 1502 | ||
1502 | static struct device_driver s3c2440_serial_drv = { | 1503 | static struct platform_driver s3c2440_serial_drv = { |
1503 | .name = "s3c2440-uart", | ||
1504 | .owner = THIS_MODULE, | ||
1505 | .bus = &platform_bus_type, | ||
1506 | .probe = s3c2440_serial_probe, | 1504 | .probe = s3c2440_serial_probe, |
1507 | .remove = s3c24xx_serial_remove, | 1505 | .remove = s3c24xx_serial_remove, |
1508 | .suspend = s3c24xx_serial_suspend, | 1506 | .suspend = s3c24xx_serial_suspend, |
1509 | .resume = s3c24xx_serial_resume, | 1507 | .resume = s3c24xx_serial_resume, |
1508 | .driver = { | ||
1509 | .name = "s3c2440-uart", | ||
1510 | .owner = THIS_MODULE, | ||
1511 | }, | ||
1510 | }; | 1512 | }; |
1511 | 1513 | ||
1512 | 1514 | ||
@@ -1517,7 +1519,7 @@ static inline int s3c2440_serial_init(void) | |||
1517 | 1519 | ||
1518 | static inline void s3c2440_serial_exit(void) | 1520 | static inline void s3c2440_serial_exit(void) |
1519 | { | 1521 | { |
1520 | driver_unregister(&s3c2440_serial_drv); | 1522 | platform_driver_unregister(&s3c2440_serial_drv); |
1521 | } | 1523 | } |
1522 | 1524 | ||
1523 | #define s3c2440_uart_inf_at &s3c2440_uart_inf | 1525 | #define s3c2440_uart_inf_at &s3c2440_uart_inf |
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c index ed618cc7ae96..fd9deee20e05 100644 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c | |||
@@ -834,9 +834,9 @@ static struct uart_driver sa1100_reg = { | |||
834 | .cons = SA1100_CONSOLE, | 834 | .cons = SA1100_CONSOLE, |
835 | }; | 835 | }; |
836 | 836 | ||
837 | static int sa1100_serial_suspend(struct device *_dev, pm_message_t state) | 837 | static int sa1100_serial_suspend(struct platform_device *dev, pm_message_t state) |
838 | { | 838 | { |
839 | struct sa1100_port *sport = dev_get_drvdata(_dev); | 839 | struct sa1100_port *sport = platform_get_drvdata(dev); |
840 | 840 | ||
841 | if (sport) | 841 | if (sport) |
842 | uart_suspend_port(&sa1100_reg, &sport->port); | 842 | uart_suspend_port(&sa1100_reg, &sport->port); |
@@ -844,9 +844,9 @@ static int sa1100_serial_suspend(struct device *_dev, pm_message_t state) | |||
844 | return 0; | 844 | return 0; |
845 | } | 845 | } |
846 | 846 | ||
847 | static int sa1100_serial_resume(struct device *_dev) | 847 | static int sa1100_serial_resume(struct platform_device *dev) |
848 | { | 848 | { |
849 | struct sa1100_port *sport = dev_get_drvdata(_dev); | 849 | struct sa1100_port *sport = platform_get_drvdata(dev); |
850 | 850 | ||
851 | if (sport) | 851 | if (sport) |
852 | uart_resume_port(&sa1100_reg, &sport->port); | 852 | uart_resume_port(&sa1100_reg, &sport->port); |
@@ -854,9 +854,8 @@ static int sa1100_serial_resume(struct device *_dev) | |||
854 | return 0; | 854 | return 0; |
855 | } | 855 | } |
856 | 856 | ||
857 | static int sa1100_serial_probe(struct device *_dev) | 857 | static int sa1100_serial_probe(struct platform_device *dev) |
858 | { | 858 | { |
859 | struct platform_device *dev = to_platform_device(_dev); | ||
860 | struct resource *res = dev->resource; | 859 | struct resource *res = dev->resource; |
861 | int i; | 860 | int i; |
862 | 861 | ||
@@ -869,9 +868,9 @@ static int sa1100_serial_probe(struct device *_dev) | |||
869 | if (sa1100_ports[i].port.mapbase != res->start) | 868 | if (sa1100_ports[i].port.mapbase != res->start) |
870 | continue; | 869 | continue; |
871 | 870 | ||
872 | sa1100_ports[i].port.dev = _dev; | 871 | sa1100_ports[i].port.dev = &dev->dev; |
873 | uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port); | 872 | uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port); |
874 | dev_set_drvdata(_dev, &sa1100_ports[i]); | 873 | platform_set_drvdata(dev, &sa1100_ports[i]); |
875 | break; | 874 | break; |
876 | } | 875 | } |
877 | } | 876 | } |
@@ -879,11 +878,11 @@ static int sa1100_serial_probe(struct device *_dev) | |||
879 | return 0; | 878 | return 0; |
880 | } | 879 | } |
881 | 880 | ||
882 | static int sa1100_serial_remove(struct device *_dev) | 881 | static int sa1100_serial_remove(struct platform_device *pdev) |
883 | { | 882 | { |
884 | struct sa1100_port *sport = dev_get_drvdata(_dev); | 883 | struct sa1100_port *sport = platform_get_drvdata(pdev); |
885 | 884 | ||
886 | dev_set_drvdata(_dev, NULL); | 885 | platform_set_drvdata(pdev, NULL); |
887 | 886 | ||
888 | if (sport) | 887 | if (sport) |
889 | uart_remove_one_port(&sa1100_reg, &sport->port); | 888 | uart_remove_one_port(&sa1100_reg, &sport->port); |
@@ -891,13 +890,14 @@ static int sa1100_serial_remove(struct device *_dev) | |||
891 | return 0; | 890 | return 0; |
892 | } | 891 | } |
893 | 892 | ||
894 | static struct device_driver sa11x0_serial_driver = { | 893 | static struct platform_driver sa11x0_serial_driver = { |
895 | .name = "sa11x0-uart", | ||
896 | .bus = &platform_bus_type, | ||
897 | .probe = sa1100_serial_probe, | 894 | .probe = sa1100_serial_probe, |
898 | .remove = sa1100_serial_remove, | 895 | .remove = sa1100_serial_remove, |
899 | .suspend = sa1100_serial_suspend, | 896 | .suspend = sa1100_serial_suspend, |
900 | .resume = sa1100_serial_resume, | 897 | .resume = sa1100_serial_resume, |
898 | .driver = { | ||
899 | .name = "sa11x0-uart", | ||
900 | }, | ||
901 | }; | 901 | }; |
902 | 902 | ||
903 | static int __init sa1100_serial_init(void) | 903 | static int __init sa1100_serial_init(void) |
@@ -910,7 +910,7 @@ static int __init sa1100_serial_init(void) | |||
910 | 910 | ||
911 | ret = uart_register_driver(&sa1100_reg); | 911 | ret = uart_register_driver(&sa1100_reg); |
912 | if (ret == 0) { | 912 | if (ret == 0) { |
913 | ret = driver_register(&sa11x0_serial_driver); | 913 | ret = platform_driver_register(&sa11x0_serial_driver); |
914 | if (ret) | 914 | if (ret) |
915 | uart_unregister_driver(&sa1100_reg); | 915 | uart_unregister_driver(&sa1100_reg); |
916 | } | 916 | } |
@@ -919,7 +919,7 @@ static int __init sa1100_serial_init(void) | |||
919 | 919 | ||
920 | static void __exit sa1100_serial_exit(void) | 920 | static void __exit sa1100_serial_exit(void) |
921 | { | 921 | { |
922 | driver_unregister(&sa11x0_serial_driver); | 922 | platform_driver_unregister(&sa11x0_serial_driver); |
923 | uart_unregister_driver(&sa1100_reg); | 923 | uart_unregister_driver(&sa1100_reg); |
924 | } | 924 | } |
925 | 925 | ||
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c index 01696b3e3f61..865d4dea65df 100644 --- a/drivers/serial/vr41xx_siu.c +++ b/drivers/serial/vr41xx_siu.c | |||
@@ -924,7 +924,7 @@ static struct uart_driver siu_uart_driver = { | |||
924 | .cons = SERIAL_VR41XX_CONSOLE, | 924 | .cons = SERIAL_VR41XX_CONSOLE, |
925 | }; | 925 | }; |
926 | 926 | ||
927 | static int siu_probe(struct device *dev) | 927 | static int siu_probe(struct platform_device *dev) |
928 | { | 928 | { |
929 | struct uart_port *port; | 929 | struct uart_port *port; |
930 | int num, i, retval; | 930 | int num, i, retval; |
@@ -941,7 +941,7 @@ static int siu_probe(struct device *dev) | |||
941 | for (i = 0; i < num; i++) { | 941 | for (i = 0; i < num; i++) { |
942 | port = &siu_uart_ports[i]; | 942 | port = &siu_uart_ports[i]; |
943 | port->ops = &siu_uart_ops; | 943 | port->ops = &siu_uart_ops; |
944 | port->dev = dev; | 944 | port->dev = &dev->dev; |
945 | 945 | ||
946 | retval = uart_add_one_port(&siu_uart_driver, port); | 946 | retval = uart_add_one_port(&siu_uart_driver, port); |
947 | if (retval < 0) { | 947 | if (retval < 0) { |
@@ -958,14 +958,14 @@ static int siu_probe(struct device *dev) | |||
958 | return 0; | 958 | return 0; |
959 | } | 959 | } |
960 | 960 | ||
961 | static int siu_remove(struct device *dev) | 961 | static int siu_remove(struct platform_device *dev) |
962 | { | 962 | { |
963 | struct uart_port *port; | 963 | struct uart_port *port; |
964 | int i; | 964 | int i; |
965 | 965 | ||
966 | for (i = 0; i < siu_uart_driver.nr; i++) { | 966 | for (i = 0; i < siu_uart_driver.nr; i++) { |
967 | port = &siu_uart_ports[i]; | 967 | port = &siu_uart_ports[i]; |
968 | if (port->dev == dev) { | 968 | if (port->dev == &dev->dev) { |
969 | uart_remove_one_port(&siu_uart_driver, port); | 969 | uart_remove_one_port(&siu_uart_driver, port); |
970 | port->dev = NULL; | 970 | port->dev = NULL; |
971 | } | 971 | } |
@@ -976,7 +976,7 @@ static int siu_remove(struct device *dev) | |||
976 | return 0; | 976 | return 0; |
977 | } | 977 | } |
978 | 978 | ||
979 | static int siu_suspend(struct device *dev, pm_message_t state) | 979 | static int siu_suspend(struct platform_device *dev, pm_message_t state) |
980 | { | 980 | { |
981 | struct uart_port *port; | 981 | struct uart_port *port; |
982 | int i; | 982 | int i; |
@@ -984,7 +984,7 @@ static int siu_suspend(struct device *dev, pm_message_t state) | |||
984 | for (i = 0; i < siu_uart_driver.nr; i++) { | 984 | for (i = 0; i < siu_uart_driver.nr; i++) { |
985 | port = &siu_uart_ports[i]; | 985 | port = &siu_uart_ports[i]; |
986 | if ((port->type == PORT_VR41XX_SIU || | 986 | if ((port->type == PORT_VR41XX_SIU || |
987 | port->type == PORT_VR41XX_DSIU) && port->dev == dev) | 987 | port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev) |
988 | uart_suspend_port(&siu_uart_driver, port); | 988 | uart_suspend_port(&siu_uart_driver, port); |
989 | 989 | ||
990 | } | 990 | } |
@@ -992,7 +992,7 @@ static int siu_suspend(struct device *dev, pm_message_t state) | |||
992 | return 0; | 992 | return 0; |
993 | } | 993 | } |
994 | 994 | ||
995 | static int siu_resume(struct device *dev) | 995 | static int siu_resume(struct platform_device *dev) |
996 | { | 996 | { |
997 | struct uart_port *port; | 997 | struct uart_port *port; |
998 | int i; | 998 | int i; |
@@ -1000,7 +1000,7 @@ static int siu_resume(struct device *dev) | |||
1000 | for (i = 0; i < siu_uart_driver.nr; i++) { | 1000 | for (i = 0; i < siu_uart_driver.nr; i++) { |
1001 | port = &siu_uart_ports[i]; | 1001 | port = &siu_uart_ports[i]; |
1002 | if ((port->type == PORT_VR41XX_SIU || | 1002 | if ((port->type == PORT_VR41XX_SIU || |
1003 | port->type == PORT_VR41XX_DSIU) && port->dev == dev) | 1003 | port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev) |
1004 | uart_resume_port(&siu_uart_driver, port); | 1004 | uart_resume_port(&siu_uart_driver, port); |
1005 | } | 1005 | } |
1006 | 1006 | ||
@@ -1009,13 +1009,14 @@ static int siu_resume(struct device *dev) | |||
1009 | 1009 | ||
1010 | static struct platform_device *siu_platform_device; | 1010 | static struct platform_device *siu_platform_device; |
1011 | 1011 | ||
1012 | static struct device_driver siu_device_driver = { | 1012 | static struct platform_driver siu_device_driver = { |
1013 | .name = "SIU", | ||
1014 | .bus = &platform_bus_type, | ||
1015 | .probe = siu_probe, | 1013 | .probe = siu_probe, |
1016 | .remove = siu_remove, | 1014 | .remove = siu_remove, |
1017 | .suspend = siu_suspend, | 1015 | .suspend = siu_suspend, |
1018 | .resume = siu_resume, | 1016 | .resume = siu_resume, |
1017 | .driver = { | ||
1018 | .name = "SIU", | ||
1019 | }, | ||
1019 | }; | 1020 | }; |
1020 | 1021 | ||
1021 | static int __devinit vr41xx_siu_init(void) | 1022 | static int __devinit vr41xx_siu_init(void) |
@@ -1026,7 +1027,7 @@ static int __devinit vr41xx_siu_init(void) | |||
1026 | if (IS_ERR(siu_platform_device)) | 1027 | if (IS_ERR(siu_platform_device)) |
1027 | return PTR_ERR(siu_platform_device); | 1028 | return PTR_ERR(siu_platform_device); |
1028 | 1029 | ||
1029 | retval = driver_register(&siu_device_driver); | 1030 | retval = platform_driver_register(&siu_device_driver); |
1030 | if (retval < 0) | 1031 | if (retval < 0) |
1031 | platform_device_unregister(siu_platform_device); | 1032 | platform_device_unregister(siu_platform_device); |
1032 | 1033 | ||
@@ -1035,7 +1036,7 @@ static int __devinit vr41xx_siu_init(void) | |||
1035 | 1036 | ||
1036 | static void __devexit vr41xx_siu_exit(void) | 1037 | static void __devexit vr41xx_siu_exit(void) |
1037 | { | 1038 | { |
1038 | driver_unregister(&siu_device_driver); | 1039 | platform_driver_unregister(&siu_device_driver); |
1039 | 1040 | ||
1040 | platform_device_unregister(siu_platform_device); | 1041 | platform_device_unregister(siu_platform_device); |
1041 | } | 1042 | } |
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 904519085334..1e407745c115 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -896,7 +896,7 @@ dummy_gadget_release (struct device *dev) | |||
896 | #endif | 896 | #endif |
897 | } | 897 | } |
898 | 898 | ||
899 | static int dummy_udc_probe (struct device *dev) | 899 | static int dummy_udc_probe (struct platform_device *dev) |
900 | { | 900 | { |
901 | struct dummy *dum = the_controller; | 901 | struct dummy *dum = the_controller; |
902 | int rc; | 902 | int rc; |
@@ -909,7 +909,7 @@ static int dummy_udc_probe (struct device *dev) | |||
909 | dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0); | 909 | dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0); |
910 | 910 | ||
911 | strcpy (dum->gadget.dev.bus_id, "gadget"); | 911 | strcpy (dum->gadget.dev.bus_id, "gadget"); |
912 | dum->gadget.dev.parent = dev; | 912 | dum->gadget.dev.parent = &dev->dev; |
913 | dum->gadget.dev.release = dummy_gadget_release; | 913 | dum->gadget.dev.release = dummy_gadget_release; |
914 | rc = device_register (&dum->gadget.dev); | 914 | rc = device_register (&dum->gadget.dev); |
915 | if (rc < 0) | 915 | if (rc < 0) |
@@ -919,26 +919,26 @@ static int dummy_udc_probe (struct device *dev) | |||
919 | usb_bus_get (&dummy_to_hcd (dum)->self); | 919 | usb_bus_get (&dummy_to_hcd (dum)->self); |
920 | #endif | 920 | #endif |
921 | 921 | ||
922 | dev_set_drvdata (dev, dum); | 922 | platform_set_drvdata (dev, dum); |
923 | device_create_file (&dum->gadget.dev, &dev_attr_function); | 923 | device_create_file (&dum->gadget.dev, &dev_attr_function); |
924 | return rc; | 924 | return rc; |
925 | } | 925 | } |
926 | 926 | ||
927 | static int dummy_udc_remove (struct device *dev) | 927 | static int dummy_udc_remove (struct platform_device *dev) |
928 | { | 928 | { |
929 | struct dummy *dum = dev_get_drvdata (dev); | 929 | struct dummy *dum = platform_get_drvdata (dev); |
930 | 930 | ||
931 | dev_set_drvdata (dev, NULL); | 931 | platform_set_drvdata (dev, NULL); |
932 | device_remove_file (&dum->gadget.dev, &dev_attr_function); | 932 | device_remove_file (&dum->gadget.dev, &dev_attr_function); |
933 | device_unregister (&dum->gadget.dev); | 933 | device_unregister (&dum->gadget.dev); |
934 | return 0; | 934 | return 0; |
935 | } | 935 | } |
936 | 936 | ||
937 | static int dummy_udc_suspend (struct device *dev, pm_message_t state) | 937 | static int dummy_udc_suspend (struct platform_device *dev, pm_message_t state) |
938 | { | 938 | { |
939 | struct dummy *dum = dev_get_drvdata(dev); | 939 | struct dummy *dum = platform_get_drvdata(dev); |
940 | 940 | ||
941 | dev_dbg (dev, "%s\n", __FUNCTION__); | 941 | dev_dbg (&dev->dev, "%s\n", __FUNCTION__); |
942 | spin_lock_irq (&dum->lock); | 942 | spin_lock_irq (&dum->lock); |
943 | dum->udc_suspended = 1; | 943 | dum->udc_suspended = 1; |
944 | set_link_state (dum); | 944 | set_link_state (dum); |
@@ -949,29 +949,30 @@ static int dummy_udc_suspend (struct device *dev, pm_message_t state) | |||
949 | return 0; | 949 | return 0; |
950 | } | 950 | } |
951 | 951 | ||
952 | static int dummy_udc_resume (struct device *dev) | 952 | static int dummy_udc_resume (struct platform_device *dev) |
953 | { | 953 | { |
954 | struct dummy *dum = dev_get_drvdata(dev); | 954 | struct dummy *dum = platform_get_drvdata(dev); |
955 | 955 | ||
956 | dev_dbg (dev, "%s\n", __FUNCTION__); | 956 | dev_dbg (&dev->dev, "%s\n", __FUNCTION__); |
957 | spin_lock_irq (&dum->lock); | 957 | spin_lock_irq (&dum->lock); |
958 | dum->udc_suspended = 0; | 958 | dum->udc_suspended = 0; |
959 | set_link_state (dum); | 959 | set_link_state (dum); |
960 | spin_unlock_irq (&dum->lock); | 960 | spin_unlock_irq (&dum->lock); |
961 | 961 | ||
962 | dev->power.power_state = PMSG_ON; | 962 | dev->dev.power.power_state = PMSG_ON; |
963 | usb_hcd_poll_rh_status (dummy_to_hcd (dum)); | 963 | usb_hcd_poll_rh_status (dummy_to_hcd (dum)); |
964 | return 0; | 964 | return 0; |
965 | } | 965 | } |
966 | 966 | ||
967 | static struct device_driver dummy_udc_driver = { | 967 | static struct platform_driver dummy_udc_driver = { |
968 | .name = (char *) gadget_name, | ||
969 | .owner = THIS_MODULE, | ||
970 | .bus = &platform_bus_type, | ||
971 | .probe = dummy_udc_probe, | 968 | .probe = dummy_udc_probe, |
972 | .remove = dummy_udc_remove, | 969 | .remove = dummy_udc_remove, |
973 | .suspend = dummy_udc_suspend, | 970 | .suspend = dummy_udc_suspend, |
974 | .resume = dummy_udc_resume, | 971 | .resume = dummy_udc_resume, |
972 | .driver = { | ||
973 | .name = (char *) gadget_name, | ||
974 | .owner = THIS_MODULE, | ||
975 | }, | ||
975 | }; | 976 | }; |
976 | 977 | ||
977 | /*-------------------------------------------------------------------------*/ | 978 | /*-------------------------------------------------------------------------*/ |
@@ -1898,14 +1899,14 @@ static const struct hc_driver dummy_hcd = { | |||
1898 | .bus_resume = dummy_bus_resume, | 1899 | .bus_resume = dummy_bus_resume, |
1899 | }; | 1900 | }; |
1900 | 1901 | ||
1901 | static int dummy_hcd_probe (struct device *dev) | 1902 | static int dummy_hcd_probe (struct platform_device *dev) |
1902 | { | 1903 | { |
1903 | struct usb_hcd *hcd; | 1904 | struct usb_hcd *hcd; |
1904 | int retval; | 1905 | int retval; |
1905 | 1906 | ||
1906 | dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); | 1907 | dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); |
1907 | 1908 | ||
1908 | hcd = usb_create_hcd (&dummy_hcd, dev, dev->bus_id); | 1909 | hcd = usb_create_hcd (&dummy_hcd, &dev->dev, dev->dev.bus_id); |
1909 | if (!hcd) | 1910 | if (!hcd) |
1910 | return -ENOMEM; | 1911 | return -ENOMEM; |
1911 | the_controller = hcd_to_dummy (hcd); | 1912 | the_controller = hcd_to_dummy (hcd); |
@@ -1918,48 +1919,49 @@ static int dummy_hcd_probe (struct device *dev) | |||
1918 | return retval; | 1919 | return retval; |
1919 | } | 1920 | } |
1920 | 1921 | ||
1921 | static int dummy_hcd_remove (struct device *dev) | 1922 | static int dummy_hcd_remove (struct platform_device *dev) |
1922 | { | 1923 | { |
1923 | struct usb_hcd *hcd; | 1924 | struct usb_hcd *hcd; |
1924 | 1925 | ||
1925 | hcd = dev_get_drvdata (dev); | 1926 | hcd = platform_get_drvdata (dev); |
1926 | usb_remove_hcd (hcd); | 1927 | usb_remove_hcd (hcd); |
1927 | usb_put_hcd (hcd); | 1928 | usb_put_hcd (hcd); |
1928 | the_controller = NULL; | 1929 | the_controller = NULL; |
1929 | return 0; | 1930 | return 0; |
1930 | } | 1931 | } |
1931 | 1932 | ||
1932 | static int dummy_hcd_suspend (struct device *dev, pm_message_t state) | 1933 | static int dummy_hcd_suspend (struct platform_device *dev, pm_message_t state) |
1933 | { | 1934 | { |
1934 | struct usb_hcd *hcd; | 1935 | struct usb_hcd *hcd; |
1935 | 1936 | ||
1936 | dev_dbg (dev, "%s\n", __FUNCTION__); | 1937 | dev_dbg (&dev->dev, "%s\n", __FUNCTION__); |
1937 | hcd = dev_get_drvdata (dev); | 1938 | hcd = platform_get_drvdata (dev); |
1938 | 1939 | ||
1939 | hcd->state = HC_STATE_SUSPENDED; | 1940 | hcd->state = HC_STATE_SUSPENDED; |
1940 | return 0; | 1941 | return 0; |
1941 | } | 1942 | } |
1942 | 1943 | ||
1943 | static int dummy_hcd_resume (struct device *dev) | 1944 | static int dummy_hcd_resume (struct platform_device *dev) |
1944 | { | 1945 | { |
1945 | struct usb_hcd *hcd; | 1946 | struct usb_hcd *hcd; |
1946 | 1947 | ||
1947 | dev_dbg (dev, "%s\n", __FUNCTION__); | 1948 | dev_dbg (&dev->dev, "%s\n", __FUNCTION__); |
1948 | hcd = dev_get_drvdata (dev); | 1949 | hcd = platform_get_drvdata (dev); |
1949 | hcd->state = HC_STATE_RUNNING; | 1950 | hcd->state = HC_STATE_RUNNING; |
1950 | 1951 | ||
1951 | usb_hcd_poll_rh_status (hcd); | 1952 | usb_hcd_poll_rh_status (hcd); |
1952 | return 0; | 1953 | return 0; |
1953 | } | 1954 | } |
1954 | 1955 | ||
1955 | static struct device_driver dummy_hcd_driver = { | 1956 | static struct platform_driver dummy_hcd_driver = { |
1956 | .name = (char *) driver_name, | ||
1957 | .owner = THIS_MODULE, | ||
1958 | .bus = &platform_bus_type, | ||
1959 | .probe = dummy_hcd_probe, | 1957 | .probe = dummy_hcd_probe, |
1960 | .remove = dummy_hcd_remove, | 1958 | .remove = dummy_hcd_remove, |
1961 | .suspend = dummy_hcd_suspend, | 1959 | .suspend = dummy_hcd_suspend, |
1962 | .resume = dummy_hcd_resume, | 1960 | .resume = dummy_hcd_resume, |
1961 | .driver = { | ||
1962 | .name = (char *) driver_name, | ||
1963 | .owner = THIS_MODULE, | ||
1964 | }, | ||
1963 | }; | 1965 | }; |
1964 | 1966 | ||
1965 | /*-------------------------------------------------------------------------*/ | 1967 | /*-------------------------------------------------------------------------*/ |
@@ -1995,11 +1997,11 @@ static int __init init (void) | |||
1995 | if (usb_disabled ()) | 1997 | if (usb_disabled ()) |
1996 | return -ENODEV; | 1998 | return -ENODEV; |
1997 | 1999 | ||
1998 | retval = driver_register (&dummy_hcd_driver); | 2000 | retval = platform_driver_register (&dummy_hcd_driver); |
1999 | if (retval < 0) | 2001 | if (retval < 0) |
2000 | return retval; | 2002 | return retval; |
2001 | 2003 | ||
2002 | retval = driver_register (&dummy_udc_driver); | 2004 | retval = platform_driver_register (&dummy_udc_driver); |
2003 | if (retval < 0) | 2005 | if (retval < 0) |
2004 | goto err_register_udc_driver; | 2006 | goto err_register_udc_driver; |
2005 | 2007 | ||
@@ -2015,9 +2017,9 @@ static int __init init (void) | |||
2015 | err_register_udc: | 2017 | err_register_udc: |
2016 | platform_device_unregister (&the_hcd_pdev); | 2018 | platform_device_unregister (&the_hcd_pdev); |
2017 | err_register_hcd: | 2019 | err_register_hcd: |
2018 | driver_unregister (&dummy_udc_driver); | 2020 | platform_driver_unregister (&dummy_udc_driver); |
2019 | err_register_udc_driver: | 2021 | err_register_udc_driver: |
2020 | driver_unregister (&dummy_hcd_driver); | 2022 | platform_driver_unregister (&dummy_hcd_driver); |
2021 | return retval; | 2023 | return retval; |
2022 | } | 2024 | } |
2023 | module_init (init); | 2025 | module_init (init); |
@@ -2026,7 +2028,7 @@ static void __exit cleanup (void) | |||
2026 | { | 2028 | { |
2027 | platform_device_unregister (&the_udc_pdev); | 2029 | platform_device_unregister (&the_udc_pdev); |
2028 | platform_device_unregister (&the_hcd_pdev); | 2030 | platform_device_unregister (&the_hcd_pdev); |
2029 | driver_unregister (&dummy_udc_driver); | 2031 | platform_driver_unregister (&dummy_udc_driver); |
2030 | driver_unregister (&dummy_hcd_driver); | 2032 | platform_driver_unregister (&dummy_hcd_driver); |
2031 | } | 2033 | } |
2032 | module_exit (cleanup); | 2034 | module_exit (cleanup); |
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index 654469778ab5..b0f3cd63e3b9 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c | |||
@@ -1970,7 +1970,6 @@ MODULE_DEVICE_TABLE (pci, pci_ids); | |||
1970 | static struct pci_driver goku_pci_driver = { | 1970 | static struct pci_driver goku_pci_driver = { |
1971 | .name = (char *) driver_name, | 1971 | .name = (char *) driver_name, |
1972 | .id_table = pci_ids, | 1972 | .id_table = pci_ids, |
1973 | .owner = THIS_MODULE, | ||
1974 | 1973 | ||
1975 | .probe = goku_probe, | 1974 | .probe = goku_probe, |
1976 | .remove = goku_remove, | 1975 | .remove = goku_remove, |
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c index bc6269f10cbb..e02fea5a5433 100644 --- a/drivers/usb/gadget/lh7a40x_udc.c +++ b/drivers/usb/gadget/lh7a40x_udc.c | |||
@@ -2085,21 +2085,21 @@ static struct lh7a40x_udc memory = { | |||
2085 | /* | 2085 | /* |
2086 | * probe - binds to the platform device | 2086 | * probe - binds to the platform device |
2087 | */ | 2087 | */ |
2088 | static int lh7a40x_udc_probe(struct device *_dev) | 2088 | static int lh7a40x_udc_probe(struct platform_device *pdev) |
2089 | { | 2089 | { |
2090 | struct lh7a40x_udc *dev = &memory; | 2090 | struct lh7a40x_udc *dev = &memory; |
2091 | int retval; | 2091 | int retval; |
2092 | 2092 | ||
2093 | DEBUG("%s: %p\n", __FUNCTION__, _dev); | 2093 | DEBUG("%s: %p\n", __FUNCTION__, pdev); |
2094 | 2094 | ||
2095 | spin_lock_init(&dev->lock); | 2095 | spin_lock_init(&dev->lock); |
2096 | dev->dev = _dev; | 2096 | dev->dev = &pdev->dev; |
2097 | 2097 | ||
2098 | device_initialize(&dev->gadget.dev); | 2098 | device_initialize(&dev->gadget.dev); |
2099 | dev->gadget.dev.parent = _dev; | 2099 | dev->gadget.dev.parent = &pdev->dev; |
2100 | 2100 | ||
2101 | the_controller = dev; | 2101 | the_controller = dev; |
2102 | dev_set_drvdata(_dev, dev); | 2102 | platform_set_drvdata(pdev, dev); |
2103 | 2103 | ||
2104 | udc_disable(dev); | 2104 | udc_disable(dev); |
2105 | udc_reinit(dev); | 2105 | udc_reinit(dev); |
@@ -2119,11 +2119,11 @@ static int lh7a40x_udc_probe(struct device *_dev) | |||
2119 | return retval; | 2119 | return retval; |
2120 | } | 2120 | } |
2121 | 2121 | ||
2122 | static int lh7a40x_udc_remove(struct device *_dev) | 2122 | static int lh7a40x_udc_remove(struct platform_device *pdev) |
2123 | { | 2123 | { |
2124 | struct lh7a40x_udc *dev = _dev->driver_data; | 2124 | struct lh7a40x_udc *dev = platform_get_drvdata(pdev); |
2125 | 2125 | ||
2126 | DEBUG("%s: %p\n", __FUNCTION__, dev); | 2126 | DEBUG("%s: %p\n", __FUNCTION__, pdev); |
2127 | 2127 | ||
2128 | udc_disable(dev); | 2128 | udc_disable(dev); |
2129 | remove_proc_files(); | 2129 | remove_proc_files(); |
@@ -2131,7 +2131,7 @@ static int lh7a40x_udc_remove(struct device *_dev) | |||
2131 | 2131 | ||
2132 | free_irq(IRQ_USBINTR, dev); | 2132 | free_irq(IRQ_USBINTR, dev); |
2133 | 2133 | ||
2134 | dev_set_drvdata(_dev, 0); | 2134 | platform_set_drvdata(pdev, 0); |
2135 | 2135 | ||
2136 | the_controller = 0; | 2136 | the_controller = 0; |
2137 | 2137 | ||
@@ -2140,26 +2140,27 @@ static int lh7a40x_udc_remove(struct device *_dev) | |||
2140 | 2140 | ||
2141 | /*-------------------------------------------------------------------------*/ | 2141 | /*-------------------------------------------------------------------------*/ |
2142 | 2142 | ||
2143 | static struct device_driver udc_driver = { | 2143 | static struct platform_driver udc_driver = { |
2144 | .name = (char *)driver_name, | ||
2145 | .owner = THIS_MODULE, | ||
2146 | .bus = &platform_bus_type, | ||
2147 | .probe = lh7a40x_udc_probe, | 2144 | .probe = lh7a40x_udc_probe, |
2148 | .remove = lh7a40x_udc_remove | 2145 | .remove = lh7a40x_udc_remove |
2149 | /* FIXME power management support */ | 2146 | /* FIXME power management support */ |
2150 | /* .suspend = ... disable UDC */ | 2147 | /* .suspend = ... disable UDC */ |
2151 | /* .resume = ... re-enable UDC */ | 2148 | /* .resume = ... re-enable UDC */ |
2149 | .driver = { | ||
2150 | .name = (char *)driver_name, | ||
2151 | .owner = THIS_MODULE, | ||
2152 | }, | ||
2152 | }; | 2153 | }; |
2153 | 2154 | ||
2154 | static int __init udc_init(void) | 2155 | static int __init udc_init(void) |
2155 | { | 2156 | { |
2156 | DEBUG("%s: %s version %s\n", __FUNCTION__, driver_name, DRIVER_VERSION); | 2157 | DEBUG("%s: %s version %s\n", __FUNCTION__, driver_name, DRIVER_VERSION); |
2157 | return driver_register(&udc_driver); | 2158 | return platform_driver_register(&udc_driver); |
2158 | } | 2159 | } |
2159 | 2160 | ||
2160 | static void __exit udc_exit(void) | 2161 | static void __exit udc_exit(void) |
2161 | { | 2162 | { |
2162 | driver_unregister(&udc_driver); | 2163 | platform_driver_unregister(&udc_driver); |
2163 | } | 2164 | } |
2164 | 2165 | ||
2165 | module_init(udc_init); | 2166 | module_init(udc_init); |
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 0dc6bb00bf72..c32e1f7476da 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -2948,7 +2948,6 @@ MODULE_DEVICE_TABLE (pci, pci_ids); | |||
2948 | static struct pci_driver net2280_pci_driver = { | 2948 | static struct pci_driver net2280_pci_driver = { |
2949 | .name = (char *) driver_name, | 2949 | .name = (char *) driver_name, |
2950 | .id_table = pci_ids, | 2950 | .id_table = pci_ids, |
2951 | .owner = THIS_MODULE, | ||
2952 | 2951 | ||
2953 | .probe = net2280_probe, | 2952 | .probe = net2280_probe, |
2954 | .remove = net2280_remove, | 2953 | .remove = net2280_remove, |
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 387692a3611e..a8972d7c97be 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -2707,18 +2707,17 @@ omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv) | |||
2707 | return 0; | 2707 | return 0; |
2708 | } | 2708 | } |
2709 | 2709 | ||
2710 | static int __init omap_udc_probe(struct device *dev) | 2710 | static int __init omap_udc_probe(struct platform_device *pdev) |
2711 | { | 2711 | { |
2712 | struct platform_device *odev = to_platform_device(dev); | ||
2713 | int status = -ENODEV; | 2712 | int status = -ENODEV; |
2714 | int hmc; | 2713 | int hmc; |
2715 | struct otg_transceiver *xceiv = NULL; | 2714 | struct otg_transceiver *xceiv = NULL; |
2716 | const char *type = NULL; | 2715 | const char *type = NULL; |
2717 | struct omap_usb_config *config = dev->platform_data; | 2716 | struct omap_usb_config *config = pdev->dev.platform_data; |
2718 | 2717 | ||
2719 | /* NOTE: "knows" the order of the resources! */ | 2718 | /* NOTE: "knows" the order of the resources! */ |
2720 | if (!request_mem_region(odev->resource[0].start, | 2719 | if (!request_mem_region(pdev->resource[0].start, |
2721 | odev->resource[0].end - odev->resource[0].start + 1, | 2720 | pdev->resource[0].end - pdev->resource[0].start + 1, |
2722 | driver_name)) { | 2721 | driver_name)) { |
2723 | DBG("request_mem_region failed\n"); | 2722 | DBG("request_mem_region failed\n"); |
2724 | return -EBUSY; | 2723 | return -EBUSY; |
@@ -2803,7 +2802,7 @@ bad_on_1710: | |||
2803 | INFO("hmc mode %d, %s transceiver\n", hmc, type); | 2802 | INFO("hmc mode %d, %s transceiver\n", hmc, type); |
2804 | 2803 | ||
2805 | /* a "gadget" abstracts/virtualizes the controller */ | 2804 | /* a "gadget" abstracts/virtualizes the controller */ |
2806 | status = omap_udc_setup(odev, xceiv); | 2805 | status = omap_udc_setup(pdev, xceiv); |
2807 | if (status) { | 2806 | if (status) { |
2808 | goto cleanup0; | 2807 | goto cleanup0; |
2809 | } | 2808 | } |
@@ -2821,28 +2820,28 @@ bad_on_1710: | |||
2821 | udc->clr_halt = UDC_RESET_EP; | 2820 | udc->clr_halt = UDC_RESET_EP; |
2822 | 2821 | ||
2823 | /* USB general purpose IRQ: ep0, state changes, dma, etc */ | 2822 | /* USB general purpose IRQ: ep0, state changes, dma, etc */ |
2824 | status = request_irq(odev->resource[1].start, omap_udc_irq, | 2823 | status = request_irq(pdev->resource[1].start, omap_udc_irq, |
2825 | SA_SAMPLE_RANDOM, driver_name, udc); | 2824 | SA_SAMPLE_RANDOM, driver_name, udc); |
2826 | if (status != 0) { | 2825 | if (status != 0) { |
2827 | ERR( "can't get irq %ld, err %d\n", | 2826 | ERR( "can't get irq %ld, err %d\n", |
2828 | odev->resource[1].start, status); | 2827 | pdev->resource[1].start, status); |
2829 | goto cleanup1; | 2828 | goto cleanup1; |
2830 | } | 2829 | } |
2831 | 2830 | ||
2832 | /* USB "non-iso" IRQ (PIO for all but ep0) */ | 2831 | /* USB "non-iso" IRQ (PIO for all but ep0) */ |
2833 | status = request_irq(odev->resource[2].start, omap_udc_pio_irq, | 2832 | status = request_irq(pdev->resource[2].start, omap_udc_pio_irq, |
2834 | SA_SAMPLE_RANDOM, "omap_udc pio", udc); | 2833 | SA_SAMPLE_RANDOM, "omap_udc pio", udc); |
2835 | if (status != 0) { | 2834 | if (status != 0) { |
2836 | ERR( "can't get irq %ld, err %d\n", | 2835 | ERR( "can't get irq %ld, err %d\n", |
2837 | odev->resource[2].start, status); | 2836 | pdev->resource[2].start, status); |
2838 | goto cleanup2; | 2837 | goto cleanup2; |
2839 | } | 2838 | } |
2840 | #ifdef USE_ISO | 2839 | #ifdef USE_ISO |
2841 | status = request_irq(odev->resource[3].start, omap_udc_iso_irq, | 2840 | status = request_irq(pdev->resource[3].start, omap_udc_iso_irq, |
2842 | SA_INTERRUPT, "omap_udc iso", udc); | 2841 | SA_INTERRUPT, "omap_udc iso", udc); |
2843 | if (status != 0) { | 2842 | if (status != 0) { |
2844 | ERR("can't get irq %ld, err %d\n", | 2843 | ERR("can't get irq %ld, err %d\n", |
2845 | odev->resource[3].start, status); | 2844 | pdev->resource[3].start, status); |
2846 | goto cleanup3; | 2845 | goto cleanup3; |
2847 | } | 2846 | } |
2848 | #endif | 2847 | #endif |
@@ -2853,11 +2852,11 @@ bad_on_1710: | |||
2853 | 2852 | ||
2854 | #ifdef USE_ISO | 2853 | #ifdef USE_ISO |
2855 | cleanup3: | 2854 | cleanup3: |
2856 | free_irq(odev->resource[2].start, udc); | 2855 | free_irq(pdev->resource[2].start, udc); |
2857 | #endif | 2856 | #endif |
2858 | 2857 | ||
2859 | cleanup2: | 2858 | cleanup2: |
2860 | free_irq(odev->resource[1].start, udc); | 2859 | free_irq(pdev->resource[1].start, udc); |
2861 | 2860 | ||
2862 | cleanup1: | 2861 | cleanup1: |
2863 | kfree (udc); | 2862 | kfree (udc); |
@@ -2866,14 +2865,13 @@ cleanup1: | |||
2866 | cleanup0: | 2865 | cleanup0: |
2867 | if (xceiv) | 2866 | if (xceiv) |
2868 | put_device(xceiv->dev); | 2867 | put_device(xceiv->dev); |
2869 | release_mem_region(odev->resource[0].start, | 2868 | release_mem_region(pdev->resource[0].start, |
2870 | odev->resource[0].end - odev->resource[0].start + 1); | 2869 | pdev->resource[0].end - pdev->resource[0].start + 1); |
2871 | return status; | 2870 | return status; |
2872 | } | 2871 | } |
2873 | 2872 | ||
2874 | static int __exit omap_udc_remove(struct device *dev) | 2873 | static int __exit omap_udc_remove(struct platform_device *pdev) |
2875 | { | 2874 | { |
2876 | struct platform_device *odev = to_platform_device(dev); | ||
2877 | DECLARE_COMPLETION(done); | 2875 | DECLARE_COMPLETION(done); |
2878 | 2876 | ||
2879 | if (!udc) | 2877 | if (!udc) |
@@ -2891,13 +2889,13 @@ static int __exit omap_udc_remove(struct device *dev) | |||
2891 | remove_proc_file(); | 2889 | remove_proc_file(); |
2892 | 2890 | ||
2893 | #ifdef USE_ISO | 2891 | #ifdef USE_ISO |
2894 | free_irq(odev->resource[3].start, udc); | 2892 | free_irq(pdev->resource[3].start, udc); |
2895 | #endif | 2893 | #endif |
2896 | free_irq(odev->resource[2].start, udc); | 2894 | free_irq(pdev->resource[2].start, udc); |
2897 | free_irq(odev->resource[1].start, udc); | 2895 | free_irq(pdev->resource[1].start, udc); |
2898 | 2896 | ||
2899 | release_mem_region(odev->resource[0].start, | 2897 | release_mem_region(pdev->resource[0].start, |
2900 | odev->resource[0].end - odev->resource[0].start + 1); | 2898 | pdev->resource[0].end - pdev->resource[0].start + 1); |
2901 | 2899 | ||
2902 | device_unregister(&udc->gadget.dev); | 2900 | device_unregister(&udc->gadget.dev); |
2903 | wait_for_completion(&done); | 2901 | wait_for_completion(&done); |
@@ -2915,7 +2913,7 @@ static int __exit omap_udc_remove(struct device *dev) | |||
2915 | * may involve talking to an external transceiver (e.g. isp1301). | 2913 | * may involve talking to an external transceiver (e.g. isp1301). |
2916 | */ | 2914 | */ |
2917 | 2915 | ||
2918 | static int omap_udc_suspend(struct device *dev, pm_message_t message) | 2916 | static int omap_udc_suspend(struct platform_device *dev, pm_message_t message) |
2919 | { | 2917 | { |
2920 | u32 devstat; | 2918 | u32 devstat; |
2921 | 2919 | ||
@@ -2935,7 +2933,7 @@ static int omap_udc_suspend(struct device *dev, pm_message_t message) | |||
2935 | return 0; | 2933 | return 0; |
2936 | } | 2934 | } |
2937 | 2935 | ||
2938 | static int omap_udc_resume(struct device *dev) | 2936 | static int omap_udc_resume(struct platform_device *dev) |
2939 | { | 2937 | { |
2940 | DBG("resume + wakeup/SRP\n"); | 2938 | DBG("resume + wakeup/SRP\n"); |
2941 | omap_pullup(&udc->gadget, 1); | 2939 | omap_pullup(&udc->gadget, 1); |
@@ -2947,14 +2945,15 @@ static int omap_udc_resume(struct device *dev) | |||
2947 | 2945 | ||
2948 | /*-------------------------------------------------------------------------*/ | 2946 | /*-------------------------------------------------------------------------*/ |
2949 | 2947 | ||
2950 | static struct device_driver udc_driver = { | 2948 | static struct platform_driver udc_driver = { |
2951 | .name = (char *) driver_name, | ||
2952 | .owner = THIS_MODULE, | ||
2953 | .bus = &platform_bus_type, | ||
2954 | .probe = omap_udc_probe, | 2949 | .probe = omap_udc_probe, |
2955 | .remove = __exit_p(omap_udc_remove), | 2950 | .remove = __exit_p(omap_udc_remove), |
2956 | .suspend = omap_udc_suspend, | 2951 | .suspend = omap_udc_suspend, |
2957 | .resume = omap_udc_resume, | 2952 | .resume = omap_udc_resume, |
2953 | .driver = { | ||
2954 | .owner = THIS_MODULE, | ||
2955 | .name = (char *) driver_name, | ||
2956 | }, | ||
2958 | }; | 2957 | }; |
2959 | 2958 | ||
2960 | static int __init udc_init(void) | 2959 | static int __init udc_init(void) |
@@ -2965,13 +2964,13 @@ static int __init udc_init(void) | |||
2965 | #endif | 2964 | #endif |
2966 | "%s\n", driver_desc, | 2965 | "%s\n", driver_desc, |
2967 | use_dma ? " (dma)" : ""); | 2966 | use_dma ? " (dma)" : ""); |
2968 | return driver_register(&udc_driver); | 2967 | return platform_driver_register(&udc_driver); |
2969 | } | 2968 | } |
2970 | module_init(udc_init); | 2969 | module_init(udc_init); |
2971 | 2970 | ||
2972 | static void __exit udc_exit(void) | 2971 | static void __exit udc_exit(void) |
2973 | { | 2972 | { |
2974 | driver_unregister(&udc_driver); | 2973 | platform_driver_unregister(&udc_driver); |
2975 | } | 2974 | } |
2976 | module_exit(udc_exit); | 2975 | module_exit(udc_exit); |
2977 | 2976 | ||
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 510d28a924db..bb028c5b8952 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -2432,7 +2432,7 @@ static struct pxa2xx_udc memory = { | |||
2432 | /* | 2432 | /* |
2433 | * probe - binds to the platform device | 2433 | * probe - binds to the platform device |
2434 | */ | 2434 | */ |
2435 | static int __init pxa2xx_udc_probe(struct device *_dev) | 2435 | static int __init pxa2xx_udc_probe(struct platform_device *pdev) |
2436 | { | 2436 | { |
2437 | struct pxa2xx_udc *dev = &memory; | 2437 | struct pxa2xx_udc *dev = &memory; |
2438 | int retval, out_dma = 1; | 2438 | int retval, out_dma = 1; |
@@ -2495,19 +2495,19 @@ static int __init pxa2xx_udc_probe(struct device *_dev) | |||
2495 | #endif | 2495 | #endif |
2496 | 2496 | ||
2497 | /* other non-static parts of init */ | 2497 | /* other non-static parts of init */ |
2498 | dev->dev = _dev; | 2498 | dev->dev = &pdev->dev; |
2499 | dev->mach = _dev->platform_data; | 2499 | dev->mach = pdev->dev.platform_data; |
2500 | 2500 | ||
2501 | init_timer(&dev->timer); | 2501 | init_timer(&dev->timer); |
2502 | dev->timer.function = udc_watchdog; | 2502 | dev->timer.function = udc_watchdog; |
2503 | dev->timer.data = (unsigned long) dev; | 2503 | dev->timer.data = (unsigned long) dev; |
2504 | 2504 | ||
2505 | device_initialize(&dev->gadget.dev); | 2505 | device_initialize(&dev->gadget.dev); |
2506 | dev->gadget.dev.parent = _dev; | 2506 | dev->gadget.dev.parent = &pdev->dev; |
2507 | dev->gadget.dev.dma_mask = _dev->dma_mask; | 2507 | dev->gadget.dev.dma_mask = pdev->dev.dma_mask; |
2508 | 2508 | ||
2509 | the_controller = dev; | 2509 | the_controller = dev; |
2510 | dev_set_drvdata(_dev, dev); | 2510 | platform_set_drvdata(pdev, dev); |
2511 | 2511 | ||
2512 | udc_disable(dev); | 2512 | udc_disable(dev); |
2513 | udc_reinit(dev); | 2513 | udc_reinit(dev); |
@@ -2559,14 +2559,14 @@ lubbock_fail0: | |||
2559 | return 0; | 2559 | return 0; |
2560 | } | 2560 | } |
2561 | 2561 | ||
2562 | static void pxa2xx_udc_shutdown(struct device *_dev) | 2562 | static void pxa2xx_udc_shutdown(struct platform_device *_dev) |
2563 | { | 2563 | { |
2564 | pullup_off(); | 2564 | pullup_off(); |
2565 | } | 2565 | } |
2566 | 2566 | ||
2567 | static int __exit pxa2xx_udc_remove(struct device *_dev) | 2567 | static int __exit pxa2xx_udc_remove(struct platform_device *pdev) |
2568 | { | 2568 | { |
2569 | struct pxa2xx_udc *dev = dev_get_drvdata(_dev); | 2569 | struct pxa2xx_udc *dev = platform_get_drvdata(pdev); |
2570 | 2570 | ||
2571 | udc_disable(dev); | 2571 | udc_disable(dev); |
2572 | remove_proc_files(); | 2572 | remove_proc_files(); |
@@ -2580,7 +2580,7 @@ static int __exit pxa2xx_udc_remove(struct device *_dev) | |||
2580 | free_irq(LUBBOCK_USB_DISC_IRQ, dev); | 2580 | free_irq(LUBBOCK_USB_DISC_IRQ, dev); |
2581 | free_irq(LUBBOCK_USB_IRQ, dev); | 2581 | free_irq(LUBBOCK_USB_IRQ, dev); |
2582 | } | 2582 | } |
2583 | dev_set_drvdata(_dev, NULL); | 2583 | platform_set_drvdata(pdev, NULL); |
2584 | the_controller = NULL; | 2584 | the_controller = NULL; |
2585 | return 0; | 2585 | return 0; |
2586 | } | 2586 | } |
@@ -2601,9 +2601,9 @@ static int __exit pxa2xx_udc_remove(struct device *_dev) | |||
2601 | * VBUS IRQs should probably be ignored so that the PXA device just acts | 2601 | * VBUS IRQs should probably be ignored so that the PXA device just acts |
2602 | * "dead" to USB hosts until system resume. | 2602 | * "dead" to USB hosts until system resume. |
2603 | */ | 2603 | */ |
2604 | static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state) | 2604 | static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) |
2605 | { | 2605 | { |
2606 | struct pxa2xx_udc *udc = dev_get_drvdata(dev); | 2606 | struct pxa2xx_udc *udc = platform_get_drvdata(dev); |
2607 | 2607 | ||
2608 | if (!udc->mach->udc_command) | 2608 | if (!udc->mach->udc_command) |
2609 | WARN("USB host won't detect disconnect!\n"); | 2609 | WARN("USB host won't detect disconnect!\n"); |
@@ -2612,9 +2612,9 @@ static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state) | |||
2612 | return 0; | 2612 | return 0; |
2613 | } | 2613 | } |
2614 | 2614 | ||
2615 | static int pxa2xx_udc_resume(struct device *dev) | 2615 | static int pxa2xx_udc_resume(struct platform_device *dev) |
2616 | { | 2616 | { |
2617 | struct pxa2xx_udc *udc = dev_get_drvdata(dev); | 2617 | struct pxa2xx_udc *udc = platform_get_drvdata(dev); |
2618 | 2618 | ||
2619 | pullup(udc, 1); | 2619 | pullup(udc, 1); |
2620 | 2620 | ||
@@ -2628,27 +2628,28 @@ static int pxa2xx_udc_resume(struct device *dev) | |||
2628 | 2628 | ||
2629 | /*-------------------------------------------------------------------------*/ | 2629 | /*-------------------------------------------------------------------------*/ |
2630 | 2630 | ||
2631 | static struct device_driver udc_driver = { | 2631 | static struct platform_driver udc_driver = { |
2632 | .name = "pxa2xx-udc", | ||
2633 | .owner = THIS_MODULE, | ||
2634 | .bus = &platform_bus_type, | ||
2635 | .probe = pxa2xx_udc_probe, | 2632 | .probe = pxa2xx_udc_probe, |
2636 | .shutdown = pxa2xx_udc_shutdown, | 2633 | .shutdown = pxa2xx_udc_shutdown, |
2637 | .remove = __exit_p(pxa2xx_udc_remove), | 2634 | .remove = __exit_p(pxa2xx_udc_remove), |
2638 | .suspend = pxa2xx_udc_suspend, | 2635 | .suspend = pxa2xx_udc_suspend, |
2639 | .resume = pxa2xx_udc_resume, | 2636 | .resume = pxa2xx_udc_resume, |
2637 | .driver = { | ||
2638 | .owner = THIS_MODULE, | ||
2639 | .name = "pxa2xx-udc", | ||
2640 | }, | ||
2640 | }; | 2641 | }; |
2641 | 2642 | ||
2642 | static int __init udc_init(void) | 2643 | static int __init udc_init(void) |
2643 | { | 2644 | { |
2644 | printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION); | 2645 | printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION); |
2645 | return driver_register(&udc_driver); | 2646 | return platform_driver_register(&udc_driver); |
2646 | } | 2647 | } |
2647 | module_init(udc_init); | 2648 | module_init(udc_init); |
2648 | 2649 | ||
2649 | static void __exit udc_exit(void) | 2650 | static void __exit udc_exit(void) |
2650 | { | 2651 | { |
2651 | driver_unregister(&udc_driver); | 2652 | platform_driver_unregister(&udc_driver); |
2652 | } | 2653 | } |
2653 | module_exit(udc_exit); | 2654 | module_exit(udc_exit); |
2654 | 2655 | ||
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 145008853966..dfd9bd0b1828 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -383,7 +383,6 @@ MODULE_DEVICE_TABLE (pci, pci_ids); | |||
383 | static struct pci_driver ehci_pci_driver = { | 383 | static struct pci_driver ehci_pci_driver = { |
384 | .name = (char *) hcd_name, | 384 | .name = (char *) hcd_name, |
385 | .id_table = pci_ids, | 385 | .id_table = pci_ids, |
386 | .owner = THIS_MODULE, | ||
387 | 386 | ||
388 | .probe = usb_hcd_pci_probe, | 387 | .probe = usb_hcd_pci_probe, |
389 | .remove = usb_hcd_pci_remove, | 388 | .remove = usb_hcd_pci_remove, |
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index f9c3f5b8dd1c..82f64986bc22 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c | |||
@@ -1633,17 +1633,15 @@ static struct hc_driver isp116x_hc_driver = { | |||
1633 | 1633 | ||
1634 | /*----------------------------------------------------------------*/ | 1634 | /*----------------------------------------------------------------*/ |
1635 | 1635 | ||
1636 | static int __init_or_module isp116x_remove(struct device *dev) | 1636 | static int __init_or_module isp116x_remove(struct platform_device *pdev) |
1637 | { | 1637 | { |
1638 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 1638 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
1639 | struct isp116x *isp116x; | 1639 | struct isp116x *isp116x; |
1640 | struct platform_device *pdev; | ||
1641 | struct resource *res; | 1640 | struct resource *res; |
1642 | 1641 | ||
1643 | if (!hcd) | 1642 | if (!hcd) |
1644 | return 0; | 1643 | return 0; |
1645 | isp116x = hcd_to_isp116x(hcd); | 1644 | isp116x = hcd_to_isp116x(hcd); |
1646 | pdev = container_of(dev, struct platform_device, dev); | ||
1647 | remove_debug_file(isp116x); | 1645 | remove_debug_file(isp116x); |
1648 | usb_remove_hcd(hcd); | 1646 | usb_remove_hcd(hcd); |
1649 | 1647 | ||
@@ -1660,18 +1658,16 @@ static int __init_or_module isp116x_remove(struct device *dev) | |||
1660 | 1658 | ||
1661 | #define resource_len(r) (((r)->end - (r)->start) + 1) | 1659 | #define resource_len(r) (((r)->end - (r)->start) + 1) |
1662 | 1660 | ||
1663 | static int __init isp116x_probe(struct device *dev) | 1661 | static int __init isp116x_probe(struct platform_device *pdev) |
1664 | { | 1662 | { |
1665 | struct usb_hcd *hcd; | 1663 | struct usb_hcd *hcd; |
1666 | struct isp116x *isp116x; | 1664 | struct isp116x *isp116x; |
1667 | struct platform_device *pdev; | ||
1668 | struct resource *addr, *data; | 1665 | struct resource *addr, *data; |
1669 | void __iomem *addr_reg; | 1666 | void __iomem *addr_reg; |
1670 | void __iomem *data_reg; | 1667 | void __iomem *data_reg; |
1671 | int irq; | 1668 | int irq; |
1672 | int ret = 0; | 1669 | int ret = 0; |
1673 | 1670 | ||
1674 | pdev = container_of(dev, struct platform_device, dev); | ||
1675 | if (pdev->num_resources < 3) { | 1671 | if (pdev->num_resources < 3) { |
1676 | ret = -ENODEV; | 1672 | ret = -ENODEV; |
1677 | goto err1; | 1673 | goto err1; |
@@ -1685,7 +1681,7 @@ static int __init isp116x_probe(struct device *dev) | |||
1685 | goto err1; | 1681 | goto err1; |
1686 | } | 1682 | } |
1687 | 1683 | ||
1688 | if (dev->dma_mask) { | 1684 | if (pdev->dev.dma_mask) { |
1689 | DBG("DMA not supported\n"); | 1685 | DBG("DMA not supported\n"); |
1690 | ret = -EINVAL; | 1686 | ret = -EINVAL; |
1691 | goto err1; | 1687 | goto err1; |
@@ -1711,7 +1707,7 @@ static int __init isp116x_probe(struct device *dev) | |||
1711 | } | 1707 | } |
1712 | 1708 | ||
1713 | /* allocate and initialize hcd */ | 1709 | /* allocate and initialize hcd */ |
1714 | hcd = usb_create_hcd(&isp116x_hc_driver, dev, dev->bus_id); | 1710 | hcd = usb_create_hcd(&isp116x_hc_driver, &pdev->dev, pdev->dev.bus_id); |
1715 | if (!hcd) { | 1711 | if (!hcd) { |
1716 | ret = -ENOMEM; | 1712 | ret = -ENOMEM; |
1717 | goto err5; | 1713 | goto err5; |
@@ -1723,7 +1719,7 @@ static int __init isp116x_probe(struct device *dev) | |||
1723 | isp116x->addr_reg = addr_reg; | 1719 | isp116x->addr_reg = addr_reg; |
1724 | spin_lock_init(&isp116x->lock); | 1720 | spin_lock_init(&isp116x->lock); |
1725 | INIT_LIST_HEAD(&isp116x->async); | 1721 | INIT_LIST_HEAD(&isp116x->async); |
1726 | isp116x->board = dev->platform_data; | 1722 | isp116x->board = pdev->dev.platform_data; |
1727 | 1723 | ||
1728 | if (!isp116x->board) { | 1724 | if (!isp116x->board) { |
1729 | ERR("Platform data structure not initialized\n"); | 1725 | ERR("Platform data structure not initialized\n"); |
@@ -1764,13 +1760,13 @@ static int __init isp116x_probe(struct device *dev) | |||
1764 | /* | 1760 | /* |
1765 | Suspend of platform device | 1761 | Suspend of platform device |
1766 | */ | 1762 | */ |
1767 | static int isp116x_suspend(struct device *dev, pm_message_t state) | 1763 | static int isp116x_suspend(struct platform_device *dev, pm_message_t state) |
1768 | { | 1764 | { |
1769 | int ret = 0; | 1765 | int ret = 0; |
1770 | 1766 | ||
1771 | VDBG("%s: state %x\n", __func__, state); | 1767 | VDBG("%s: state %x\n", __func__, state); |
1772 | 1768 | ||
1773 | dev->power.power_state = state; | 1769 | dev->dev.power.power_state = state; |
1774 | 1770 | ||
1775 | return ret; | 1771 | return ret; |
1776 | } | 1772 | } |
@@ -1778,13 +1774,13 @@ static int isp116x_suspend(struct device *dev, pm_message_t state) | |||
1778 | /* | 1774 | /* |
1779 | Resume platform device | 1775 | Resume platform device |
1780 | */ | 1776 | */ |
1781 | static int isp116x_resume(struct device *dev) | 1777 | static int isp116x_resume(struct platform_device *dev) |
1782 | { | 1778 | { |
1783 | int ret = 0; | 1779 | int ret = 0; |
1784 | 1780 | ||
1785 | VDBG("%s: state %x\n", __func__, dev->power.power_state); | 1781 | VDBG("%s: state %x\n", __func__, dev->dev.power.power_state); |
1786 | 1782 | ||
1787 | dev->power.power_state = PMSG_ON; | 1783 | dev->dev.power.power_state = PMSG_ON; |
1788 | 1784 | ||
1789 | return ret; | 1785 | return ret; |
1790 | } | 1786 | } |
@@ -1796,13 +1792,14 @@ static int isp116x_resume(struct device *dev) | |||
1796 | 1792 | ||
1797 | #endif | 1793 | #endif |
1798 | 1794 | ||
1799 | static struct device_driver isp116x_driver = { | 1795 | static struct platform_driver isp116x_driver = { |
1800 | .name = (char *)hcd_name, | ||
1801 | .bus = &platform_bus_type, | ||
1802 | .probe = isp116x_probe, | 1796 | .probe = isp116x_probe, |
1803 | .remove = isp116x_remove, | 1797 | .remove = isp116x_remove, |
1804 | .suspend = isp116x_suspend, | 1798 | .suspend = isp116x_suspend, |
1805 | .resume = isp116x_resume, | 1799 | .resume = isp116x_resume, |
1800 | .driver = { | ||
1801 | .name = (char *)hcd_name, | ||
1802 | }, | ||
1806 | }; | 1803 | }; |
1807 | 1804 | ||
1808 | /*-----------------------------------------------------------------*/ | 1805 | /*-----------------------------------------------------------------*/ |
@@ -1813,14 +1810,14 @@ static int __init isp116x_init(void) | |||
1813 | return -ENODEV; | 1810 | return -ENODEV; |
1814 | 1811 | ||
1815 | INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); | 1812 | INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); |
1816 | return driver_register(&isp116x_driver); | 1813 | return platform_driver_register(&isp116x_driver); |
1817 | } | 1814 | } |
1818 | 1815 | ||
1819 | module_init(isp116x_init); | 1816 | module_init(isp116x_init); |
1820 | 1817 | ||
1821 | static void __exit isp116x_cleanup(void) | 1818 | static void __exit isp116x_cleanup(void) |
1822 | { | 1819 | { |
1823 | driver_unregister(&isp116x_driver); | 1820 | platform_driver_unregister(&isp116x_driver); |
1824 | } | 1821 | } |
1825 | 1822 | ||
1826 | module_exit(isp116x_cleanup); | 1823 | module_exit(isp116x_cleanup); |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index f0c78cf14b6c..d9cf3b327d96 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -225,9 +225,8 @@ static const struct hc_driver ohci_au1xxx_hc_driver = { | |||
225 | 225 | ||
226 | /*-------------------------------------------------------------------------*/ | 226 | /*-------------------------------------------------------------------------*/ |
227 | 227 | ||
228 | static int ohci_hcd_au1xxx_drv_probe(struct device *dev) | 228 | static int ohci_hcd_au1xxx_drv_probe(struct platform_device *pdev) |
229 | { | 229 | { |
230 | struct platform_device *pdev = to_platform_device(dev); | ||
231 | int ret; | 230 | int ret; |
232 | 231 | ||
233 | pr_debug ("In ohci_hcd_au1xxx_drv_probe"); | 232 | pr_debug ("In ohci_hcd_au1xxx_drv_probe"); |
@@ -239,39 +238,37 @@ static int ohci_hcd_au1xxx_drv_probe(struct device *dev) | |||
239 | return ret; | 238 | return ret; |
240 | } | 239 | } |
241 | 240 | ||
242 | static int ohci_hcd_au1xxx_drv_remove(struct device *dev) | 241 | static int ohci_hcd_au1xxx_drv_remove(struct platform_device *pdev) |
243 | { | 242 | { |
244 | struct platform_device *pdev = to_platform_device(dev); | 243 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
245 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
246 | 244 | ||
247 | usb_hcd_au1xxx_remove(hcd, pdev); | 245 | usb_hcd_au1xxx_remove(hcd, pdev); |
248 | return 0; | 246 | return 0; |
249 | } | 247 | } |
250 | /*TBD*/ | 248 | /*TBD*/ |
251 | /*static int ohci_hcd_au1xxx_drv_suspend(struct device *dev) | 249 | /*static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *dev) |
252 | { | 250 | { |
253 | struct platform_device *pdev = to_platform_device(dev); | 251 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
254 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
255 | 252 | ||
256 | return 0; | 253 | return 0; |
257 | } | 254 | } |
258 | static int ohci_hcd_au1xxx_drv_resume(struct device *dev) | 255 | static int ohci_hcd_au1xxx_drv_resume(struct platform_device *dev) |
259 | { | 256 | { |
260 | struct platform_device *pdev = to_platform_device(dev); | 257 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
261 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
262 | 258 | ||
263 | return 0; | 259 | return 0; |
264 | } | 260 | } |
265 | */ | 261 | */ |
266 | 262 | ||
267 | static struct device_driver ohci_hcd_au1xxx_driver = { | 263 | static struct platform_driver ohci_hcd_au1xxx_driver = { |
268 | .name = "au1xxx-ohci", | ||
269 | .owner = THIS_MODULE, | ||
270 | .bus = &platform_bus_type, | ||
271 | .probe = ohci_hcd_au1xxx_drv_probe, | 264 | .probe = ohci_hcd_au1xxx_drv_probe, |
272 | .remove = ohci_hcd_au1xxx_drv_remove, | 265 | .remove = ohci_hcd_au1xxx_drv_remove, |
273 | /*.suspend = ohci_hcd_au1xxx_drv_suspend, */ | 266 | /*.suspend = ohci_hcd_au1xxx_drv_suspend, */ |
274 | /*.resume = ohci_hcd_au1xxx_drv_resume, */ | 267 | /*.resume = ohci_hcd_au1xxx_drv_resume, */ |
268 | .driver = { | ||
269 | .name = "au1xxx-ohci", | ||
270 | .owner = THIS_MODULE, | ||
271 | }, | ||
275 | }; | 272 | }; |
276 | 273 | ||
277 | static int __init ohci_hcd_au1xxx_init (void) | 274 | static int __init ohci_hcd_au1xxx_init (void) |
@@ -280,12 +277,12 @@ static int __init ohci_hcd_au1xxx_init (void) | |||
280 | pr_debug ("block sizes: ed %d td %d\n", | 277 | pr_debug ("block sizes: ed %d td %d\n", |
281 | sizeof (struct ed), sizeof (struct td)); | 278 | sizeof (struct ed), sizeof (struct td)); |
282 | 279 | ||
283 | return driver_register(&ohci_hcd_au1xxx_driver); | 280 | return platform_driver_register(&ohci_hcd_au1xxx_driver); |
284 | } | 281 | } |
285 | 282 | ||
286 | static void __exit ohci_hcd_au1xxx_cleanup (void) | 283 | static void __exit ohci_hcd_au1xxx_cleanup (void) |
287 | { | 284 | { |
288 | driver_unregister(&ohci_hcd_au1xxx_driver); | 285 | platform_driver_unregister(&ohci_hcd_au1xxx_driver); |
289 | } | 286 | } |
290 | 287 | ||
291 | module_init (ohci_hcd_au1xxx_init); | 288 | module_init (ohci_hcd_au1xxx_init); |
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c index 336c766c6e29..081ec3f5cff4 100644 --- a/drivers/usb/host/ohci-lh7a404.c +++ b/drivers/usb/host/ohci-lh7a404.c | |||
@@ -204,9 +204,8 @@ static const struct hc_driver ohci_lh7a404_hc_driver = { | |||
204 | 204 | ||
205 | /*-------------------------------------------------------------------------*/ | 205 | /*-------------------------------------------------------------------------*/ |
206 | 206 | ||
207 | static int ohci_hcd_lh7a404_drv_probe(struct device *dev) | 207 | static int ohci_hcd_lh7a404_drv_probe(struct platform_device *pdev) |
208 | { | 208 | { |
209 | struct platform_device *pdev = to_platform_device(dev); | ||
210 | int ret; | 209 | int ret; |
211 | 210 | ||
212 | pr_debug ("In ohci_hcd_lh7a404_drv_probe"); | 211 | pr_debug ("In ohci_hcd_lh7a404_drv_probe"); |
@@ -218,40 +217,38 @@ static int ohci_hcd_lh7a404_drv_probe(struct device *dev) | |||
218 | return ret; | 217 | return ret; |
219 | } | 218 | } |
220 | 219 | ||
221 | static int ohci_hcd_lh7a404_drv_remove(struct device *dev) | 220 | static int ohci_hcd_lh7a404_drv_remove(struct platform_device *pdev) |
222 | { | 221 | { |
223 | struct platform_device *pdev = to_platform_device(dev); | 222 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
224 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
225 | 223 | ||
226 | usb_hcd_lh7a404_remove(hcd, pdev); | 224 | usb_hcd_lh7a404_remove(hcd, pdev); |
227 | return 0; | 225 | return 0; |
228 | } | 226 | } |
229 | /*TBD*/ | 227 | /*TBD*/ |
230 | /*static int ohci_hcd_lh7a404_drv_suspend(struct device *dev) | 228 | /*static int ohci_hcd_lh7a404_drv_suspend(struct platform_device *dev) |
231 | { | 229 | { |
232 | struct platform_device *pdev = to_platform_device(dev); | 230 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
233 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
234 | 231 | ||
235 | return 0; | 232 | return 0; |
236 | } | 233 | } |
237 | static int ohci_hcd_lh7a404_drv_resume(struct device *dev) | 234 | static int ohci_hcd_lh7a404_drv_resume(struct platform_device *dev) |
238 | { | 235 | { |
239 | struct platform_device *pdev = to_platform_device(dev); | 236 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
240 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
241 | 237 | ||
242 | 238 | ||
243 | return 0; | 239 | return 0; |
244 | } | 240 | } |
245 | */ | 241 | */ |
246 | 242 | ||
247 | static struct device_driver ohci_hcd_lh7a404_driver = { | 243 | static struct platform_driver ohci_hcd_lh7a404_driver = { |
248 | .name = "lh7a404-ohci", | ||
249 | .owner = THIS_MODULE, | ||
250 | .bus = &platform_bus_type, | ||
251 | .probe = ohci_hcd_lh7a404_drv_probe, | 244 | .probe = ohci_hcd_lh7a404_drv_probe, |
252 | .remove = ohci_hcd_lh7a404_drv_remove, | 245 | .remove = ohci_hcd_lh7a404_drv_remove, |
253 | /*.suspend = ohci_hcd_lh7a404_drv_suspend, */ | 246 | /*.suspend = ohci_hcd_lh7a404_drv_suspend, */ |
254 | /*.resume = ohci_hcd_lh7a404_drv_resume, */ | 247 | /*.resume = ohci_hcd_lh7a404_drv_resume, */ |
248 | .driver = { | ||
249 | .name = "lh7a404-ohci", | ||
250 | .owner = THIS_MODULE, | ||
251 | }, | ||
255 | }; | 252 | }; |
256 | 253 | ||
257 | static int __init ohci_hcd_lh7a404_init (void) | 254 | static int __init ohci_hcd_lh7a404_init (void) |
@@ -260,12 +257,12 @@ static int __init ohci_hcd_lh7a404_init (void) | |||
260 | pr_debug ("block sizes: ed %d td %d\n", | 257 | pr_debug ("block sizes: ed %d td %d\n", |
261 | sizeof (struct ed), sizeof (struct td)); | 258 | sizeof (struct ed), sizeof (struct td)); |
262 | 259 | ||
263 | return driver_register(&ohci_hcd_lh7a404_driver); | 260 | return platform_driver_register(&ohci_hcd_lh7a404_driver); |
264 | } | 261 | } |
265 | 262 | ||
266 | static void __exit ohci_hcd_lh7a404_cleanup (void) | 263 | static void __exit ohci_hcd_lh7a404_cleanup (void) |
267 | { | 264 | { |
268 | driver_unregister(&ohci_hcd_lh7a404_driver); | 265 | platform_driver_unregister(&ohci_hcd_lh7a404_driver); |
269 | } | 266 | } |
270 | 267 | ||
271 | module_init (ohci_hcd_lh7a404_init); | 268 | module_init (ohci_hcd_lh7a404_init); |
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index e46cc540cf4d..c9e29d808711 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -433,24 +433,22 @@ static const struct hc_driver ohci_omap_hc_driver = { | |||
433 | 433 | ||
434 | /*-------------------------------------------------------------------------*/ | 434 | /*-------------------------------------------------------------------------*/ |
435 | 435 | ||
436 | static int ohci_hcd_omap_drv_probe(struct device *dev) | 436 | static int ohci_hcd_omap_drv_probe(struct platform_device *dev) |
437 | { | 437 | { |
438 | return usb_hcd_omap_probe(&ohci_omap_hc_driver, | 438 | return usb_hcd_omap_probe(&ohci_omap_hc_driver, dev); |
439 | to_platform_device(dev)); | ||
440 | } | 439 | } |
441 | 440 | ||
442 | static int ohci_hcd_omap_drv_remove(struct device *dev) | 441 | static int ohci_hcd_omap_drv_remove(struct platform_device *dev) |
443 | { | 442 | { |
444 | struct platform_device *pdev = to_platform_device(dev); | 443 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
445 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
446 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 444 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
447 | 445 | ||
448 | usb_hcd_omap_remove(hcd, pdev); | 446 | usb_hcd_omap_remove(hcd, dev); |
449 | if (ohci->transceiver) { | 447 | if (ohci->transceiver) { |
450 | (void) otg_set_host(ohci->transceiver, 0); | 448 | (void) otg_set_host(ohci->transceiver, 0); |
451 | put_device(ohci->transceiver->dev); | 449 | put_device(ohci->transceiver->dev); |
452 | } | 450 | } |
453 | dev_set_drvdata(dev, NULL); | 451 | platform_set_drvdata(dev, NULL); |
454 | 452 | ||
455 | return 0; | 453 | return 0; |
456 | } | 454 | } |
@@ -459,9 +457,9 @@ static int ohci_hcd_omap_drv_remove(struct device *dev) | |||
459 | 457 | ||
460 | #ifdef CONFIG_PM | 458 | #ifdef CONFIG_PM |
461 | 459 | ||
462 | static int ohci_omap_suspend(struct device *dev, pm_message_t message) | 460 | static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message) |
463 | { | 461 | { |
464 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); | 462 | struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev)); |
465 | 463 | ||
466 | if (time_before(jiffies, ohci->next_statechange)) | 464 | if (time_before(jiffies, ohci->next_statechange)) |
467 | msleep(5); | 465 | msleep(5); |
@@ -473,9 +471,9 @@ static int ohci_omap_suspend(struct device *dev, pm_message_t message) | |||
473 | return 0; | 471 | return 0; |
474 | } | 472 | } |
475 | 473 | ||
476 | static int ohci_omap_resume(struct device *dev) | 474 | static int ohci_omap_resume(struct platform_device *dev) |
477 | { | 475 | { |
478 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); | 476 | struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev)); |
479 | 477 | ||
480 | if (time_before(jiffies, ohci->next_statechange)) | 478 | if (time_before(jiffies, ohci->next_statechange)) |
481 | msleep(5); | 479 | msleep(5); |
@@ -494,16 +492,17 @@ static int ohci_omap_resume(struct device *dev) | |||
494 | /* | 492 | /* |
495 | * Driver definition to register with the OMAP bus | 493 | * Driver definition to register with the OMAP bus |
496 | */ | 494 | */ |
497 | static struct device_driver ohci_hcd_omap_driver = { | 495 | static struct platform_driver ohci_hcd_omap_driver = { |
498 | .name = "ohci", | ||
499 | .owner = THIS_MODULE, | ||
500 | .bus = &platform_bus_type, | ||
501 | .probe = ohci_hcd_omap_drv_probe, | 496 | .probe = ohci_hcd_omap_drv_probe, |
502 | .remove = ohci_hcd_omap_drv_remove, | 497 | .remove = ohci_hcd_omap_drv_remove, |
503 | #ifdef CONFIG_PM | 498 | #ifdef CONFIG_PM |
504 | .suspend = ohci_omap_suspend, | 499 | .suspend = ohci_omap_suspend, |
505 | .resume = ohci_omap_resume, | 500 | .resume = ohci_omap_resume, |
506 | #endif | 501 | #endif |
502 | .driver = { | ||
503 | .owner = THIS_MODULE, | ||
504 | .name = "ohci", | ||
505 | }, | ||
507 | }; | 506 | }; |
508 | 507 | ||
509 | static int __init ohci_hcd_omap_init (void) | 508 | static int __init ohci_hcd_omap_init (void) |
@@ -515,12 +514,12 @@ static int __init ohci_hcd_omap_init (void) | |||
515 | pr_debug("%s: block sizes: ed %Zd td %Zd\n", hcd_name, | 514 | pr_debug("%s: block sizes: ed %Zd td %Zd\n", hcd_name, |
516 | sizeof (struct ed), sizeof (struct td)); | 515 | sizeof (struct ed), sizeof (struct td)); |
517 | 516 | ||
518 | return driver_register(&ohci_hcd_omap_driver); | 517 | return platform_driver_register(&ohci_hcd_omap_driver); |
519 | } | 518 | } |
520 | 519 | ||
521 | static void __exit ohci_hcd_omap_cleanup (void) | 520 | static void __exit ohci_hcd_omap_cleanup (void) |
522 | { | 521 | { |
523 | driver_unregister(&ohci_hcd_omap_driver); | 522 | platform_driver_unregister(&ohci_hcd_omap_driver); |
524 | } | 523 | } |
525 | 524 | ||
526 | module_init (ohci_hcd_omap_init); | 525 | module_init (ohci_hcd_omap_init); |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 7ce1d9ef0289..a59e536441e1 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -218,7 +218,6 @@ MODULE_DEVICE_TABLE (pci, pci_ids); | |||
218 | static struct pci_driver ohci_pci_driver = { | 218 | static struct pci_driver ohci_pci_driver = { |
219 | .name = (char *) hcd_name, | 219 | .name = (char *) hcd_name, |
220 | .id_table = pci_ids, | 220 | .id_table = pci_ids, |
221 | .owner = THIS_MODULE, | ||
222 | 221 | ||
223 | .probe = usb_hcd_pci_probe, | 222 | .probe = usb_hcd_pci_probe, |
224 | .remove = usb_hcd_pci_remove, | 223 | .remove = usb_hcd_pci_remove, |
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c index 92cf6f4a1374..18755766e406 100644 --- a/drivers/usb/host/ohci-ppc-soc.c +++ b/drivers/usb/host/ohci-ppc-soc.c | |||
@@ -172,9 +172,8 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = { | |||
172 | .start_port_reset = ohci_start_port_reset, | 172 | .start_port_reset = ohci_start_port_reset, |
173 | }; | 173 | }; |
174 | 174 | ||
175 | static int ohci_hcd_ppc_soc_drv_probe(struct device *dev) | 175 | static int ohci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) |
176 | { | 176 | { |
177 | struct platform_device *pdev = to_platform_device(dev); | ||
178 | int ret; | 177 | int ret; |
179 | 178 | ||
180 | if (usb_disabled()) | 179 | if (usb_disabled()) |
@@ -184,25 +183,25 @@ static int ohci_hcd_ppc_soc_drv_probe(struct device *dev) | |||
184 | return ret; | 183 | return ret; |
185 | } | 184 | } |
186 | 185 | ||
187 | static int ohci_hcd_ppc_soc_drv_remove(struct device *dev) | 186 | static int ohci_hcd_ppc_soc_drv_remove(struct platform_device *pdev) |
188 | { | 187 | { |
189 | struct platform_device *pdev = to_platform_device(dev); | 188 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
190 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
191 | 189 | ||
192 | usb_hcd_ppc_soc_remove(hcd, pdev); | 190 | usb_hcd_ppc_soc_remove(hcd, pdev); |
193 | return 0; | 191 | return 0; |
194 | } | 192 | } |
195 | 193 | ||
196 | static struct device_driver ohci_hcd_ppc_soc_driver = { | 194 | static struct platform_driver ohci_hcd_ppc_soc_driver = { |
197 | .name = "ppc-soc-ohci", | ||
198 | .owner = THIS_MODULE, | ||
199 | .bus = &platform_bus_type, | ||
200 | .probe = ohci_hcd_ppc_soc_drv_probe, | 195 | .probe = ohci_hcd_ppc_soc_drv_probe, |
201 | .remove = ohci_hcd_ppc_soc_drv_remove, | 196 | .remove = ohci_hcd_ppc_soc_drv_remove, |
202 | #ifdef CONFIG_PM | 197 | #ifdef CONFIG_PM |
203 | /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/ | 198 | /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/ |
204 | /*.resume = ohci_hcd_ppc_soc_drv_resume,*/ | 199 | /*.resume = ohci_hcd_ppc_soc_drv_resume,*/ |
205 | #endif | 200 | #endif |
201 | .driver = { | ||
202 | .name = "ppc-soc-ohci", | ||
203 | .owner = THIS_MODULE, | ||
204 | }, | ||
206 | }; | 205 | }; |
207 | 206 | ||
208 | static int __init ohci_hcd_ppc_soc_init(void) | 207 | static int __init ohci_hcd_ppc_soc_init(void) |
@@ -211,12 +210,12 @@ static int __init ohci_hcd_ppc_soc_init(void) | |||
211 | pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed), | 210 | pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed), |
212 | sizeof(struct td)); | 211 | sizeof(struct td)); |
213 | 212 | ||
214 | return driver_register(&ohci_hcd_ppc_soc_driver); | 213 | return platform_driver_register(&ohci_hcd_ppc_soc_driver); |
215 | } | 214 | } |
216 | 215 | ||
217 | static void __exit ohci_hcd_ppc_soc_cleanup(void) | 216 | static void __exit ohci_hcd_ppc_soc_cleanup(void) |
218 | { | 217 | { |
219 | driver_unregister(&ohci_hcd_ppc_soc_driver); | 218 | platform_driver_unregister(&ohci_hcd_ppc_soc_driver); |
220 | } | 219 | } |
221 | 220 | ||
222 | module_init(ohci_hcd_ppc_soc_init); | 221 | module_init(ohci_hcd_ppc_soc_init); |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 59e20568e8f9..9d65ec307990 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -290,9 +290,8 @@ static const struct hc_driver ohci_pxa27x_hc_driver = { | |||
290 | 290 | ||
291 | /*-------------------------------------------------------------------------*/ | 291 | /*-------------------------------------------------------------------------*/ |
292 | 292 | ||
293 | static int ohci_hcd_pxa27x_drv_probe(struct device *dev) | 293 | static int ohci_hcd_pxa27x_drv_probe(struct platform_device *pdev) |
294 | { | 294 | { |
295 | struct platform_device *pdev = to_platform_device(dev); | ||
296 | int ret; | 295 | int ret; |
297 | 296 | ||
298 | pr_debug ("In ohci_hcd_pxa27x_drv_probe"); | 297 | pr_debug ("In ohci_hcd_pxa27x_drv_probe"); |
@@ -304,41 +303,39 @@ static int ohci_hcd_pxa27x_drv_probe(struct device *dev) | |||
304 | return ret; | 303 | return ret; |
305 | } | 304 | } |
306 | 305 | ||
307 | static int ohci_hcd_pxa27x_drv_remove(struct device *dev) | 306 | static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev) |
308 | { | 307 | { |
309 | struct platform_device *pdev = to_platform_device(dev); | 308 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
310 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
311 | 309 | ||
312 | usb_hcd_pxa27x_remove(hcd, pdev); | 310 | usb_hcd_pxa27x_remove(hcd, pdev); |
313 | return 0; | 311 | return 0; |
314 | } | 312 | } |
315 | 313 | ||
316 | static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state) | 314 | static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *dev, pm_message_t state) |
317 | { | 315 | { |
318 | // struct platform_device *pdev = to_platform_device(dev); | 316 | // struct usb_hcd *hcd = platform_get_drvdata(dev); |
319 | // struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
320 | printk("%s: not implemented yet\n", __FUNCTION__); | 317 | printk("%s: not implemented yet\n", __FUNCTION__); |
321 | 318 | ||
322 | return 0; | 319 | return 0; |
323 | } | 320 | } |
324 | 321 | ||
325 | static int ohci_hcd_pxa27x_drv_resume(struct device *dev) | 322 | static int ohci_hcd_pxa27x_drv_resume(struct platform_device *dev) |
326 | { | 323 | { |
327 | // struct platform_device *pdev = to_platform_device(dev); | 324 | // struct usb_hcd *hcd = platform_get_drvdata(dev); |
328 | // struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
329 | printk("%s: not implemented yet\n", __FUNCTION__); | 325 | printk("%s: not implemented yet\n", __FUNCTION__); |
330 | 326 | ||
331 | return 0; | 327 | return 0; |
332 | } | 328 | } |
333 | 329 | ||
334 | 330 | ||
335 | static struct device_driver ohci_hcd_pxa27x_driver = { | 331 | static struct platform_driver ohci_hcd_pxa27x_driver = { |
336 | .name = "pxa27x-ohci", | ||
337 | .bus = &platform_bus_type, | ||
338 | .probe = ohci_hcd_pxa27x_drv_probe, | 332 | .probe = ohci_hcd_pxa27x_drv_probe, |
339 | .remove = ohci_hcd_pxa27x_drv_remove, | 333 | .remove = ohci_hcd_pxa27x_drv_remove, |
340 | .suspend = ohci_hcd_pxa27x_drv_suspend, | 334 | .suspend = ohci_hcd_pxa27x_drv_suspend, |
341 | .resume = ohci_hcd_pxa27x_drv_resume, | 335 | .resume = ohci_hcd_pxa27x_drv_resume, |
336 | .driver = { | ||
337 | .name = "pxa27x-ohci", | ||
338 | }, | ||
342 | }; | 339 | }; |
343 | 340 | ||
344 | static int __init ohci_hcd_pxa27x_init (void) | 341 | static int __init ohci_hcd_pxa27x_init (void) |
@@ -347,12 +344,12 @@ static int __init ohci_hcd_pxa27x_init (void) | |||
347 | pr_debug ("block sizes: ed %d td %d\n", | 344 | pr_debug ("block sizes: ed %d td %d\n", |
348 | sizeof (struct ed), sizeof (struct td)); | 345 | sizeof (struct ed), sizeof (struct td)); |
349 | 346 | ||
350 | return driver_register(&ohci_hcd_pxa27x_driver); | 347 | return platform_driver_register(&ohci_hcd_pxa27x_driver); |
351 | } | 348 | } |
352 | 349 | ||
353 | static void __exit ohci_hcd_pxa27x_cleanup (void) | 350 | static void __exit ohci_hcd_pxa27x_cleanup (void) |
354 | { | 351 | { |
355 | driver_unregister(&ohci_hcd_pxa27x_driver); | 352 | platform_driver_unregister(&ohci_hcd_pxa27x_driver); |
356 | } | 353 | } |
357 | 354 | ||
358 | module_init (ohci_hcd_pxa27x_init); | 355 | module_init (ohci_hcd_pxa27x_init); |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index ee1fc605b402..35cc9402adc0 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -459,39 +459,38 @@ static const struct hc_driver ohci_s3c2410_hc_driver = { | |||
459 | 459 | ||
460 | /* device driver */ | 460 | /* device driver */ |
461 | 461 | ||
462 | static int ohci_hcd_s3c2410_drv_probe(struct device *dev) | 462 | static int ohci_hcd_s3c2410_drv_probe(struct platform_device *pdev) |
463 | { | 463 | { |
464 | struct platform_device *pdev = to_platform_device(dev); | ||
465 | return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev); | 464 | return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev); |
466 | } | 465 | } |
467 | 466 | ||
468 | static int ohci_hcd_s3c2410_drv_remove(struct device *dev) | 467 | static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev) |
469 | { | 468 | { |
470 | struct platform_device *pdev = to_platform_device(dev); | 469 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
471 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
472 | 470 | ||
473 | usb_hcd_s3c2410_remove(hcd, pdev); | 471 | usb_hcd_s3c2410_remove(hcd, pdev); |
474 | return 0; | 472 | return 0; |
475 | } | 473 | } |
476 | 474 | ||
477 | static struct device_driver ohci_hcd_s3c2410_driver = { | 475 | static struct platform_driver ohci_hcd_s3c2410_driver = { |
478 | .name = "s3c2410-ohci", | ||
479 | .owner = THIS_MODULE, | ||
480 | .bus = &platform_bus_type, | ||
481 | .probe = ohci_hcd_s3c2410_drv_probe, | 476 | .probe = ohci_hcd_s3c2410_drv_probe, |
482 | .remove = ohci_hcd_s3c2410_drv_remove, | 477 | .remove = ohci_hcd_s3c2410_drv_remove, |
483 | /*.suspend = ohci_hcd_s3c2410_drv_suspend, */ | 478 | /*.suspend = ohci_hcd_s3c2410_drv_suspend, */ |
484 | /*.resume = ohci_hcd_s3c2410_drv_resume, */ | 479 | /*.resume = ohci_hcd_s3c2410_drv_resume, */ |
480 | .driver = { | ||
481 | .owner = THIS_MODULE, | ||
482 | .name = "s3c2410-ohci", | ||
483 | }, | ||
485 | }; | 484 | }; |
486 | 485 | ||
487 | static int __init ohci_hcd_s3c2410_init (void) | 486 | static int __init ohci_hcd_s3c2410_init (void) |
488 | { | 487 | { |
489 | return driver_register(&ohci_hcd_s3c2410_driver); | 488 | return platform_driver_register(&ohci_hcd_s3c2410_driver); |
490 | } | 489 | } |
491 | 490 | ||
492 | static void __exit ohci_hcd_s3c2410_cleanup (void) | 491 | static void __exit ohci_hcd_s3c2410_cleanup (void) |
493 | { | 492 | { |
494 | driver_unregister(&ohci_hcd_s3c2410_driver); | 493 | platform_driver_unregister(&ohci_hcd_s3c2410_driver); |
495 | } | 494 | } |
496 | 495 | ||
497 | module_init (ohci_hcd_s3c2410_init); | 496 | module_init (ohci_hcd_s3c2410_init); |
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index 5607c0ae6835..a7722a6a5a5b 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c | |||
@@ -1631,24 +1631,21 @@ static struct hc_driver sl811h_hc_driver = { | |||
1631 | /*-------------------------------------------------------------------------*/ | 1631 | /*-------------------------------------------------------------------------*/ |
1632 | 1632 | ||
1633 | static int __devexit | 1633 | static int __devexit |
1634 | sl811h_remove(struct device *dev) | 1634 | sl811h_remove(struct platform_device *dev) |
1635 | { | 1635 | { |
1636 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 1636 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
1637 | struct sl811 *sl811 = hcd_to_sl811(hcd); | 1637 | struct sl811 *sl811 = hcd_to_sl811(hcd); |
1638 | struct platform_device *pdev; | ||
1639 | struct resource *res; | 1638 | struct resource *res; |
1640 | 1639 | ||
1641 | pdev = container_of(dev, struct platform_device, dev); | ||
1642 | |||
1643 | remove_debug_file(sl811); | 1640 | remove_debug_file(sl811); |
1644 | usb_remove_hcd(hcd); | 1641 | usb_remove_hcd(hcd); |
1645 | 1642 | ||
1646 | /* some platforms may use IORESOURCE_IO */ | 1643 | /* some platforms may use IORESOURCE_IO */ |
1647 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 1644 | res = platform_get_resource(dev, IORESOURCE_MEM, 1); |
1648 | if (res) | 1645 | if (res) |
1649 | iounmap(sl811->data_reg); | 1646 | iounmap(sl811->data_reg); |
1650 | 1647 | ||
1651 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1648 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
1652 | if (res) | 1649 | if (res) |
1653 | iounmap(sl811->addr_reg); | 1650 | iounmap(sl811->addr_reg); |
1654 | 1651 | ||
@@ -1657,11 +1654,10 @@ sl811h_remove(struct device *dev) | |||
1657 | } | 1654 | } |
1658 | 1655 | ||
1659 | static int __devinit | 1656 | static int __devinit |
1660 | sl811h_probe(struct device *dev) | 1657 | sl811h_probe(struct platform_device *dev) |
1661 | { | 1658 | { |
1662 | struct usb_hcd *hcd; | 1659 | struct usb_hcd *hcd; |
1663 | struct sl811 *sl811; | 1660 | struct sl811 *sl811; |
1664 | struct platform_device *pdev; | ||
1665 | struct resource *addr, *data; | 1661 | struct resource *addr, *data; |
1666 | int irq; | 1662 | int irq; |
1667 | void __iomem *addr_reg; | 1663 | void __iomem *addr_reg; |
@@ -1674,24 +1670,23 @@ sl811h_probe(struct device *dev) | |||
1674 | * specific platform_data. we don't probe for IRQs, and do only | 1670 | * specific platform_data. we don't probe for IRQs, and do only |
1675 | * minimal sanity checking. | 1671 | * minimal sanity checking. |
1676 | */ | 1672 | */ |
1677 | pdev = container_of(dev, struct platform_device, dev); | 1673 | irq = platform_get_irq(dev, 0); |
1678 | irq = platform_get_irq(pdev, 0); | 1674 | if (dev->num_resources < 3 || irq < 0) |
1679 | if (pdev->num_resources < 3 || irq < 0) | ||
1680 | return -ENODEV; | 1675 | return -ENODEV; |
1681 | 1676 | ||
1682 | /* refuse to confuse usbcore */ | 1677 | /* refuse to confuse usbcore */ |
1683 | if (dev->dma_mask) { | 1678 | if (dev->dev.dma_mask) { |
1684 | DBG("no we won't dma\n"); | 1679 | DBG("no we won't dma\n"); |
1685 | return -EINVAL; | 1680 | return -EINVAL; |
1686 | } | 1681 | } |
1687 | 1682 | ||
1688 | /* the chip may be wired for either kind of addressing */ | 1683 | /* the chip may be wired for either kind of addressing */ |
1689 | addr = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1684 | addr = platform_get_resource(dev, IORESOURCE_MEM, 0); |
1690 | data = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 1685 | data = platform_get_resource(dev, IORESOURCE_MEM, 1); |
1691 | retval = -EBUSY; | 1686 | retval = -EBUSY; |
1692 | if (!addr || !data) { | 1687 | if (!addr || !data) { |
1693 | addr = platform_get_resource(pdev, IORESOURCE_IO, 0); | 1688 | addr = platform_get_resource(dev, IORESOURCE_IO, 0); |
1694 | data = platform_get_resource(pdev, IORESOURCE_IO, 1); | 1689 | data = platform_get_resource(dev, IORESOURCE_IO, 1); |
1695 | if (!addr || !data) | 1690 | if (!addr || !data) |
1696 | return -ENODEV; | 1691 | return -ENODEV; |
1697 | ioaddr = 1; | 1692 | ioaddr = 1; |
@@ -1713,7 +1708,7 @@ sl811h_probe(struct device *dev) | |||
1713 | } | 1708 | } |
1714 | 1709 | ||
1715 | /* allocate and initialize hcd */ | 1710 | /* allocate and initialize hcd */ |
1716 | hcd = usb_create_hcd(&sl811h_hc_driver, dev, dev->bus_id); | 1711 | hcd = usb_create_hcd(&sl811h_hc_driver, &dev->dev, dev->dev.bus_id); |
1717 | if (!hcd) { | 1712 | if (!hcd) { |
1718 | retval = -ENOMEM; | 1713 | retval = -ENOMEM; |
1719 | goto err5; | 1714 | goto err5; |
@@ -1723,7 +1718,7 @@ sl811h_probe(struct device *dev) | |||
1723 | 1718 | ||
1724 | spin_lock_init(&sl811->lock); | 1719 | spin_lock_init(&sl811->lock); |
1725 | INIT_LIST_HEAD(&sl811->async); | 1720 | INIT_LIST_HEAD(&sl811->async); |
1726 | sl811->board = dev->platform_data; | 1721 | sl811->board = dev->dev.platform_data; |
1727 | init_timer(&sl811->timer); | 1722 | init_timer(&sl811->timer); |
1728 | sl811->timer.function = sl811h_timer; | 1723 | sl811->timer.function = sl811h_timer; |
1729 | sl811->timer.data = (unsigned long) sl811; | 1724 | sl811->timer.data = (unsigned long) sl811; |
@@ -1785,9 +1780,9 @@ sl811h_probe(struct device *dev) | |||
1785 | */ | 1780 | */ |
1786 | 1781 | ||
1787 | static int | 1782 | static int |
1788 | sl811h_suspend(struct device *dev, pm_message_t state) | 1783 | sl811h_suspend(struct platform_device *dev, pm_message_t state) |
1789 | { | 1784 | { |
1790 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 1785 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
1791 | struct sl811 *sl811 = hcd_to_sl811(hcd); | 1786 | struct sl811 *sl811 = hcd_to_sl811(hcd); |
1792 | int retval = 0; | 1787 | int retval = 0; |
1793 | 1788 | ||
@@ -1796,27 +1791,27 @@ sl811h_suspend(struct device *dev, pm_message_t state) | |||
1796 | else if (state.event == PM_EVENT_SUSPEND) | 1791 | else if (state.event == PM_EVENT_SUSPEND) |
1797 | port_power(sl811, 0); | 1792 | port_power(sl811, 0); |
1798 | if (retval == 0) | 1793 | if (retval == 0) |
1799 | dev->power.power_state = state; | 1794 | dev->dev.power.power_state = state; |
1800 | return retval; | 1795 | return retval; |
1801 | } | 1796 | } |
1802 | 1797 | ||
1803 | static int | 1798 | static int |
1804 | sl811h_resume(struct device *dev) | 1799 | sl811h_resume(struct platform_device *dev) |
1805 | { | 1800 | { |
1806 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 1801 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
1807 | struct sl811 *sl811 = hcd_to_sl811(hcd); | 1802 | struct sl811 *sl811 = hcd_to_sl811(hcd); |
1808 | 1803 | ||
1809 | /* with no "check to see if VBUS is still powered" board hook, | 1804 | /* with no "check to see if VBUS is still powered" board hook, |
1810 | * let's assume it'd only be powered to enable remote wakeup. | 1805 | * let's assume it'd only be powered to enable remote wakeup. |
1811 | */ | 1806 | */ |
1812 | if (dev->power.power_state.event == PM_EVENT_SUSPEND | 1807 | if (dev->dev.power.power_state.event == PM_EVENT_SUSPEND |
1813 | || !hcd->can_wakeup) { | 1808 | || !hcd->can_wakeup) { |
1814 | sl811->port1 = 0; | 1809 | sl811->port1 = 0; |
1815 | port_power(sl811, 1); | 1810 | port_power(sl811, 1); |
1816 | return 0; | 1811 | return 0; |
1817 | } | 1812 | } |
1818 | 1813 | ||
1819 | dev->power.power_state = PMSG_ON; | 1814 | dev->dev.power.power_state = PMSG_ON; |
1820 | return sl811h_bus_resume(hcd); | 1815 | return sl811h_bus_resume(hcd); |
1821 | } | 1816 | } |
1822 | 1817 | ||
@@ -1829,16 +1824,16 @@ sl811h_resume(struct device *dev) | |||
1829 | 1824 | ||
1830 | 1825 | ||
1831 | /* this driver is exported so sl811_cs can depend on it */ | 1826 | /* this driver is exported so sl811_cs can depend on it */ |
1832 | struct device_driver sl811h_driver = { | 1827 | struct platform_driver sl811h_driver = { |
1833 | .name = (char *) hcd_name, | ||
1834 | .bus = &platform_bus_type, | ||
1835 | .owner = THIS_MODULE, | ||
1836 | |||
1837 | .probe = sl811h_probe, | 1828 | .probe = sl811h_probe, |
1838 | .remove = __devexit_p(sl811h_remove), | 1829 | .remove = __devexit_p(sl811h_remove), |
1839 | 1830 | ||
1840 | .suspend = sl811h_suspend, | 1831 | .suspend = sl811h_suspend, |
1841 | .resume = sl811h_resume, | 1832 | .resume = sl811h_resume, |
1833 | .driver = { | ||
1834 | .name = (char *) hcd_name, | ||
1835 | .owner = THIS_MODULE, | ||
1836 | }, | ||
1842 | }; | 1837 | }; |
1843 | EXPORT_SYMBOL(sl811h_driver); | 1838 | EXPORT_SYMBOL(sl811h_driver); |
1844 | 1839 | ||
@@ -1850,12 +1845,12 @@ static int __init sl811h_init(void) | |||
1850 | return -ENODEV; | 1845 | return -ENODEV; |
1851 | 1846 | ||
1852 | INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); | 1847 | INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); |
1853 | return driver_register(&sl811h_driver); | 1848 | return platform_driver_register(&sl811h_driver); |
1854 | } | 1849 | } |
1855 | module_init(sl811h_init); | 1850 | module_init(sl811h_init); |
1856 | 1851 | ||
1857 | static void __exit sl811h_cleanup(void) | 1852 | static void __exit sl811h_cleanup(void) |
1858 | { | 1853 | { |
1859 | driver_unregister(&sl811h_driver); | 1854 | platform_driver_unregister(&sl811h_driver); |
1860 | } | 1855 | } |
1861 | module_exit(sl811h_cleanup); | 1856 | module_exit(sl811h_cleanup); |
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 15e0a511069b..d33ce3982a5f 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -831,7 +831,6 @@ MODULE_DEVICE_TABLE(pci, uhci_pci_ids); | |||
831 | static struct pci_driver uhci_pci_driver = { | 831 | static struct pci_driver uhci_pci_driver = { |
832 | .name = (char *)hcd_name, | 832 | .name = (char *)hcd_name, |
833 | .id_table = uhci_pci_ids, | 833 | .id_table = uhci_pci_ids, |
834 | .owner = THIS_MODULE, | ||
835 | 834 | ||
836 | .probe = usb_hcd_pci_probe, | 835 | .probe = usb_hcd_pci_probe, |
837 | .remove = usb_hcd_pci_remove, | 836 | .remove = usb_hcd_pci_remove, |
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 193b482570c7..750cebb18306 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c | |||
@@ -1279,7 +1279,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) | |||
1279 | printk("acornfb: freed %dK memory\n", mb_freed); | 1279 | printk("acornfb: freed %dK memory\n", mb_freed); |
1280 | } | 1280 | } |
1281 | 1281 | ||
1282 | static int __init acornfb_probe(struct device *dev) | 1282 | static int __init acornfb_probe(struct platform_device *dev) |
1283 | { | 1283 | { |
1284 | unsigned long size; | 1284 | unsigned long size; |
1285 | u_int h_sync, v_sync; | 1285 | u_int h_sync, v_sync; |
@@ -1292,7 +1292,7 @@ static int __init acornfb_probe(struct device *dev) | |||
1292 | 1292 | ||
1293 | acornfb_init_fbinfo(); | 1293 | acornfb_init_fbinfo(); |
1294 | 1294 | ||
1295 | current_par.dev = dev; | 1295 | current_par.dev = &dev->dev; |
1296 | 1296 | ||
1297 | if (current_par.montype == -1) | 1297 | if (current_par.montype == -1) |
1298 | current_par.montype = acornfb_detect_monitortype(); | 1298 | current_par.montype = acornfb_detect_monitortype(); |
@@ -1453,15 +1453,16 @@ static int __init acornfb_probe(struct device *dev) | |||
1453 | return 0; | 1453 | return 0; |
1454 | } | 1454 | } |
1455 | 1455 | ||
1456 | static struct device_driver acornfb_driver = { | 1456 | static struct platform_driver acornfb_driver = { |
1457 | .name = "acornfb", | ||
1458 | .bus = &platform_bus_type, | ||
1459 | .probe = acornfb_probe, | 1457 | .probe = acornfb_probe, |
1458 | .driver = { | ||
1459 | .name = "acornfb", | ||
1460 | }, | ||
1460 | }; | 1461 | }; |
1461 | 1462 | ||
1462 | static int __init acornfb_init(void) | 1463 | static int __init acornfb_init(void) |
1463 | { | 1464 | { |
1464 | return driver_register(&acornfb_driver); | 1465 | return platform_driver_register(&acornfb_driver); |
1465 | } | 1466 | } |
1466 | 1467 | ||
1467 | module_init(acornfb_init); | 1468 | module_init(acornfb_init); |
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c index a1fc8bbb1090..080db812ca48 100644 --- a/drivers/video/arcfb.c +++ b/drivers/video/arcfb.c | |||
@@ -514,9 +514,8 @@ static struct fb_ops arcfb_ops = { | |||
514 | .fb_ioctl = arcfb_ioctl, | 514 | .fb_ioctl = arcfb_ioctl, |
515 | }; | 515 | }; |
516 | 516 | ||
517 | static int __init arcfb_probe(struct device *device) | 517 | static int __init arcfb_probe(struct platform_device *dev) |
518 | { | 518 | { |
519 | struct platform_device *dev = to_platform_device(device); | ||
520 | struct fb_info *info; | 519 | struct fb_info *info; |
521 | int retval = -ENOMEM; | 520 | int retval = -ENOMEM; |
522 | int videomemorysize; | 521 | int videomemorysize; |
@@ -559,7 +558,7 @@ static int __init arcfb_probe(struct device *device) | |||
559 | retval = register_framebuffer(info); | 558 | retval = register_framebuffer(info); |
560 | if (retval < 0) | 559 | if (retval < 0) |
561 | goto err1; | 560 | goto err1; |
562 | dev_set_drvdata(&dev->dev, info); | 561 | platform_set_drvdata(dev, info); |
563 | if (irq) { | 562 | if (irq) { |
564 | par->irq = irq; | 563 | par->irq = irq; |
565 | if (request_irq(par->irq, &arcfb_interrupt, SA_SHIRQ, | 564 | if (request_irq(par->irq, &arcfb_interrupt, SA_SHIRQ, |
@@ -600,9 +599,9 @@ err: | |||
600 | return retval; | 599 | return retval; |
601 | } | 600 | } |
602 | 601 | ||
603 | static int arcfb_remove(struct device *device) | 602 | static int arcfb_remove(struct platform_device *dev) |
604 | { | 603 | { |
605 | struct fb_info *info = dev_get_drvdata(device); | 604 | struct fb_info *info = platform_get_drvdata(dev); |
606 | 605 | ||
607 | if (info) { | 606 | if (info) { |
608 | unregister_framebuffer(info); | 607 | unregister_framebuffer(info); |
@@ -612,11 +611,12 @@ static int arcfb_remove(struct device *device) | |||
612 | return 0; | 611 | return 0; |
613 | } | 612 | } |
614 | 613 | ||
615 | static struct device_driver arcfb_driver = { | 614 | static struct platform_driver arcfb_driver = { |
616 | .name = "arcfb", | ||
617 | .bus = &platform_bus_type, | ||
618 | .probe = arcfb_probe, | 615 | .probe = arcfb_probe, |
619 | .remove = arcfb_remove, | 616 | .remove = arcfb_remove, |
617 | .driver = { | ||
618 | .name = "arcfb", | ||
619 | }, | ||
620 | }; | 620 | }; |
621 | 621 | ||
622 | static struct platform_device *arcfb_device; | 622 | static struct platform_device *arcfb_device; |
@@ -628,7 +628,7 @@ static int __init arcfb_init(void) | |||
628 | if (!arcfb_enable) | 628 | if (!arcfb_enable) |
629 | return -ENXIO; | 629 | return -ENXIO; |
630 | 630 | ||
631 | ret = driver_register(&arcfb_driver); | 631 | ret = platform_driver_register(&arcfb_driver); |
632 | if (!ret) { | 632 | if (!ret) { |
633 | arcfb_device = platform_device_alloc("arcfb", 0); | 633 | arcfb_device = platform_device_alloc("arcfb", 0); |
634 | if (arcfb_device) { | 634 | if (arcfb_device) { |
@@ -638,7 +638,7 @@ static int __init arcfb_init(void) | |||
638 | } | 638 | } |
639 | if (ret) { | 639 | if (ret) { |
640 | platform_device_put(arcfb_device); | 640 | platform_device_put(arcfb_device); |
641 | driver_unregister(&arcfb_driver); | 641 | platform_driver_unregister(&arcfb_driver); |
642 | } | 642 | } |
643 | } | 643 | } |
644 | return ret; | 644 | return ret; |
@@ -648,7 +648,7 @@ static int __init arcfb_init(void) | |||
648 | static void __exit arcfb_exit(void) | 648 | static void __exit arcfb_exit(void) |
649 | { | 649 | { |
650 | platform_device_unregister(arcfb_device); | 650 | platform_device_unregister(arcfb_device); |
651 | driver_unregister(&arcfb_driver); | 651 | platform_driver_unregister(&arcfb_driver); |
652 | } | 652 | } |
653 | 653 | ||
654 | module_param(num_cols, ulong, 0); | 654 | module_param(num_cols, ulong, 0); |
diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c index 4867498f68e8..6a219b2c77e3 100644 --- a/drivers/video/backlight/corgi_bl.c +++ b/drivers/video/backlight/corgi_bl.c | |||
@@ -48,6 +48,12 @@ static void corgibl_send_intensity(int intensity) | |||
48 | corgibl_mach_set_intensity(intensity); | 48 | corgibl_mach_set_intensity(intensity); |
49 | 49 | ||
50 | spin_unlock_irqrestore(&bl_lock, flags); | 50 | spin_unlock_irqrestore(&bl_lock, flags); |
51 | |||
52 | corgi_kick_batt = symbol_get(sharpsl_battery_kick); | ||
53 | if (corgi_kick_batt) { | ||
54 | corgi_kick_batt(); | ||
55 | symbol_put(sharpsl_battery_kick); | ||
56 | } | ||
51 | } | 57 | } |
52 | 58 | ||
53 | static void corgibl_blank(int blank) | 59 | static void corgibl_blank(int blank) |
@@ -73,13 +79,13 @@ static void corgibl_blank(int blank) | |||
73 | } | 79 | } |
74 | 80 | ||
75 | #ifdef CONFIG_PM | 81 | #ifdef CONFIG_PM |
76 | static int corgibl_suspend(struct device *dev, pm_message_t state) | 82 | static int corgibl_suspend(struct platform_device *dev, pm_message_t state) |
77 | { | 83 | { |
78 | corgibl_blank(FB_BLANK_POWERDOWN); | 84 | corgibl_blank(FB_BLANK_POWERDOWN); |
79 | return 0; | 85 | return 0; |
80 | } | 86 | } |
81 | 87 | ||
82 | static int corgibl_resume(struct device *dev) | 88 | static int corgibl_resume(struct platform_device *dev) |
83 | { | 89 | { |
84 | corgibl_blank(FB_BLANK_UNBLANK); | 90 | corgibl_blank(FB_BLANK_UNBLANK); |
85 | return 0; | 91 | return 0; |
@@ -137,9 +143,9 @@ static struct backlight_properties corgibl_data = { | |||
137 | 143 | ||
138 | static struct backlight_device *corgi_backlight_device; | 144 | static struct backlight_device *corgi_backlight_device; |
139 | 145 | ||
140 | static int __init corgibl_probe(struct device *dev) | 146 | static int __init corgibl_probe(struct platform_device *pdev) |
141 | { | 147 | { |
142 | struct corgibl_machinfo *machinfo = dev->platform_data; | 148 | struct corgibl_machinfo *machinfo = pdev->dev.platform_data; |
143 | 149 | ||
144 | corgibl_data.max_brightness = machinfo->max_intensity; | 150 | corgibl_data.max_brightness = machinfo->max_intensity; |
145 | corgibl_mach_set_intensity = machinfo->set_bl_intensity; | 151 | corgibl_mach_set_intensity = machinfo->set_bl_intensity; |
@@ -156,7 +162,7 @@ static int __init corgibl_probe(struct device *dev) | |||
156 | return 0; | 162 | return 0; |
157 | } | 163 | } |
158 | 164 | ||
159 | static int corgibl_remove(struct device *dev) | 165 | static int corgibl_remove(struct platform_device *dev) |
160 | { | 166 | { |
161 | backlight_device_unregister(corgi_backlight_device); | 167 | backlight_device_unregister(corgi_backlight_device); |
162 | 168 | ||
@@ -166,23 +172,24 @@ static int corgibl_remove(struct device *dev) | |||
166 | return 0; | 172 | return 0; |
167 | } | 173 | } |
168 | 174 | ||
169 | static struct device_driver corgibl_driver = { | 175 | static struct platform_driver corgibl_driver = { |
170 | .name = "corgi-bl", | ||
171 | .bus = &platform_bus_type, | ||
172 | .probe = corgibl_probe, | 176 | .probe = corgibl_probe, |
173 | .remove = corgibl_remove, | 177 | .remove = corgibl_remove, |
174 | .suspend = corgibl_suspend, | 178 | .suspend = corgibl_suspend, |
175 | .resume = corgibl_resume, | 179 | .resume = corgibl_resume, |
180 | .driver = { | ||
181 | .name = "corgi-bl", | ||
182 | }, | ||
176 | }; | 183 | }; |
177 | 184 | ||
178 | static int __init corgibl_init(void) | 185 | static int __init corgibl_init(void) |
179 | { | 186 | { |
180 | return driver_register(&corgibl_driver); | 187 | return platform_driver_register(&corgibl_driver); |
181 | } | 188 | } |
182 | 189 | ||
183 | static void __exit corgibl_exit(void) | 190 | static void __exit corgibl_exit(void) |
184 | { | 191 | { |
185 | driver_unregister(&corgibl_driver); | 192 | platform_driver_unregister(&corgibl_driver); |
186 | } | 193 | } |
187 | 194 | ||
188 | module_init(corgibl_init); | 195 | module_init(corgibl_init); |
diff --git a/drivers/video/dnfb.c b/drivers/video/dnfb.c index 957a3ada2b75..5abd3cb00671 100644 --- a/drivers/video/dnfb.c +++ b/drivers/video/dnfb.c | |||
@@ -227,9 +227,8 @@ void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | |||
227 | * Initialization | 227 | * Initialization |
228 | */ | 228 | */ |
229 | 229 | ||
230 | static int __devinit dnfb_probe(struct device *device) | 230 | static int __devinit dnfb_probe(struct platform_device *dev) |
231 | { | 231 | { |
232 | struct platform_device *dev = to_platform_device(device); | ||
233 | struct fb_info *info; | 232 | struct fb_info *info; |
234 | int err = 0; | 233 | int err = 0; |
235 | 234 | ||
@@ -257,7 +256,7 @@ static int __devinit dnfb_probe(struct device *device) | |||
257 | framebuffer_release(info); | 256 | framebuffer_release(info); |
258 | return err; | 257 | return err; |
259 | } | 258 | } |
260 | dev_set_drvdata(&dev->dev, info); | 259 | platform_set_drvdata(dev, info); |
261 | 260 | ||
262 | /* now we have registered we can safely setup the hardware */ | 261 | /* now we have registered we can safely setup the hardware */ |
263 | out_8(AP_CONTROL_3A, RESET_CREG); | 262 | out_8(AP_CONTROL_3A, RESET_CREG); |
@@ -271,10 +270,11 @@ static int __devinit dnfb_probe(struct device *device) | |||
271 | return err; | 270 | return err; |
272 | } | 271 | } |
273 | 272 | ||
274 | static struct device_driver dnfb_driver = { | 273 | static struct platform_driver dnfb_driver = { |
275 | .name = "dnfb", | ||
276 | .bus = &platform_bus_type, | ||
277 | .probe = dnfb_probe, | 274 | .probe = dnfb_probe, |
275 | .driver = { | ||
276 | .name = "dnfb", | ||
277 | }, | ||
278 | }; | 278 | }; |
279 | 279 | ||
280 | static struct platform_device dnfb_device = { | 280 | static struct platform_device dnfb_device = { |
@@ -288,12 +288,12 @@ int __init dnfb_init(void) | |||
288 | if (fb_get_options("dnfb", NULL)) | 288 | if (fb_get_options("dnfb", NULL)) |
289 | return -ENODEV; | 289 | return -ENODEV; |
290 | 290 | ||
291 | ret = driver_register(&dnfb_driver); | 291 | ret = platform_driver_register(&dnfb_driver); |
292 | 292 | ||
293 | if (!ret) { | 293 | if (!ret) { |
294 | ret = platform_device_register(&dnfb_device); | 294 | ret = platform_device_register(&dnfb_device); |
295 | if (ret) | 295 | if (ret) |
296 | driver_unregister(&dnfb_driver); | 296 | platform_driver_unregister(&dnfb_driver); |
297 | } | 297 | } |
298 | return ret; | 298 | return ret; |
299 | } | 299 | } |
diff --git a/drivers/video/epson1355fb.c b/drivers/video/epson1355fb.c index 6a81a1dd8f3d..3b0e71383448 100644 --- a/drivers/video/epson1355fb.c +++ b/drivers/video/epson1355fb.c | |||
@@ -609,9 +609,9 @@ static void epson1355fb_platform_release(struct device *device) | |||
609 | { | 609 | { |
610 | } | 610 | } |
611 | 611 | ||
612 | static int epson1355fb_remove(struct device *device) | 612 | static int epson1355fb_remove(struct platform_device *dev) |
613 | { | 613 | { |
614 | struct fb_info *info = dev_get_drvdata(device); | 614 | struct fb_info *info = platform_get_drvdata(dev); |
615 | struct epson1355_par *par = info->par; | 615 | struct epson1355_par *par = info->par; |
616 | 616 | ||
617 | backlight_enable(0); | 617 | backlight_enable(0); |
@@ -632,9 +632,8 @@ static int epson1355fb_remove(struct device *device) | |||
632 | return 0; | 632 | return 0; |
633 | } | 633 | } |
634 | 634 | ||
635 | int __init epson1355fb_probe(struct device *device) | 635 | int __init epson1355fb_probe(struct platform_device *dev) |
636 | { | 636 | { |
637 | struct platform_device *dev = to_platform_device(device); | ||
638 | struct epson1355_par *default_par; | 637 | struct epson1355_par *default_par; |
639 | struct fb_info *info; | 638 | struct fb_info *info; |
640 | u8 revision; | 639 | u8 revision; |
@@ -713,7 +712,7 @@ int __init epson1355fb_probe(struct device *device) | |||
713 | /* | 712 | /* |
714 | * Our driver data. | 713 | * Our driver data. |
715 | */ | 714 | */ |
716 | dev_set_drvdata(&dev->dev, info); | 715 | platform_set_drvdata(dev, info); |
717 | 716 | ||
718 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | 717 | printk(KERN_INFO "fb%d: %s frame buffer device\n", |
719 | info->node, info->fix.id); | 718 | info->node, info->fix.id); |
@@ -721,15 +720,16 @@ int __init epson1355fb_probe(struct device *device) | |||
721 | return 0; | 720 | return 0; |
722 | 721 | ||
723 | bail: | 722 | bail: |
724 | epson1355fb_remove(device); | 723 | epson1355fb_remove(dev); |
725 | return rc; | 724 | return rc; |
726 | } | 725 | } |
727 | 726 | ||
728 | static struct device_driver epson1355fb_driver = { | 727 | static struct platform_driver epson1355fb_driver = { |
729 | .name = "epson1355fb", | ||
730 | .bus = &platform_bus_type, | ||
731 | .probe = epson1355fb_probe, | 728 | .probe = epson1355fb_probe, |
732 | .remove = epson1355fb_remove, | 729 | .remove = epson1355fb_remove, |
730 | .driver = { | ||
731 | .name = "epson1355fb", | ||
732 | }, | ||
733 | }; | 733 | }; |
734 | 734 | ||
735 | static struct platform_device epson1355fb_device = { | 735 | static struct platform_device epson1355fb_device = { |
@@ -747,11 +747,11 @@ int __init epson1355fb_init(void) | |||
747 | if (fb_get_options("epson1355fb", NULL)) | 747 | if (fb_get_options("epson1355fb", NULL)) |
748 | return -ENODEV; | 748 | return -ENODEV; |
749 | 749 | ||
750 | ret = driver_register(&epson1355fb_driver); | 750 | ret = platform_driver_register(&epson1355fb_driver); |
751 | if (!ret) { | 751 | if (!ret) { |
752 | ret = platform_device_register(&epson1355fb_device); | 752 | ret = platform_device_register(&epson1355fb_device); |
753 | if (ret) | 753 | if (ret) |
754 | driver_unregister(&epson1355fb_driver); | 754 | platform_driver_unregister(&epson1355fb_driver); |
755 | } | 755 | } |
756 | return ret; | 756 | return ret; |
757 | } | 757 | } |
@@ -762,7 +762,7 @@ module_init(epson1355fb_init); | |||
762 | static void __exit epson1355fb_exit(void) | 762 | static void __exit epson1355fb_exit(void) |
763 | { | 763 | { |
764 | platform_device_unregister(&epson1355fb_device); | 764 | platform_device_unregister(&epson1355fb_device); |
765 | driver_unregister(&epson1355fb_driver); | 765 | platform_driver_unregister(&epson1355fb_driver); |
766 | } | 766 | } |
767 | 767 | ||
768 | /* ------------------------------------------------------------------------- */ | 768 | /* ------------------------------------------------------------------------- */ |
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index 9d5e4f342110..d744c51807b7 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c | |||
@@ -1105,12 +1105,11 @@ int __init gbefb_setup(char *options) | |||
1105 | return 0; | 1105 | return 0; |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | static int __init gbefb_probe(struct device *dev) | 1108 | static int __init gbefb_probe(struct platform_device *p_dev) |
1109 | { | 1109 | { |
1110 | int i, ret = 0; | 1110 | int i, ret = 0; |
1111 | struct fb_info *info; | 1111 | struct fb_info *info; |
1112 | struct gbefb_par *par; | 1112 | struct gbefb_par *par; |
1113 | struct platform_device *p_dev = to_platform_device(dev); | ||
1114 | #ifndef MODULE | 1113 | #ifndef MODULE |
1115 | char *options = NULL; | 1114 | char *options = NULL; |
1116 | #endif | 1115 | #endif |
@@ -1204,8 +1203,8 @@ static int __init gbefb_probe(struct device *dev) | |||
1204 | goto out_gbe_unmap; | 1203 | goto out_gbe_unmap; |
1205 | } | 1204 | } |
1206 | 1205 | ||
1207 | dev_set_drvdata(&p_dev->dev, info); | 1206 | platform_set_drvdata(p_dev, info); |
1208 | gbefb_create_sysfs(dev); | 1207 | gbefb_create_sysfs(&p_dev->dev); |
1209 | 1208 | ||
1210 | printk(KERN_INFO "fb%d: %s rev %d @ 0x%08x using %dkB memory\n", | 1209 | printk(KERN_INFO "fb%d: %s rev %d @ 0x%08x using %dkB memory\n", |
1211 | info->node, info->fix.id, gbe_revision, (unsigned) GBE_BASE, | 1210 | info->node, info->fix.id, gbe_revision, (unsigned) GBE_BASE, |
@@ -1231,10 +1230,9 @@ out_release_framebuffer: | |||
1231 | return ret; | 1230 | return ret; |
1232 | } | 1231 | } |
1233 | 1232 | ||
1234 | static int __devexit gbefb_remove(struct device* dev) | 1233 | static int __devexit gbefb_remove(struct platform_device* p_dev) |
1235 | { | 1234 | { |
1236 | struct platform_device *p_dev = to_platform_device(dev); | 1235 | struct fb_info *info = platform_get_drvdata(p_dev); |
1237 | struct fb_info *info = dev_get_drvdata(&p_dev->dev); | ||
1238 | 1236 | ||
1239 | unregister_framebuffer(info); | 1237 | unregister_framebuffer(info); |
1240 | gbe_turn_off(); | 1238 | gbe_turn_off(); |
@@ -1252,18 +1250,19 @@ static int __devexit gbefb_remove(struct device* dev) | |||
1252 | return 0; | 1250 | return 0; |
1253 | } | 1251 | } |
1254 | 1252 | ||
1255 | static struct device_driver gbefb_driver = { | 1253 | static struct platform_driver gbefb_driver = { |
1256 | .name = "gbefb", | ||
1257 | .bus = &platform_bus_type, | ||
1258 | .probe = gbefb_probe, | 1254 | .probe = gbefb_probe, |
1259 | .remove = __devexit_p(gbefb_remove), | 1255 | .remove = __devexit_p(gbefb_remove), |
1256 | .driver = { | ||
1257 | .name = "gbefb", | ||
1258 | }, | ||
1260 | }; | 1259 | }; |
1261 | 1260 | ||
1262 | static struct platform_device *gbefb_device; | 1261 | static struct platform_device *gbefb_device; |
1263 | 1262 | ||
1264 | int __init gbefb_init(void) | 1263 | int __init gbefb_init(void) |
1265 | { | 1264 | { |
1266 | int ret = driver_register(&gbefb_driver); | 1265 | int ret = platform_driver_register(&gbefb_driver); |
1267 | if (!ret) { | 1266 | if (!ret) { |
1268 | gbefb_device = platform_device_alloc("gbefb", 0); | 1267 | gbefb_device = platform_device_alloc("gbefb", 0); |
1269 | if (gbefb_device) { | 1268 | if (gbefb_device) { |
@@ -1273,7 +1272,7 @@ int __init gbefb_init(void) | |||
1273 | } | 1272 | } |
1274 | if (ret) { | 1273 | if (ret) { |
1275 | platform_device_put(gbefb_device); | 1274 | platform_device_put(gbefb_device); |
1276 | driver_unregister(&gbefb_driver); | 1275 | platform_driver_unregister(&gbefb_driver); |
1277 | } | 1276 | } |
1278 | } | 1277 | } |
1279 | return ret; | 1278 | return ret; |
@@ -1282,7 +1281,7 @@ int __init gbefb_init(void) | |||
1282 | void __exit gbefb_exit(void) | 1281 | void __exit gbefb_exit(void) |
1283 | { | 1282 | { |
1284 | platform_device_unregister(gbefb_device); | 1283 | platform_device_unregister(gbefb_device); |
1285 | driver_unregister(&gbefb_driver); | 1284 | platform_driver_unregister(&gbefb_driver); |
1286 | } | 1285 | } |
1287 | 1286 | ||
1288 | module_init(gbefb_init); | 1287 | module_init(gbefb_init); |
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index e20b9f3a255f..5924cc225c95 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c | |||
@@ -423,18 +423,18 @@ static void imxfb_setup_gpio(struct imxfb_info *fbi) | |||
423 | * Power management hooks. Note that we won't be called from IRQ context, | 423 | * Power management hooks. Note that we won't be called from IRQ context, |
424 | * unlike the blank functions above, so we may sleep. | 424 | * unlike the blank functions above, so we may sleep. |
425 | */ | 425 | */ |
426 | static int imxfb_suspend(struct device *dev, pm_message_t state) | 426 | static int imxfb_suspend(struct platform_device *dev, pm_message_t state) |
427 | { | 427 | { |
428 | struct imxfb_info *fbi = dev_get_drvdata(dev); | 428 | struct imxfb_info *fbi = platform_get_drvdata(dev); |
429 | pr_debug("%s\n",__FUNCTION__); | 429 | pr_debug("%s\n",__FUNCTION__); |
430 | 430 | ||
431 | imxfb_disable_controller(fbi); | 431 | imxfb_disable_controller(fbi); |
432 | return 0; | 432 | return 0; |
433 | } | 433 | } |
434 | 434 | ||
435 | static int imxfb_resume(struct device *dev) | 435 | static int imxfb_resume(struct platform_device *dev) |
436 | { | 436 | { |
437 | struct imxfb_info *fbi = dev_get_drvdata(dev); | 437 | struct imxfb_info *fbi = platform_get_drvdata(dev); |
438 | pr_debug("%s\n",__FUNCTION__); | 438 | pr_debug("%s\n",__FUNCTION__); |
439 | 439 | ||
440 | imxfb_enable_controller(fbi); | 440 | imxfb_enable_controller(fbi); |
@@ -538,9 +538,8 @@ static int __init imxfb_map_video_memory(struct fb_info *info) | |||
538 | return fbi->map_cpu ? 0 : -ENOMEM; | 538 | return fbi->map_cpu ? 0 : -ENOMEM; |
539 | } | 539 | } |
540 | 540 | ||
541 | static int __init imxfb_probe(struct device *dev) | 541 | static int __init imxfb_probe(struct platform_device *pdev) |
542 | { | 542 | { |
543 | struct platform_device *pdev = to_platform_device(dev); | ||
544 | struct imxfb_info *fbi; | 543 | struct imxfb_info *fbi; |
545 | struct fb_info *info; | 544 | struct fb_info *info; |
546 | struct imxfb_mach_info *inf; | 545 | struct imxfb_mach_info *inf; |
@@ -553,21 +552,21 @@ static int __init imxfb_probe(struct device *dev) | |||
553 | if(!res) | 552 | if(!res) |
554 | return -ENODEV; | 553 | return -ENODEV; |
555 | 554 | ||
556 | inf = dev->platform_data; | 555 | inf = pdev->dev.platform_data; |
557 | if(!inf) { | 556 | if(!inf) { |
558 | dev_err(dev,"No platform_data available\n"); | 557 | dev_err(dev,"No platform_data available\n"); |
559 | return -ENOMEM; | 558 | return -ENOMEM; |
560 | } | 559 | } |
561 | 560 | ||
562 | info = framebuffer_alloc(sizeof(struct imxfb_info), dev); | 561 | info = framebuffer_alloc(sizeof(struct imxfb_info), &pdev->dev); |
563 | if(!info) | 562 | if(!info) |
564 | return -ENOMEM; | 563 | return -ENOMEM; |
565 | 564 | ||
566 | fbi = info->par; | 565 | fbi = info->par; |
567 | 566 | ||
568 | dev_set_drvdata(dev, info); | 567 | platform_set_drvdata(pdev, info); |
569 | 568 | ||
570 | ret = imxfb_init_fbinfo(dev); | 569 | ret = imxfb_init_fbinfo(&pdev->dev); |
571 | if( ret < 0 ) | 570 | if( ret < 0 ) |
572 | goto failed_init; | 571 | goto failed_init; |
573 | 572 | ||
@@ -621,22 +620,21 @@ failed_register: | |||
621 | fb_dealloc_cmap(&info->cmap); | 620 | fb_dealloc_cmap(&info->cmap); |
622 | failed_cmap: | 621 | failed_cmap: |
623 | if (!inf->fixed_screen_cpu) | 622 | if (!inf->fixed_screen_cpu) |
624 | dma_free_writecombine(dev,fbi->map_size,fbi->map_cpu, | 623 | dma_free_writecombine(&pdev->dev,fbi->map_size,fbi->map_cpu, |
625 | fbi->map_dma); | 624 | fbi->map_dma); |
626 | failed_map: | 625 | failed_map: |
627 | kfree(info->pseudo_palette); | 626 | kfree(info->pseudo_palette); |
628 | failed_regs: | 627 | failed_regs: |
629 | release_mem_region(res->start, res->end - res->start); | 628 | release_mem_region(res->start, res->end - res->start); |
630 | failed_init: | 629 | failed_init: |
631 | dev_set_drvdata(dev, NULL); | 630 | platform_set_drvdata(pdev, NULL); |
632 | framebuffer_release(info); | 631 | framebuffer_release(info); |
633 | return ret; | 632 | return ret; |
634 | } | 633 | } |
635 | 634 | ||
636 | static int imxfb_remove(struct device *dev) | 635 | static int imxfb_remove(struct platform_device *pdev) |
637 | { | 636 | { |
638 | struct platform_device *pdev = to_platform_device(dev); | 637 | struct fb_info *info = platform_get_drvdata(pdev); |
639 | struct fb_info *info = dev_get_drvdata(dev); | ||
640 | struct imxfb_info *fbi = info->par; | 638 | struct imxfb_info *fbi = info->par; |
641 | struct resource *res; | 639 | struct resource *res; |
642 | 640 | ||
@@ -651,36 +649,37 @@ static int imxfb_remove(struct device *dev) | |||
651 | framebuffer_release(info); | 649 | framebuffer_release(info); |
652 | 650 | ||
653 | release_mem_region(res->start, res->end - res->start + 1); | 651 | release_mem_region(res->start, res->end - res->start + 1); |
654 | dev_set_drvdata(dev, NULL); | 652 | platform_set_drvdata(pdev, NULL); |
655 | 653 | ||
656 | return 0; | 654 | return 0; |
657 | } | 655 | } |
658 | 656 | ||
659 | void imxfb_shutdown(struct device * dev) | 657 | void imxfb_shutdown(struct platform_device * dev) |
660 | { | 658 | { |
661 | struct fb_info *info = dev_get_drvdata(dev); | 659 | struct fb_info *info = platform_get_drvdata(dev); |
662 | struct imxfb_info *fbi = info->par; | 660 | struct imxfb_info *fbi = info->par; |
663 | imxfb_disable_controller(fbi); | 661 | imxfb_disable_controller(fbi); |
664 | } | 662 | } |
665 | 663 | ||
666 | static struct device_driver imxfb_driver = { | 664 | static struct platform_driver imxfb_driver = { |
667 | .name = "imx-fb", | ||
668 | .bus = &platform_bus_type, | ||
669 | .probe = imxfb_probe, | 665 | .probe = imxfb_probe, |
670 | .suspend = imxfb_suspend, | 666 | .suspend = imxfb_suspend, |
671 | .resume = imxfb_resume, | 667 | .resume = imxfb_resume, |
672 | .remove = imxfb_remove, | 668 | .remove = imxfb_remove, |
673 | .shutdown = imxfb_shutdown, | 669 | .shutdown = imxfb_shutdown, |
670 | .driver = { | ||
671 | .name = "imx-fb", | ||
672 | }, | ||
674 | }; | 673 | }; |
675 | 674 | ||
676 | int __init imxfb_init(void) | 675 | int __init imxfb_init(void) |
677 | { | 676 | { |
678 | return driver_register(&imxfb_driver); | 677 | return platform_driver_register(&imxfb_driver); |
679 | } | 678 | } |
680 | 679 | ||
681 | static void __exit imxfb_cleanup(void) | 680 | static void __exit imxfb_cleanup(void) |
682 | { | 681 | { |
683 | driver_unregister(&imxfb_driver); | 682 | platform_driver_unregister(&imxfb_driver); |
684 | } | 683 | } |
685 | 684 | ||
686 | module_init(imxfb_init); | 685 | module_init(imxfb_init); |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index f305a5b77b23..7b4cd250bec8 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -980,17 +980,17 @@ pxafb_freq_policy(struct notifier_block *nb, unsigned long val, void *data) | |||
980 | * Power management hooks. Note that we won't be called from IRQ context, | 980 | * Power management hooks. Note that we won't be called from IRQ context, |
981 | * unlike the blank functions above, so we may sleep. | 981 | * unlike the blank functions above, so we may sleep. |
982 | */ | 982 | */ |
983 | static int pxafb_suspend(struct device *dev, pm_message_t state) | 983 | static int pxafb_suspend(struct platform_device *dev, pm_message_t state) |
984 | { | 984 | { |
985 | struct pxafb_info *fbi = dev_get_drvdata(dev); | 985 | struct pxafb_info *fbi = platform_get_drvdata(dev); |
986 | 986 | ||
987 | set_ctrlr_state(fbi, C_DISABLE_PM); | 987 | set_ctrlr_state(fbi, C_DISABLE_PM); |
988 | return 0; | 988 | return 0; |
989 | } | 989 | } |
990 | 990 | ||
991 | static int pxafb_resume(struct device *dev) | 991 | static int pxafb_resume(struct platform_device *dev) |
992 | { | 992 | { |
993 | struct pxafb_info *fbi = dev_get_drvdata(dev); | 993 | struct pxafb_info *fbi = platform_get_drvdata(dev); |
994 | 994 | ||
995 | set_ctrlr_state(fbi, C_ENABLE_PM); | 995 | set_ctrlr_state(fbi, C_ENABLE_PM); |
996 | return 0; | 996 | return 0; |
@@ -1268,7 +1268,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options) | |||
1268 | } | 1268 | } |
1269 | #endif | 1269 | #endif |
1270 | 1270 | ||
1271 | int __init pxafb_probe(struct device *dev) | 1271 | int __init pxafb_probe(struct platform_device *dev) |
1272 | { | 1272 | { |
1273 | struct pxafb_info *fbi; | 1273 | struct pxafb_info *fbi; |
1274 | struct pxafb_mach_info *inf; | 1274 | struct pxafb_mach_info *inf; |
@@ -1276,14 +1276,14 @@ int __init pxafb_probe(struct device *dev) | |||
1276 | 1276 | ||
1277 | dev_dbg(dev, "pxafb_probe\n"); | 1277 | dev_dbg(dev, "pxafb_probe\n"); |
1278 | 1278 | ||
1279 | inf = dev->platform_data; | 1279 | inf = dev->dev.platform_data; |
1280 | ret = -ENOMEM; | 1280 | ret = -ENOMEM; |
1281 | fbi = NULL; | 1281 | fbi = NULL; |
1282 | if (!inf) | 1282 | if (!inf) |
1283 | goto failed; | 1283 | goto failed; |
1284 | 1284 | ||
1285 | #ifdef CONFIG_FB_PXA_PARAMETERS | 1285 | #ifdef CONFIG_FB_PXA_PARAMETERS |
1286 | ret = pxafb_parse_options(dev, g_options); | 1286 | ret = pxafb_parse_options(&dev->dev, g_options); |
1287 | if (ret < 0) | 1287 | if (ret < 0) |
1288 | goto failed; | 1288 | goto failed; |
1289 | #endif | 1289 | #endif |
@@ -1293,36 +1293,36 @@ int __init pxafb_probe(struct device *dev) | |||
1293 | * a warning is given. */ | 1293 | * a warning is given. */ |
1294 | 1294 | ||
1295 | if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK) | 1295 | if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK) |
1296 | dev_warn(dev, "machine LCCR0 setting contains illegal bits: %08x\n", | 1296 | dev_warn(&dev->dev, "machine LCCR0 setting contains illegal bits: %08x\n", |
1297 | inf->lccr0 & LCCR0_INVALID_CONFIG_MASK); | 1297 | inf->lccr0 & LCCR0_INVALID_CONFIG_MASK); |
1298 | if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK) | 1298 | if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK) |
1299 | dev_warn(dev, "machine LCCR3 setting contains illegal bits: %08x\n", | 1299 | dev_warn(&dev->dev, "machine LCCR3 setting contains illegal bits: %08x\n", |
1300 | inf->lccr3 & LCCR3_INVALID_CONFIG_MASK); | 1300 | inf->lccr3 & LCCR3_INVALID_CONFIG_MASK); |
1301 | if (inf->lccr0 & LCCR0_DPD && | 1301 | if (inf->lccr0 & LCCR0_DPD && |
1302 | ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas || | 1302 | ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas || |
1303 | (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl || | 1303 | (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl || |
1304 | (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono)) | 1304 | (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono)) |
1305 | dev_warn(dev, "Double Pixel Data (DPD) mode is only valid in passive mono" | 1305 | dev_warn(&dev->dev, "Double Pixel Data (DPD) mode is only valid in passive mono" |
1306 | " single panel mode\n"); | 1306 | " single panel mode\n"); |
1307 | if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act && | 1307 | if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act && |
1308 | (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual) | 1308 | (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual) |
1309 | dev_warn(dev, "Dual panel only valid in passive mode\n"); | 1309 | dev_warn(&dev->dev, "Dual panel only valid in passive mode\n"); |
1310 | if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas && | 1310 | if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas && |
1311 | (inf->upper_margin || inf->lower_margin)) | 1311 | (inf->upper_margin || inf->lower_margin)) |
1312 | dev_warn(dev, "Upper and lower margins must be 0 in passive mode\n"); | 1312 | dev_warn(&dev->dev, "Upper and lower margins must be 0 in passive mode\n"); |
1313 | #endif | 1313 | #endif |
1314 | 1314 | ||
1315 | dev_dbg(dev, "got a %dx%dx%d LCD\n",inf->xres, inf->yres, inf->bpp); | 1315 | dev_dbg(&dev->dev, "got a %dx%dx%d LCD\n",inf->xres, inf->yres, inf->bpp); |
1316 | if (inf->xres == 0 || inf->yres == 0 || inf->bpp == 0) { | 1316 | if (inf->xres == 0 || inf->yres == 0 || inf->bpp == 0) { |
1317 | dev_err(dev, "Invalid resolution or bit depth\n"); | 1317 | dev_err(&dev->dev, "Invalid resolution or bit depth\n"); |
1318 | ret = -EINVAL; | 1318 | ret = -EINVAL; |
1319 | goto failed; | 1319 | goto failed; |
1320 | } | 1320 | } |
1321 | pxafb_backlight_power = inf->pxafb_backlight_power; | 1321 | pxafb_backlight_power = inf->pxafb_backlight_power; |
1322 | pxafb_lcd_power = inf->pxafb_lcd_power; | 1322 | pxafb_lcd_power = inf->pxafb_lcd_power; |
1323 | fbi = pxafb_init_fbinfo(dev); | 1323 | fbi = pxafb_init_fbinfo(&dev->dev); |
1324 | if (!fbi) { | 1324 | if (!fbi) { |
1325 | dev_err(dev, "Failed to initialize framebuffer device\n"); | 1325 | dev_err(&dev->dev, "Failed to initialize framebuffer device\n"); |
1326 | ret = -ENOMEM; // only reason for pxafb_init_fbinfo to fail is kmalloc | 1326 | ret = -ENOMEM; // only reason for pxafb_init_fbinfo to fail is kmalloc |
1327 | goto failed; | 1327 | goto failed; |
1328 | } | 1328 | } |
@@ -1330,14 +1330,14 @@ int __init pxafb_probe(struct device *dev) | |||
1330 | /* Initialize video memory */ | 1330 | /* Initialize video memory */ |
1331 | ret = pxafb_map_video_memory(fbi); | 1331 | ret = pxafb_map_video_memory(fbi); |
1332 | if (ret) { | 1332 | if (ret) { |
1333 | dev_err(dev, "Failed to allocate video RAM: %d\n", ret); | 1333 | dev_err(&dev->dev, "Failed to allocate video RAM: %d\n", ret); |
1334 | ret = -ENOMEM; | 1334 | ret = -ENOMEM; |
1335 | goto failed; | 1335 | goto failed; |
1336 | } | 1336 | } |
1337 | 1337 | ||
1338 | ret = request_irq(IRQ_LCD, pxafb_handle_irq, SA_INTERRUPT, "LCD", fbi); | 1338 | ret = request_irq(IRQ_LCD, pxafb_handle_irq, SA_INTERRUPT, "LCD", fbi); |
1339 | if (ret) { | 1339 | if (ret) { |
1340 | dev_err(dev, "request_irq failed: %d\n", ret); | 1340 | dev_err(&dev->dev, "request_irq failed: %d\n", ret); |
1341 | ret = -EBUSY; | 1341 | ret = -EBUSY; |
1342 | goto failed; | 1342 | goto failed; |
1343 | } | 1343 | } |
@@ -1349,11 +1349,11 @@ int __init pxafb_probe(struct device *dev) | |||
1349 | pxafb_check_var(&fbi->fb.var, &fbi->fb); | 1349 | pxafb_check_var(&fbi->fb.var, &fbi->fb); |
1350 | pxafb_set_par(&fbi->fb); | 1350 | pxafb_set_par(&fbi->fb); |
1351 | 1351 | ||
1352 | dev_set_drvdata(dev, fbi); | 1352 | platform_set_drvdata(dev, fbi); |
1353 | 1353 | ||
1354 | ret = register_framebuffer(&fbi->fb); | 1354 | ret = register_framebuffer(&fbi->fb); |
1355 | if (ret < 0) { | 1355 | if (ret < 0) { |
1356 | dev_err(dev, "Failed to register framebuffer device: %d\n", ret); | 1356 | dev_err(&dev->dev, "Failed to register framebuffer device: %d\n", ret); |
1357 | goto failed; | 1357 | goto failed; |
1358 | } | 1358 | } |
1359 | 1359 | ||
@@ -1376,19 +1376,20 @@ int __init pxafb_probe(struct device *dev) | |||
1376 | return 0; | 1376 | return 0; |
1377 | 1377 | ||
1378 | failed: | 1378 | failed: |
1379 | dev_set_drvdata(dev, NULL); | 1379 | platform_set_drvdata(dev, NULL); |
1380 | kfree(fbi); | 1380 | kfree(fbi); |
1381 | return ret; | 1381 | return ret; |
1382 | } | 1382 | } |
1383 | 1383 | ||
1384 | static struct device_driver pxafb_driver = { | 1384 | static struct platform_driver pxafb_driver = { |
1385 | .name = "pxa2xx-fb", | ||
1386 | .bus = &platform_bus_type, | ||
1387 | .probe = pxafb_probe, | 1385 | .probe = pxafb_probe, |
1388 | #ifdef CONFIG_PM | 1386 | #ifdef CONFIG_PM |
1389 | .suspend = pxafb_suspend, | 1387 | .suspend = pxafb_suspend, |
1390 | .resume = pxafb_resume, | 1388 | .resume = pxafb_resume, |
1391 | #endif | 1389 | #endif |
1390 | .driver = { | ||
1391 | .name = "pxa2xx-fb", | ||
1392 | }, | ||
1392 | }; | 1393 | }; |
1393 | 1394 | ||
1394 | #ifndef MODULE | 1395 | #ifndef MODULE |
@@ -1415,7 +1416,7 @@ int __devinit pxafb_init(void) | |||
1415 | return -ENODEV; | 1416 | return -ENODEV; |
1416 | pxafb_setup(option); | 1417 | pxafb_setup(option); |
1417 | #endif | 1418 | #endif |
1418 | return driver_register(&pxafb_driver); | 1419 | return platform_driver_register(&pxafb_driver); |
1419 | } | 1420 | } |
1420 | 1421 | ||
1421 | module_init(pxafb_init); | 1422 | module_init(pxafb_init); |
diff --git a/drivers/video/q40fb.c b/drivers/video/q40fb.c index bfc41f2c902a..fc91dbf896d2 100644 --- a/drivers/video/q40fb.c +++ b/drivers/video/q40fb.c | |||
@@ -86,9 +86,8 @@ static struct fb_ops q40fb_ops = { | |||
86 | .fb_imageblit = cfb_imageblit, | 86 | .fb_imageblit = cfb_imageblit, |
87 | }; | 87 | }; |
88 | 88 | ||
89 | static int __init q40fb_probe(struct device *device) | 89 | static int __init q40fb_probe(struct platform_device *dev) |
90 | { | 90 | { |
91 | struct platform_device *dev = to_platform_device(device); | ||
92 | struct fb_info *info; | 91 | struct fb_info *info; |
93 | 92 | ||
94 | if (!MACH_IS_Q40) | 93 | if (!MACH_IS_Q40) |
@@ -128,10 +127,11 @@ static int __init q40fb_probe(struct device *device) | |||
128 | return 0; | 127 | return 0; |
129 | } | 128 | } |
130 | 129 | ||
131 | static struct device_driver q40fb_driver = { | 130 | static struct platform_driver q40fb_driver = { |
132 | .name = "q40fb", | ||
133 | .bus = &platform_bus_type, | ||
134 | .probe = q40fb_probe, | 131 | .probe = q40fb_probe, |
132 | .driver = { | ||
133 | .name = "q40fb", | ||
134 | }, | ||
135 | }; | 135 | }; |
136 | 136 | ||
137 | static struct platform_device q40fb_device = { | 137 | static struct platform_device q40fb_device = { |
@@ -145,12 +145,12 @@ int __init q40fb_init(void) | |||
145 | if (fb_get_options("q40fb", NULL)) | 145 | if (fb_get_options("q40fb", NULL)) |
146 | return -ENODEV; | 146 | return -ENODEV; |
147 | 147 | ||
148 | ret = driver_register(&q40fb_driver); | 148 | ret = platform_driver_register(&q40fb_driver); |
149 | 149 | ||
150 | if (!ret) { | 150 | if (!ret) { |
151 | ret = platform_device_register(&q40fb_device); | 151 | ret = platform_device_register(&q40fb_device); |
152 | if (ret) | 152 | if (ret) |
153 | driver_unregister(&q40fb_driver); | 153 | platform_driver_unregister(&q40fb_driver); |
154 | } | 154 | } |
155 | return ret; | 155 | return ret; |
156 | } | 156 | } |
diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c index 3edbd14c5c46..e5d0f92eeae3 100644 --- a/drivers/video/s1d13xxxfb.c +++ b/drivers/video/s1d13xxxfb.c | |||
@@ -503,10 +503,9 @@ s1d13xxxfb_fetch_hw_state(struct fb_info *info) | |||
503 | 503 | ||
504 | 504 | ||
505 | static int | 505 | static int |
506 | s1d13xxxfb_remove(struct device *dev) | 506 | s1d13xxxfb_remove(struct platform_device *pdev) |
507 | { | 507 | { |
508 | struct fb_info *info = dev_get_drvdata(dev); | 508 | struct fb_info *info = platform_get_drvdata(pdev); |
509 | struct platform_device *pdev = to_platform_device(dev); | ||
510 | struct s1d13xxxfb_par *par = NULL; | 509 | struct s1d13xxxfb_par *par = NULL; |
511 | 510 | ||
512 | if (info) { | 511 | if (info) { |
@@ -534,9 +533,8 @@ s1d13xxxfb_remove(struct device *dev) | |||
534 | } | 533 | } |
535 | 534 | ||
536 | static int __devinit | 535 | static int __devinit |
537 | s1d13xxxfb_probe(struct device *dev) | 536 | s1d13xxxfb_probe(struct platform_device *pdev) |
538 | { | 537 | { |
539 | struct platform_device *pdev = to_platform_device(dev); | ||
540 | struct s1d13xxxfb_par *default_par; | 538 | struct s1d13xxxfb_par *default_par; |
541 | struct fb_info *info; | 539 | struct fb_info *info; |
542 | struct s1d13xxxfb_pdata *pdata = NULL; | 540 | struct s1d13xxxfb_pdata *pdata = NULL; |
@@ -548,8 +546,8 @@ s1d13xxxfb_probe(struct device *dev) | |||
548 | printk(KERN_INFO "Epson S1D13XXX FB Driver\n"); | 546 | printk(KERN_INFO "Epson S1D13XXX FB Driver\n"); |
549 | 547 | ||
550 | /* enable platform-dependent hardware glue, if any */ | 548 | /* enable platform-dependent hardware glue, if any */ |
551 | if (dev->platform_data) | 549 | if (pdev->dev.platform_data) |
552 | pdata = dev->platform_data; | 550 | pdata = pdev->dev.platform_data; |
553 | 551 | ||
554 | if (pdata && pdata->platform_init_video) | 552 | if (pdata && pdata->platform_init_video) |
555 | pdata->platform_init_video(); | 553 | pdata->platform_init_video(); |
@@ -572,14 +570,14 @@ s1d13xxxfb_probe(struct device *dev) | |||
572 | 570 | ||
573 | if (!request_mem_region(pdev->resource[0].start, | 571 | if (!request_mem_region(pdev->resource[0].start, |
574 | pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) { | 572 | pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) { |
575 | dev_dbg(dev, "request_mem_region failed\n"); | 573 | dev_dbg(&pdev->dev, "request_mem_region failed\n"); |
576 | ret = -EBUSY; | 574 | ret = -EBUSY; |
577 | goto bail; | 575 | goto bail; |
578 | } | 576 | } |
579 | 577 | ||
580 | if (!request_mem_region(pdev->resource[1].start, | 578 | if (!request_mem_region(pdev->resource[1].start, |
581 | pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) { | 579 | pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) { |
582 | dev_dbg(dev, "request_mem_region failed\n"); | 580 | dev_dbg(&pdev->dev, "request_mem_region failed\n"); |
583 | ret = -EBUSY; | 581 | ret = -EBUSY; |
584 | goto bail; | 582 | goto bail; |
585 | } | 583 | } |
@@ -640,7 +638,7 @@ s1d13xxxfb_probe(struct device *dev) | |||
640 | goto bail; | 638 | goto bail; |
641 | } | 639 | } |
642 | 640 | ||
643 | dev_set_drvdata(&pdev->dev, info); | 641 | platform_set_drvdata(pdev, info); |
644 | 642 | ||
645 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | 643 | printk(KERN_INFO "fb%d: %s frame buffer device\n", |
646 | info->node, info->fix.id); | 644 | info->node, info->fix.id); |
@@ -648,15 +646,15 @@ s1d13xxxfb_probe(struct device *dev) | |||
648 | return 0; | 646 | return 0; |
649 | 647 | ||
650 | bail: | 648 | bail: |
651 | s1d13xxxfb_remove(dev); | 649 | s1d13xxxfb_remove(pdev); |
652 | return ret; | 650 | return ret; |
653 | 651 | ||
654 | } | 652 | } |
655 | 653 | ||
656 | #ifdef CONFIG_PM | 654 | #ifdef CONFIG_PM |
657 | static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state) | 655 | static int s1d13xxxfb_suspend(struct platform_device *dev, pm_message_t state) |
658 | { | 656 | { |
659 | struct fb_info *info = dev_get_drvdata(dev); | 657 | struct fb_info *info = platform_get_drvdata(dev); |
660 | struct s1d13xxxfb_par *s1dfb = info->par; | 658 | struct s1d13xxxfb_par *s1dfb = info->par; |
661 | struct s1d13xxxfb_pdata *pdata = NULL; | 659 | struct s1d13xxxfb_pdata *pdata = NULL; |
662 | 660 | ||
@@ -664,8 +662,8 @@ static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state) | |||
664 | lcd_enable(s1dfb, 0); | 662 | lcd_enable(s1dfb, 0); |
665 | crt_enable(s1dfb, 0); | 663 | crt_enable(s1dfb, 0); |
666 | 664 | ||
667 | if (dev->platform_data) | 665 | if (dev->dev.platform_data) |
668 | pdata = dev->platform_data; | 666 | pdata = dev->dev.platform_data; |
669 | 667 | ||
670 | #if 0 | 668 | #if 0 |
671 | if (!s1dfb->disp_save) | 669 | if (!s1dfb->disp_save) |
@@ -701,9 +699,9 @@ static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state) | |||
701 | return 0; | 699 | return 0; |
702 | } | 700 | } |
703 | 701 | ||
704 | static int s1d13xxxfb_resume(struct device *dev) | 702 | static int s1d13xxxfb_resume(struct platform_device *dev) |
705 | { | 703 | { |
706 | struct fb_info *info = dev_get_drvdata(dev); | 704 | struct fb_info *info = platform_get_drvdata(dev); |
707 | struct s1d13xxxfb_par *s1dfb = info->par; | 705 | struct s1d13xxxfb_par *s1dfb = info->par; |
708 | struct s1d13xxxfb_pdata *pdata = NULL; | 706 | struct s1d13xxxfb_pdata *pdata = NULL; |
709 | 707 | ||
@@ -714,8 +712,8 @@ static int s1d13xxxfb_resume(struct device *dev) | |||
714 | while ((s1d13xxxfb_readreg(s1dfb, S1DREG_PS_STATUS) & 0x01)) | 712 | while ((s1d13xxxfb_readreg(s1dfb, S1DREG_PS_STATUS) & 0x01)) |
715 | udelay(10); | 713 | udelay(10); |
716 | 714 | ||
717 | if (dev->platform_data) | 715 | if (dev->dev.platform_data) |
718 | pdata = dev->platform_data; | 716 | pdata = dev->dev.platform_data; |
719 | 717 | ||
720 | if (s1dfb->regs_save) { | 718 | if (s1dfb->regs_save) { |
721 | /* will write RO regs, *should* get away with it :) */ | 719 | /* will write RO regs, *should* get away with it :) */ |
@@ -741,15 +739,16 @@ static int s1d13xxxfb_resume(struct device *dev) | |||
741 | } | 739 | } |
742 | #endif /* CONFIG_PM */ | 740 | #endif /* CONFIG_PM */ |
743 | 741 | ||
744 | static struct device_driver s1d13xxxfb_driver = { | 742 | static struct platform_driver s1d13xxxfb_driver = { |
745 | .name = S1D_DEVICENAME, | ||
746 | .bus = &platform_bus_type, | ||
747 | .probe = s1d13xxxfb_probe, | 743 | .probe = s1d13xxxfb_probe, |
748 | .remove = s1d13xxxfb_remove, | 744 | .remove = s1d13xxxfb_remove, |
749 | #ifdef CONFIG_PM | 745 | #ifdef CONFIG_PM |
750 | .suspend = s1d13xxxfb_suspend, | 746 | .suspend = s1d13xxxfb_suspend, |
751 | .resume = s1d13xxxfb_resume | 747 | .resume = s1d13xxxfb_resume, |
752 | #endif | 748 | #endif |
749 | .driver = { | ||
750 | .name = S1D_DEVICENAME, | ||
751 | }, | ||
753 | }; | 752 | }; |
754 | 753 | ||
755 | 754 | ||
@@ -759,14 +758,14 @@ s1d13xxxfb_init(void) | |||
759 | if (fb_get_options("s1d13xxxfb", NULL)) | 758 | if (fb_get_options("s1d13xxxfb", NULL)) |
760 | return -ENODEV; | 759 | return -ENODEV; |
761 | 760 | ||
762 | return driver_register(&s1d13xxxfb_driver); | 761 | return platform_driver_register(&s1d13xxxfb_driver); |
763 | } | 762 | } |
764 | 763 | ||
765 | 764 | ||
766 | static void __exit | 765 | static void __exit |
767 | s1d13xxxfb_exit(void) | 766 | s1d13xxxfb_exit(void) |
768 | { | 767 | { |
769 | driver_unregister(&s1d13xxxfb_driver); | 768 | platform_driver_unregister(&s1d13xxxfb_driver); |
770 | } | 769 | } |
771 | 770 | ||
772 | module_init(s1d13xxxfb_init); | 771 | module_init(s1d13xxxfb_init); |
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 855a6778b9eb..ce6e749db3a7 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c | |||
@@ -634,19 +634,18 @@ static irqreturn_t s3c2410fb_irq(int irq, void *dev_id, struct pt_regs *r) | |||
634 | 634 | ||
635 | static char driver_name[]="s3c2410fb"; | 635 | static char driver_name[]="s3c2410fb"; |
636 | 636 | ||
637 | int __init s3c2410fb_probe(struct device *dev) | 637 | int __init s3c2410fb_probe(struct platform_device *pdev) |
638 | { | 638 | { |
639 | struct s3c2410fb_info *info; | 639 | struct s3c2410fb_info *info; |
640 | struct fb_info *fbinfo; | 640 | struct fb_info *fbinfo; |
641 | struct platform_device *pdev = to_platform_device(dev); | ||
642 | struct s3c2410fb_hw *mregs; | 641 | struct s3c2410fb_hw *mregs; |
643 | int ret; | 642 | int ret; |
644 | int irq; | 643 | int irq; |
645 | int i; | 644 | int i; |
646 | 645 | ||
647 | mach_info = dev->platform_data; | 646 | mach_info = pdev->dev.platform_data; |
648 | if (mach_info == NULL) { | 647 | if (mach_info == NULL) { |
649 | dev_err(dev,"no platform data for lcd, cannot attach\n"); | 648 | dev_err(&pdev->dev,"no platform data for lcd, cannot attach\n"); |
650 | return -EINVAL; | 649 | return -EINVAL; |
651 | } | 650 | } |
652 | 651 | ||
@@ -654,11 +653,11 @@ int __init s3c2410fb_probe(struct device *dev) | |||
654 | 653 | ||
655 | irq = platform_get_irq(pdev, 0); | 654 | irq = platform_get_irq(pdev, 0); |
656 | if (irq < 0) { | 655 | if (irq < 0) { |
657 | dev_err(dev, "no irq for device\n"); | 656 | dev_err(&pdev->dev, "no irq for device\n"); |
658 | return -ENOENT; | 657 | return -ENOENT; |
659 | } | 658 | } |
660 | 659 | ||
661 | fbinfo = framebuffer_alloc(sizeof(struct s3c2410fb_info), dev); | 660 | fbinfo = framebuffer_alloc(sizeof(struct s3c2410fb_info), &pdev->dev); |
662 | if (!fbinfo) { | 661 | if (!fbinfo) { |
663 | return -ENOMEM; | 662 | return -ENOMEM; |
664 | } | 663 | } |
@@ -666,7 +665,7 @@ int __init s3c2410fb_probe(struct device *dev) | |||
666 | 665 | ||
667 | info = fbinfo->par; | 666 | info = fbinfo->par; |
668 | info->fb = fbinfo; | 667 | info->fb = fbinfo; |
669 | dev_set_drvdata(dev, fbinfo); | 668 | platform_set_drvdata(pdev, fbinfo); |
670 | 669 | ||
671 | s3c2410fb_init_registers(info); | 670 | s3c2410fb_init_registers(info); |
672 | 671 | ||
@@ -676,7 +675,7 @@ int __init s3c2410fb_probe(struct device *dev) | |||
676 | 675 | ||
677 | memcpy(&info->regs, &mach_info->regs, sizeof(info->regs)); | 676 | memcpy(&info->regs, &mach_info->regs, sizeof(info->regs)); |
678 | 677 | ||
679 | info->mach_info = dev->platform_data; | 678 | info->mach_info = pdev->dev.platform_data; |
680 | 679 | ||
681 | fbinfo->fix.type = FB_TYPE_PACKED_PIXELS; | 680 | fbinfo->fix.type = FB_TYPE_PACKED_PIXELS; |
682 | fbinfo->fix.type_aux = 0; | 681 | fbinfo->fix.type_aux = 0; |
@@ -735,7 +734,7 @@ int __init s3c2410fb_probe(struct device *dev) | |||
735 | 734 | ||
736 | ret = request_irq(irq, s3c2410fb_irq, SA_INTERRUPT, pdev->name, info); | 735 | ret = request_irq(irq, s3c2410fb_irq, SA_INTERRUPT, pdev->name, info); |
737 | if (ret) { | 736 | if (ret) { |
738 | dev_err(dev, "cannot get irq %d - err %d\n", irq, ret); | 737 | dev_err(&pdev->dev, "cannot get irq %d - err %d\n", irq, ret); |
739 | ret = -EBUSY; | 738 | ret = -EBUSY; |
740 | goto release_mem; | 739 | goto release_mem; |
741 | } | 740 | } |
@@ -773,7 +772,7 @@ int __init s3c2410fb_probe(struct device *dev) | |||
773 | } | 772 | } |
774 | 773 | ||
775 | /* create device files */ | 774 | /* create device files */ |
776 | device_create_file(dev, &dev_attr_debug); | 775 | device_create_file(&pdev->dev, &dev_attr_debug); |
777 | 776 | ||
778 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | 777 | printk(KERN_INFO "fb%d: %s frame buffer device\n", |
779 | fbinfo->node, fbinfo->fix.id); | 778 | fbinfo->node, fbinfo->fix.id); |
@@ -816,10 +815,9 @@ static void s3c2410fb_stop_lcd(void) | |||
816 | /* | 815 | /* |
817 | * Cleanup | 816 | * Cleanup |
818 | */ | 817 | */ |
819 | static int s3c2410fb_remove(struct device *dev) | 818 | static int s3c2410fb_remove(struct platform_device *pdev) |
820 | { | 819 | { |
821 | struct platform_device *pdev = to_platform_device(dev); | 820 | struct fb_info *fbinfo = platform_get_drvdata(pdev); |
822 | struct fb_info *fbinfo = dev_get_drvdata(dev); | ||
823 | struct s3c2410fb_info *info = fbinfo->par; | 821 | struct s3c2410fb_info *info = fbinfo->par; |
824 | int irq; | 822 | int irq; |
825 | 823 | ||
@@ -847,9 +845,9 @@ static int s3c2410fb_remove(struct device *dev) | |||
847 | 845 | ||
848 | /* suspend and resume support for the lcd controller */ | 846 | /* suspend and resume support for the lcd controller */ |
849 | 847 | ||
850 | static int s3c2410fb_suspend(struct device *dev, pm_message_t state) | 848 | static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state) |
851 | { | 849 | { |
852 | struct fb_info *fbinfo = dev_get_drvdata(dev); | 850 | struct fb_info *fbinfo = platform_get_drvdata(dev); |
853 | struct s3c2410fb_info *info = fbinfo->par; | 851 | struct s3c2410fb_info *info = fbinfo->par; |
854 | 852 | ||
855 | s3c2410fb_stop_lcd(); | 853 | s3c2410fb_stop_lcd(); |
@@ -864,9 +862,9 @@ static int s3c2410fb_suspend(struct device *dev, pm_message_t state) | |||
864 | return 0; | 862 | return 0; |
865 | } | 863 | } |
866 | 864 | ||
867 | static int s3c2410fb_resume(struct device *dev) | 865 | static int s3c2410fb_resume(struct platform_device *dev) |
868 | { | 866 | { |
869 | struct fb_info *fbinfo = dev_get_drvdata(dev); | 867 | struct fb_info *fbinfo = platform_get_drvdata(dev); |
870 | struct s3c2410fb_info *info = fbinfo->par; | 868 | struct s3c2410fb_info *info = fbinfo->par; |
871 | 869 | ||
872 | clk_enable(info->clk); | 870 | clk_enable(info->clk); |
@@ -882,24 +880,25 @@ static int s3c2410fb_resume(struct device *dev) | |||
882 | #define s3c2410fb_resume NULL | 880 | #define s3c2410fb_resume NULL |
883 | #endif | 881 | #endif |
884 | 882 | ||
885 | static struct device_driver s3c2410fb_driver = { | 883 | static struct platform_driver s3c2410fb_driver = { |
886 | .name = "s3c2410-lcd", | ||
887 | .owner = THIS_MODULE, | ||
888 | .bus = &platform_bus_type, | ||
889 | .probe = s3c2410fb_probe, | 884 | .probe = s3c2410fb_probe, |
885 | .remove = s3c2410fb_remove, | ||
890 | .suspend = s3c2410fb_suspend, | 886 | .suspend = s3c2410fb_suspend, |
891 | .resume = s3c2410fb_resume, | 887 | .resume = s3c2410fb_resume, |
892 | .remove = s3c2410fb_remove | 888 | .driver = { |
889 | .name = "s3c2410-lcd", | ||
890 | .owner = THIS_MODULE, | ||
891 | }, | ||
893 | }; | 892 | }; |
894 | 893 | ||
895 | int __devinit s3c2410fb_init(void) | 894 | int __devinit s3c2410fb_init(void) |
896 | { | 895 | { |
897 | return driver_register(&s3c2410fb_driver); | 896 | return platform_driver_register(&s3c2410fb_driver); |
898 | } | 897 | } |
899 | 898 | ||
900 | static void __exit s3c2410fb_cleanup(void) | 899 | static void __exit s3c2410fb_cleanup(void) |
901 | { | 900 | { |
902 | driver_unregister(&s3c2410fb_driver); | 901 | platform_driver_unregister(&s3c2410fb_driver); |
903 | } | 902 | } |
904 | 903 | ||
905 | 904 | ||
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index a5184575cfae..2ea1354e439f 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c | |||
@@ -1308,17 +1308,17 @@ sa1100fb_freq_policy(struct notifier_block *nb, unsigned long val, | |||
1308 | * Power management hooks. Note that we won't be called from IRQ context, | 1308 | * Power management hooks. Note that we won't be called from IRQ context, |
1309 | * unlike the blank functions above, so we may sleep. | 1309 | * unlike the blank functions above, so we may sleep. |
1310 | */ | 1310 | */ |
1311 | static int sa1100fb_suspend(struct device *dev, pm_message_t state) | 1311 | static int sa1100fb_suspend(struct platform_device *dev, pm_message_t state) |
1312 | { | 1312 | { |
1313 | struct sa1100fb_info *fbi = dev_get_drvdata(dev); | 1313 | struct sa1100fb_info *fbi = platform_get_drvdata(dev); |
1314 | 1314 | ||
1315 | set_ctrlr_state(fbi, C_DISABLE_PM); | 1315 | set_ctrlr_state(fbi, C_DISABLE_PM); |
1316 | return 0; | 1316 | return 0; |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | static int sa1100fb_resume(struct device *dev) | 1319 | static int sa1100fb_resume(struct platform_device *dev) |
1320 | { | 1320 | { |
1321 | struct sa1100fb_info *fbi = dev_get_drvdata(dev); | 1321 | struct sa1100fb_info *fbi = platform_get_drvdata(dev); |
1322 | 1322 | ||
1323 | set_ctrlr_state(fbi, C_ENABLE_PM); | 1323 | set_ctrlr_state(fbi, C_ENABLE_PM); |
1324 | return 0; | 1324 | return 0; |
@@ -1452,7 +1452,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev) | |||
1452 | return fbi; | 1452 | return fbi; |
1453 | } | 1453 | } |
1454 | 1454 | ||
1455 | static int __init sa1100fb_probe(struct device *dev) | 1455 | static int __init sa1100fb_probe(struct platform_device *pdev) |
1456 | { | 1456 | { |
1457 | struct sa1100fb_info *fbi; | 1457 | struct sa1100fb_info *fbi; |
1458 | int ret; | 1458 | int ret; |
@@ -1460,7 +1460,7 @@ static int __init sa1100fb_probe(struct device *dev) | |||
1460 | if (!request_mem_region(0xb0100000, 0x10000, "LCD")) | 1460 | if (!request_mem_region(0xb0100000, 0x10000, "LCD")) |
1461 | return -EBUSY; | 1461 | return -EBUSY; |
1462 | 1462 | ||
1463 | fbi = sa1100fb_init_fbinfo(dev); | 1463 | fbi = sa1100fb_init_fbinfo(&pdev->dev); |
1464 | ret = -ENOMEM; | 1464 | ret = -ENOMEM; |
1465 | if (!fbi) | 1465 | if (!fbi) |
1466 | goto failed; | 1466 | goto failed; |
@@ -1488,7 +1488,7 @@ static int __init sa1100fb_probe(struct device *dev) | |||
1488 | */ | 1488 | */ |
1489 | sa1100fb_check_var(&fbi->fb.var, &fbi->fb); | 1489 | sa1100fb_check_var(&fbi->fb.var, &fbi->fb); |
1490 | 1490 | ||
1491 | dev_set_drvdata(dev, fbi); | 1491 | platform_set_drvdata(pdev, fbi); |
1492 | 1492 | ||
1493 | ret = register_framebuffer(&fbi->fb); | 1493 | ret = register_framebuffer(&fbi->fb); |
1494 | if (ret < 0) | 1494 | if (ret < 0) |
@@ -1505,18 +1505,19 @@ static int __init sa1100fb_probe(struct device *dev) | |||
1505 | return 0; | 1505 | return 0; |
1506 | 1506 | ||
1507 | failed: | 1507 | failed: |
1508 | dev_set_drvdata(dev, NULL); | 1508 | platform_set_drvdata(pdev, NULL); |
1509 | kfree(fbi); | 1509 | kfree(fbi); |
1510 | release_mem_region(0xb0100000, 0x10000); | 1510 | release_mem_region(0xb0100000, 0x10000); |
1511 | return ret; | 1511 | return ret; |
1512 | } | 1512 | } |
1513 | 1513 | ||
1514 | static struct device_driver sa1100fb_driver = { | 1514 | static struct platform_driver sa1100fb_driver = { |
1515 | .name = "sa11x0-fb", | ||
1516 | .bus = &platform_bus_type, | ||
1517 | .probe = sa1100fb_probe, | 1515 | .probe = sa1100fb_probe, |
1518 | .suspend = sa1100fb_suspend, | 1516 | .suspend = sa1100fb_suspend, |
1519 | .resume = sa1100fb_resume, | 1517 | .resume = sa1100fb_resume, |
1518 | .driver = { | ||
1519 | .name = "sa11x0-fb", | ||
1520 | }, | ||
1520 | }; | 1521 | }; |
1521 | 1522 | ||
1522 | int __init sa1100fb_init(void) | 1523 | int __init sa1100fb_init(void) |
@@ -1524,7 +1525,7 @@ int __init sa1100fb_init(void) | |||
1524 | if (fb_get_options("sa1100fb", NULL)) | 1525 | if (fb_get_options("sa1100fb", NULL)) |
1525 | return -ENODEV; | 1526 | return -ENODEV; |
1526 | 1527 | ||
1527 | return driver_register(&sa1100fb_driver); | 1528 | return platform_driver_register(&sa1100fb_driver); |
1528 | } | 1529 | } |
1529 | 1530 | ||
1530 | int __init sa1100fb_setup(char *options) | 1531 | int __init sa1100fb_setup(char *options) |
diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c index 2e8769dd345a..7054660767e4 100644 --- a/drivers/video/sgivwfb.c +++ b/drivers/video/sgivwfb.c | |||
@@ -750,9 +750,8 @@ int __init sgivwfb_setup(char *options) | |||
750 | /* | 750 | /* |
751 | * Initialisation | 751 | * Initialisation |
752 | */ | 752 | */ |
753 | static int __init sgivwfb_probe(struct device *device) | 753 | static int __init sgivwfb_probe(struct platform_device *dev) |
754 | { | 754 | { |
755 | struct platform_device *dev = to_platform_device(device); | ||
756 | struct sgivw_par *par; | 755 | struct sgivw_par *par; |
757 | struct fb_info *info; | 756 | struct fb_info *info; |
758 | char *monitor; | 757 | char *monitor; |
@@ -813,7 +812,7 @@ static int __init sgivwfb_probe(struct device *device) | |||
813 | goto fail_register_framebuffer; | 812 | goto fail_register_framebuffer; |
814 | } | 813 | } |
815 | 814 | ||
816 | dev_set_drvdata(&dev->dev, info); | 815 | platform_set_drvdata(dev, info); |
817 | 816 | ||
818 | printk(KERN_INFO "fb%d: SGI DBE frame buffer device, using %ldK of video memory at %#lx\n", | 817 | printk(KERN_INFO "fb%d: SGI DBE frame buffer device, using %ldK of video memory at %#lx\n", |
819 | info->node, sgivwfb_mem_size >> 10, sgivwfb_mem_phys); | 818 | info->node, sgivwfb_mem_size >> 10, sgivwfb_mem_phys); |
@@ -831,9 +830,9 @@ fail_ioremap_regs: | |||
831 | return -ENXIO; | 830 | return -ENXIO; |
832 | } | 831 | } |
833 | 832 | ||
834 | static int sgivwfb_remove(struct device *device) | 833 | static int sgivwfb_remove(struct platform_device *dev) |
835 | { | 834 | { |
836 | struct fb_info *info = dev_get_drvdata(device); | 835 | struct fb_info *info = platform_get_drvdata(dev); |
837 | 836 | ||
838 | if (info) { | 837 | if (info) { |
839 | struct sgivw_par *par = info->par; | 838 | struct sgivw_par *par = info->par; |
@@ -847,11 +846,12 @@ static int sgivwfb_remove(struct device *device) | |||
847 | return 0; | 846 | return 0; |
848 | } | 847 | } |
849 | 848 | ||
850 | static struct device_driver sgivwfb_driver = { | 849 | static struct platform_driver sgivwfb_driver = { |
851 | .name = "sgivwfb", | ||
852 | .bus = &platform_bus_type, | ||
853 | .probe = sgivwfb_probe, | 850 | .probe = sgivwfb_probe, |
854 | .remove = sgivwfb_remove, | 851 | .remove = sgivwfb_remove, |
852 | .driver = { | ||
853 | .name = "sgivwfb", | ||
854 | }, | ||
855 | }; | 855 | }; |
856 | 856 | ||
857 | static struct platform_device *sgivwfb_device; | 857 | static struct platform_device *sgivwfb_device; |
@@ -867,7 +867,7 @@ int __init sgivwfb_init(void) | |||
867 | return -ENODEV; | 867 | return -ENODEV; |
868 | sgivwfb_setup(option); | 868 | sgivwfb_setup(option); |
869 | #endif | 869 | #endif |
870 | ret = driver_register(&sgivwfb_driver); | 870 | ret = platform_driver_register(&sgivwfb_driver); |
871 | if (!ret) { | 871 | if (!ret) { |
872 | sgivwfb_device = platform_device_alloc("sgivwfb", 0); | 872 | sgivwfb_device = platform_device_alloc("sgivwfb", 0); |
873 | if (sgivwfb_device) { | 873 | if (sgivwfb_device) { |
@@ -875,7 +875,7 @@ int __init sgivwfb_init(void) | |||
875 | } else | 875 | } else |
876 | ret = -ENOMEM; | 876 | ret = -ENOMEM; |
877 | if (ret) { | 877 | if (ret) { |
878 | driver_unregister(&sgivwfb_driver); | 878 | platform_driver_unregister(&sgivwfb_driver); |
879 | platform_device_put(sgivwfb_device); | 879 | platform_device_put(sgivwfb_device); |
880 | } | 880 | } |
881 | } | 881 | } |
@@ -890,7 +890,7 @@ MODULE_LICENSE("GPL"); | |||
890 | static void __exit sgivwfb_exit(void) | 890 | static void __exit sgivwfb_exit(void) |
891 | { | 891 | { |
892 | platform_device_unregister(sgivwfb_device); | 892 | platform_device_unregister(sgivwfb_device); |
893 | driver_unregister(&sgivwfb_driver); | 893 | platform_driver_unregister(&sgivwfb_driver); |
894 | } | 894 | } |
895 | 895 | ||
896 | module_exit(sgivwfb_exit); | 896 | module_exit(sgivwfb_exit); |
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index e25eae1a78c1..2c3aa2fcfd91 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
@@ -245,9 +245,8 @@ static int __init vesafb_setup(char *options) | |||
245 | return 0; | 245 | return 0; |
246 | } | 246 | } |
247 | 247 | ||
248 | static int __init vesafb_probe(struct device *device) | 248 | static int __init vesafb_probe(struct platform_device *dev) |
249 | { | 249 | { |
250 | struct platform_device *dev = to_platform_device(device); | ||
251 | struct fb_info *info; | 250 | struct fb_info *info; |
252 | int i, err; | 251 | int i, err; |
253 | unsigned int size_vmode; | 252 | unsigned int size_vmode; |
@@ -480,10 +479,11 @@ err: | |||
480 | return err; | 479 | return err; |
481 | } | 480 | } |
482 | 481 | ||
483 | static struct device_driver vesafb_driver = { | 482 | static struct platform_driver vesafb_driver = { |
484 | .name = "vesafb", | ||
485 | .bus = &platform_bus_type, | ||
486 | .probe = vesafb_probe, | 483 | .probe = vesafb_probe, |
484 | .driver = { | ||
485 | .name = "vesafb", | ||
486 | }, | ||
487 | }; | 487 | }; |
488 | 488 | ||
489 | static struct platform_device vesafb_device = { | 489 | static struct platform_device vesafb_device = { |
@@ -498,12 +498,12 @@ static int __init vesafb_init(void) | |||
498 | /* ignore error return of fb_get_options */ | 498 | /* ignore error return of fb_get_options */ |
499 | fb_get_options("vesafb", &option); | 499 | fb_get_options("vesafb", &option); |
500 | vesafb_setup(option); | 500 | vesafb_setup(option); |
501 | ret = driver_register(&vesafb_driver); | 501 | ret = platform_driver_register(&vesafb_driver); |
502 | 502 | ||
503 | if (!ret) { | 503 | if (!ret) { |
504 | ret = platform_device_register(&vesafb_device); | 504 | ret = platform_device_register(&vesafb_device); |
505 | if (ret) | 505 | if (ret) |
506 | driver_unregister(&vesafb_driver); | 506 | platform_driver_unregister(&vesafb_driver); |
507 | } | 507 | } |
508 | return ret; | 508 | return ret; |
509 | } | 509 | } |
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c index 8794dc5d2466..ffa1ad474226 100644 --- a/drivers/video/vfb.c +++ b/drivers/video/vfb.c | |||
@@ -403,9 +403,8 @@ static void vfb_platform_release(struct device *device) | |||
403 | // This is called when the reference count goes to zero. | 403 | // This is called when the reference count goes to zero. |
404 | } | 404 | } |
405 | 405 | ||
406 | static int __init vfb_probe(struct device *device) | 406 | static int __init vfb_probe(struct platform_device *dev) |
407 | { | 407 | { |
408 | struct platform_device *dev = to_platform_device(device); | ||
409 | struct fb_info *info; | 408 | struct fb_info *info; |
410 | int retval = -ENOMEM; | 409 | int retval = -ENOMEM; |
411 | 410 | ||
@@ -447,7 +446,7 @@ static int __init vfb_probe(struct device *device) | |||
447 | retval = register_framebuffer(info); | 446 | retval = register_framebuffer(info); |
448 | if (retval < 0) | 447 | if (retval < 0) |
449 | goto err2; | 448 | goto err2; |
450 | dev_set_drvdata(&dev->dev, info); | 449 | platform_set_drvdata(dev, info); |
451 | 450 | ||
452 | printk(KERN_INFO | 451 | printk(KERN_INFO |
453 | "fb%d: Virtual frame buffer device, using %ldK of video memory\n", | 452 | "fb%d: Virtual frame buffer device, using %ldK of video memory\n", |
@@ -462,9 +461,9 @@ err: | |||
462 | return retval; | 461 | return retval; |
463 | } | 462 | } |
464 | 463 | ||
465 | static int vfb_remove(struct device *device) | 464 | static int vfb_remove(struct platform_device *dev) |
466 | { | 465 | { |
467 | struct fb_info *info = dev_get_drvdata(device); | 466 | struct fb_info *info = platform_get_drvdata(dev); |
468 | 467 | ||
469 | if (info) { | 468 | if (info) { |
470 | unregister_framebuffer(info); | 469 | unregister_framebuffer(info); |
@@ -474,11 +473,12 @@ static int vfb_remove(struct device *device) | |||
474 | return 0; | 473 | return 0; |
475 | } | 474 | } |
476 | 475 | ||
477 | static struct device_driver vfb_driver = { | 476 | static struct platform_driver vfb_driver = { |
478 | .name = "vfb", | ||
479 | .bus = &platform_bus_type, | ||
480 | .probe = vfb_probe, | 477 | .probe = vfb_probe, |
481 | .remove = vfb_remove, | 478 | .remove = vfb_remove, |
479 | .driver = { | ||
480 | .name = "vfb", | ||
481 | }, | ||
482 | }; | 482 | }; |
483 | 483 | ||
484 | static struct platform_device vfb_device = { | 484 | static struct platform_device vfb_device = { |
@@ -504,12 +504,12 @@ static int __init vfb_init(void) | |||
504 | if (!vfb_enable) | 504 | if (!vfb_enable) |
505 | return -ENXIO; | 505 | return -ENXIO; |
506 | 506 | ||
507 | ret = driver_register(&vfb_driver); | 507 | ret = platform_driver_register(&vfb_driver); |
508 | 508 | ||
509 | if (!ret) { | 509 | if (!ret) { |
510 | ret = platform_device_register(&vfb_device); | 510 | ret = platform_device_register(&vfb_device); |
511 | if (ret) | 511 | if (ret) |
512 | driver_unregister(&vfb_driver); | 512 | platform_driver_unregister(&vfb_driver); |
513 | } | 513 | } |
514 | return ret; | 514 | return ret; |
515 | } | 515 | } |
@@ -520,7 +520,7 @@ module_init(vfb_init); | |||
520 | static void __exit vfb_exit(void) | 520 | static void __exit vfb_exit(void) |
521 | { | 521 | { |
522 | platform_device_unregister(&vfb_device); | 522 | platform_device_unregister(&vfb_device); |
523 | driver_unregister(&vfb_driver); | 523 | platform_driver_unregister(&vfb_driver); |
524 | } | 524 | } |
525 | 525 | ||
526 | module_exit(vfb_exit); | 526 | module_exit(vfb_exit); |
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c index 48e70f153c4b..daa46051f55d 100644 --- a/drivers/video/w100fb.c +++ b/drivers/video/w100fb.c | |||
@@ -437,9 +437,9 @@ static void w100fb_restore_vidmem(struct w100fb_par *par) | |||
437 | } | 437 | } |
438 | } | 438 | } |
439 | 439 | ||
440 | static int w100fb_suspend(struct device *dev, pm_message_t state) | 440 | static int w100fb_suspend(struct platform_device *dev, pm_message_t state) |
441 | { | 441 | { |
442 | struct fb_info *info = dev_get_drvdata(dev); | 442 | struct fb_info *info = platform_get_drvdata(dev); |
443 | struct w100fb_par *par=info->par; | 443 | struct w100fb_par *par=info->par; |
444 | struct w100_tg_info *tg = par->mach->tg; | 444 | struct w100_tg_info *tg = par->mach->tg; |
445 | 445 | ||
@@ -452,9 +452,9 @@ static int w100fb_suspend(struct device *dev, pm_message_t state) | |||
452 | return 0; | 452 | return 0; |
453 | } | 453 | } |
454 | 454 | ||
455 | static int w100fb_resume(struct device *dev) | 455 | static int w100fb_resume(struct platform_device *dev) |
456 | { | 456 | { |
457 | struct fb_info *info = dev_get_drvdata(dev); | 457 | struct fb_info *info = platform_get_drvdata(dev); |
458 | struct w100fb_par *par=info->par; | 458 | struct w100fb_par *par=info->par; |
459 | struct w100_tg_info *tg = par->mach->tg; | 459 | struct w100_tg_info *tg = par->mach->tg; |
460 | 460 | ||
@@ -473,13 +473,12 @@ static int w100fb_resume(struct device *dev) | |||
473 | #endif | 473 | #endif |
474 | 474 | ||
475 | 475 | ||
476 | int __init w100fb_probe(struct device *dev) | 476 | int __init w100fb_probe(struct platform_device *pdev) |
477 | { | 477 | { |
478 | int err = -EIO; | 478 | int err = -EIO; |
479 | struct w100fb_mach_info *inf; | 479 | struct w100fb_mach_info *inf; |
480 | struct fb_info *info = NULL; | 480 | struct fb_info *info = NULL; |
481 | struct w100fb_par *par; | 481 | struct w100fb_par *par; |
482 | struct platform_device *pdev = to_platform_device(dev); | ||
483 | struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 482 | struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
484 | unsigned int chip_id; | 483 | unsigned int chip_id; |
485 | 484 | ||
@@ -522,9 +521,9 @@ int __init w100fb_probe(struct device *dev) | |||
522 | } | 521 | } |
523 | 522 | ||
524 | par = info->par; | 523 | par = info->par; |
525 | dev_set_drvdata(dev, info); | 524 | platform_set_drvdata(pdev, info); |
526 | 525 | ||
527 | inf = dev->platform_data; | 526 | inf = pdev->dev.platform_data; |
528 | par->chip_id = chip_id; | 527 | par->chip_id = chip_id; |
529 | par->mach = inf; | 528 | par->mach = inf; |
530 | par->fastpll_mode = 0; | 529 | par->fastpll_mode = 0; |
@@ -600,10 +599,10 @@ int __init w100fb_probe(struct device *dev) | |||
600 | goto out; | 599 | goto out; |
601 | } | 600 | } |
602 | 601 | ||
603 | device_create_file(dev, &dev_attr_fastpllclk); | 602 | device_create_file(&pdev->dev, &dev_attr_fastpllclk); |
604 | device_create_file(dev, &dev_attr_reg_read); | 603 | device_create_file(&pdev->dev, &dev_attr_reg_read); |
605 | device_create_file(dev, &dev_attr_reg_write); | 604 | device_create_file(&pdev->dev, &dev_attr_reg_write); |
606 | device_create_file(dev, &dev_attr_flip); | 605 | device_create_file(&pdev->dev, &dev_attr_flip); |
607 | 606 | ||
608 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); | 607 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); |
609 | return 0; | 608 | return 0; |
@@ -622,15 +621,15 @@ out: | |||
622 | } | 621 | } |
623 | 622 | ||
624 | 623 | ||
625 | static int w100fb_remove(struct device *dev) | 624 | static int w100fb_remove(struct platform_device *pdev) |
626 | { | 625 | { |
627 | struct fb_info *info = dev_get_drvdata(dev); | 626 | struct fb_info *info = platform_get_drvdata(pdev); |
628 | struct w100fb_par *par=info->par; | 627 | struct w100fb_par *par=info->par; |
629 | 628 | ||
630 | device_remove_file(dev, &dev_attr_fastpllclk); | 629 | device_remove_file(&pdev->dev, &dev_attr_fastpllclk); |
631 | device_remove_file(dev, &dev_attr_reg_read); | 630 | device_remove_file(&pdev->dev, &dev_attr_reg_read); |
632 | device_remove_file(dev, &dev_attr_reg_write); | 631 | device_remove_file(&pdev->dev, &dev_attr_reg_write); |
633 | device_remove_file(dev, &dev_attr_flip); | 632 | device_remove_file(&pdev->dev, &dev_attr_flip); |
634 | 633 | ||
635 | unregister_framebuffer(info); | 634 | unregister_framebuffer(info); |
636 | 635 | ||
@@ -1448,23 +1447,24 @@ static void w100_vsync(void) | |||
1448 | writel(0x00000002, remapped_regs + mmGEN_INT_STATUS); | 1447 | writel(0x00000002, remapped_regs + mmGEN_INT_STATUS); |
1449 | } | 1448 | } |
1450 | 1449 | ||
1451 | static struct device_driver w100fb_driver = { | 1450 | static struct platform_driver w100fb_driver = { |
1452 | .name = "w100fb", | ||
1453 | .bus = &platform_bus_type, | ||
1454 | .probe = w100fb_probe, | 1451 | .probe = w100fb_probe, |
1455 | .remove = w100fb_remove, | 1452 | .remove = w100fb_remove, |
1456 | .suspend = w100fb_suspend, | 1453 | .suspend = w100fb_suspend, |
1457 | .resume = w100fb_resume, | 1454 | .resume = w100fb_resume, |
1455 | .driver = { | ||
1456 | .name = "w100fb", | ||
1457 | }, | ||
1458 | }; | 1458 | }; |
1459 | 1459 | ||
1460 | int __devinit w100fb_init(void) | 1460 | int __devinit w100fb_init(void) |
1461 | { | 1461 | { |
1462 | return driver_register(&w100fb_driver); | 1462 | return platform_driver_register(&w100fb_driver); |
1463 | } | 1463 | } |
1464 | 1464 | ||
1465 | void __exit w100fb_cleanup(void) | 1465 | void __exit w100fb_cleanup(void) |
1466 | { | 1466 | { |
1467 | driver_unregister(&w100fb_driver); | 1467 | platform_driver_unregister(&w100fb_driver); |
1468 | } | 1468 | } |
1469 | 1469 | ||
1470 | module_init(w100fb_init); | 1470 | module_init(w100fb_init); |