diff options
Diffstat (limited to 'drivers/staging/comedi/drivers/jr3_pci.c')
-rw-r--r-- | drivers/staging/comedi/drivers/jr3_pci.c | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index 90b303ab2300..94609f4aa4c9 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c @@ -14,11 +14,6 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ /* * Driver: jr3_pci @@ -46,7 +41,6 @@ #include <linux/pci.h> #include <linux/delay.h> #include <linux/ctype.h> -#include <linux/firmware.h> #include <linux/jiffies.h> #include <linux/slab.h> #include <linux/timer.h> @@ -97,37 +91,6 @@ struct jr3_pci_subdev_private { int retries; }; -/* Hotplug firmware loading stuff */ -static int comedi_load_firmware(struct comedi_device *dev, const char *name, - int (*cb)(struct comedi_device *dev, - const u8 *data, size_t size)) -{ - struct pci_dev *pcidev = comedi_to_pci_dev(dev); - int result = 0; - const struct firmware *fw; - char *firmware_path; - static const char *prefix = "comedi/"; - - firmware_path = kmalloc(strlen(prefix) + strlen(name) + 1, GFP_KERNEL); - if (!firmware_path) { - result = -ENOMEM; - } else { - firmware_path[0] = '\0'; - strcat(firmware_path, prefix); - strcat(firmware_path, name); - result = request_firmware(&fw, firmware_path, &pcidev->dev); - if (result == 0) { - if (!cb) - result = -EINVAL; - else - result = cb(dev, fw->data, fw->size); - release_firmware(fw); - } - kfree(firmware_path); - } - return result; -} - static struct poll_delay_t poll_delay_min_max(int min, int max) { struct poll_delay_t result; @@ -362,8 +325,9 @@ static int read_idm_word(const u8 *data, size_t size, int *pos, return result; } -static int jr3_download_firmware(struct comedi_device *dev, const u8 *data, - size_t size) +static int jr3_download_firmware(struct comedi_device *dev, + const u8 *data, size_t size, + unsigned long context) { /* * IDM file format is: @@ -768,7 +732,9 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, /* Reset DSP card */ writel(0, &devpriv->iobase->channel[0].reset); - result = comedi_load_firmware(dev, "jr3pci.idm", jr3_download_firmware); + result = comedi_load_firmware(dev, &comedi_to_pci_dev(dev)->dev, + "comedi/jr3pci.idm", + jr3_download_firmware, 0); dev_dbg(dev->class_dev, "Firmare load %d\n", result); if (result < 0) @@ -778,8 +744,9 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, * format: * model serial Fx Fy Fz Mx My Mz\n * - * comedi_load_firmware(dev, "jr3_offsets_table", - * jr3_download_firmware); + * comedi_load_firmware(dev, &comedi_to_pci_dev(dev)->dev, + * "comedi/jr3_offsets_table", + * jr3_download_firmware, 1); */ /* |