diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 19:54:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 19:54:07 -0400 |
commit | 5a86102248592e178a9023359ccf7f0e489d8e35 (patch) | |
tree | 9e5fdb9aafca687fa412f7c034f2cfbb834b8567 /drivers/char/ip2/ip2main.c | |
parent | 85082fd7cbe3173198aac0eb5e85ab1edcc6352c (diff) | |
parent | 751851af7aae9b8bd5a60b3897209081fbc18b2b (diff) |
Merge branch 'for-2.6.27' of git://git.infradead.org/users/dwmw2/firmware-2.6
* 'for-2.6.27' of git://git.infradead.org/users/dwmw2/firmware-2.6: (64 commits)
firmware: convert sb16_csp driver to use firmware loader exclusively
dsp56k: use request_firmware
edgeport-ti: use request_firmware()
edgeport: use request_firmware()
vicam: use request_firmware()
dabusb: use request_firmware()
cpia2: use request_firmware()
ip2: use request_firmware()
firmware: convert Ambassador ATM driver to request_firmware()
whiteheat: use request_firmware()
ti_usb_3410_5052: use request_firmware()
emi62: use request_firmware()
emi26: use request_firmware()
keyspan_pda: use request_firmware()
keyspan: use request_firmware()
ttusb-budget: use request_firmware()
kaweth: use request_firmware()
smctr: use request_firmware()
firmware: convert ymfpci driver to use firmware loader exclusively
firmware: convert maestro3 driver to use firmware loader exclusively
...
Fix up trivial conflicts with BKL removal in drivers/char/dsp56k.c and
drivers/char/ip2/ip2main.c manually.
Diffstat (limited to 'drivers/char/ip2/ip2main.c')
-rw-r--r-- | drivers/char/ip2/ip2main.c | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 61b6fe4156bb..9a2394cda943 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -99,6 +99,8 @@ | |||
99 | #include <linux/wait.h> | 99 | #include <linux/wait.h> |
100 | #include <linux/device.h> | 100 | #include <linux/device.h> |
101 | #include <linux/smp_lock.h> | 101 | #include <linux/smp_lock.h> |
102 | #include <linux/firmware.h> | ||
103 | #include <linux/platform_device.h> | ||
102 | 104 | ||
103 | #include <linux/tty.h> | 105 | #include <linux/tty.h> |
104 | #include <linux/tty_flip.h> | 106 | #include <linux/tty_flip.h> |
@@ -156,9 +158,7 @@ static char *pcDriver_name = "ip2"; | |||
156 | static char *pcIpl = "ip2ipl"; | 158 | static char *pcIpl = "ip2ipl"; |
157 | 159 | ||
158 | // cheezy kludge or genius - you decide? | 160 | // cheezy kludge or genius - you decide? |
159 | int ip2_loadmain(int *, int *, unsigned char *, int); | 161 | int ip2_loadmain(int *, int *); |
160 | static unsigned char *Fip_firmware; | ||
161 | static int Fip_firmware_size; | ||
162 | 162 | ||
163 | /***********************/ | 163 | /***********************/ |
164 | /* Function Prototypes */ | 164 | /* Function Prototypes */ |
@@ -209,7 +209,7 @@ static int ip2_ipl_open(struct inode *, struct file *); | |||
209 | static int DumpTraceBuffer(char __user *, int); | 209 | static int DumpTraceBuffer(char __user *, int); |
210 | static int DumpFifoBuffer( char __user *, int); | 210 | static int DumpFifoBuffer( char __user *, int); |
211 | 211 | ||
212 | static void ip2_init_board(int); | 212 | static void ip2_init_board(int, const struct firmware *); |
213 | static unsigned short find_eisa_board(int); | 213 | static unsigned short find_eisa_board(int); |
214 | 214 | ||
215 | /***************/ | 215 | /***************/ |
@@ -475,8 +475,27 @@ static const struct tty_operations ip2_ops = { | |||
475 | /* SA_RANDOM - can be source for cert. random number generators */ | 475 | /* SA_RANDOM - can be source for cert. random number generators */ |
476 | #define IP2_SA_FLAGS 0 | 476 | #define IP2_SA_FLAGS 0 |
477 | 477 | ||
478 | |||
479 | static const struct firmware *ip2_request_firmware(void) | ||
480 | { | ||
481 | struct platform_device *pdev; | ||
482 | const struct firmware *fw; | ||
483 | |||
484 | pdev = platform_device_register_simple("ip2", 0, NULL, 0); | ||
485 | if (IS_ERR(pdev)) { | ||
486 | printk(KERN_ERR "Failed to register platform device for ip2\n"); | ||
487 | return NULL; | ||
488 | } | ||
489 | if (request_firmware(&fw, "intelliport2.bin", &pdev->dev)) { | ||
490 | printk(KERN_ERR "Failed to load firmware 'intelliport2.bin'\n"); | ||
491 | fw = NULL; | ||
492 | } | ||
493 | platform_device_unregister(pdev); | ||
494 | return fw; | ||
495 | } | ||
496 | |||
478 | int | 497 | int |
479 | ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | 498 | ip2_loadmain(int *iop, int *irqp) |
480 | { | 499 | { |
481 | int i, j, box; | 500 | int i, j, box; |
482 | int err = 0; | 501 | int err = 0; |
@@ -484,6 +503,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
484 | i2eBordStrPtr pB = NULL; | 503 | i2eBordStrPtr pB = NULL; |
485 | int rc = -1; | 504 | int rc = -1; |
486 | static struct pci_dev *pci_dev_i = NULL; | 505 | static struct pci_dev *pci_dev_i = NULL; |
506 | const struct firmware *fw = NULL; | ||
487 | 507 | ||
488 | ip2trace (ITRC_NO_PORT, ITRC_INIT, ITRC_ENTER, 0 ); | 508 | ip2trace (ITRC_NO_PORT, ITRC_INIT, ITRC_ENTER, 0 ); |
489 | 509 | ||
@@ -517,9 +537,6 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
517 | } | 537 | } |
518 | poll_only = !poll_only; | 538 | poll_only = !poll_only; |
519 | 539 | ||
520 | Fip_firmware = firmware; | ||
521 | Fip_firmware_size = firmsize; | ||
522 | |||
523 | /* Announce our presence */ | 540 | /* Announce our presence */ |
524 | printk( KERN_INFO "%s version %s\n", pcName, pcVersion ); | 541 | printk( KERN_INFO "%s version %s\n", pcName, pcVersion ); |
525 | 542 | ||
@@ -639,10 +656,18 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
639 | } | 656 | } |
640 | } | 657 | } |
641 | for ( i = 0; i < IP2_MAX_BOARDS; ++i ) { | 658 | for ( i = 0; i < IP2_MAX_BOARDS; ++i ) { |
659 | /* We don't want to request the firmware unless we have at | ||
660 | least one board */ | ||
642 | if ( i2BoardPtrTable[i] != NULL ) { | 661 | if ( i2BoardPtrTable[i] != NULL ) { |
643 | ip2_init_board( i ); | 662 | if (!fw) |
663 | fw = ip2_request_firmware(); | ||
664 | if (!fw) | ||
665 | break; | ||
666 | ip2_init_board(i, fw); | ||
644 | } | 667 | } |
645 | } | 668 | } |
669 | if (fw) | ||
670 | release_firmware(fw); | ||
646 | 671 | ||
647 | ip2trace (ITRC_NO_PORT, ITRC_INIT, 2, 0 ); | 672 | ip2trace (ITRC_NO_PORT, ITRC_INIT, 2, 0 ); |
648 | 673 | ||
@@ -770,7 +795,7 @@ out: | |||
770 | /* are reported on the console. */ | 795 | /* are reported on the console. */ |
771 | /******************************************************************************/ | 796 | /******************************************************************************/ |
772 | static void | 797 | static void |
773 | ip2_init_board( int boardnum ) | 798 | ip2_init_board(int boardnum, const struct firmware *fw) |
774 | { | 799 | { |
775 | int i; | 800 | int i; |
776 | int nports = 0, nboxes = 0; | 801 | int nports = 0, nboxes = 0; |
@@ -790,7 +815,7 @@ ip2_init_board( int boardnum ) | |||
790 | goto err_initialize; | 815 | goto err_initialize; |
791 | } | 816 | } |
792 | 817 | ||
793 | if ( iiDownloadAll ( pB, (loadHdrStrPtr)Fip_firmware, 1, Fip_firmware_size ) | 818 | if ( iiDownloadAll ( pB, (loadHdrStrPtr)fw->data, 1, fw->size ) |
794 | != II_DOWN_GOOD ) { | 819 | != II_DOWN_GOOD ) { |
795 | printk ( KERN_ERR "IP2: failed to download loadware\n" ); | 820 | printk ( KERN_ERR "IP2: failed to download loadware\n" ); |
796 | goto err_release_region; | 821 | goto err_release_region; |