--- zzzz-none-000/linux-3.10.107/sound/usb/6fire/firmware.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/usb/6fire/firmware.c 2021-02-04 17:41:59.000000000 +0000 @@ -219,16 +219,16 @@ ret = request_firmware(&fw, fwname, &device->dev); if (ret < 0) { kfree(rec); - snd_printk(KERN_ERR PREFIX "error requesting ezusb " - "firmware %s.\n", fwname); + dev_err(&intf->dev, + "error requesting ezusb firmware %s.\n", fwname); return ret; } ret = usb6fire_fw_ihex_init(fw, rec); if (ret < 0) { kfree(rec); release_firmware(fw); - snd_printk(KERN_ERR PREFIX "error validating ezusb " - "firmware %s.\n", fwname); + dev_err(&intf->dev, + "error validating ezusb firmware %s.\n", fwname); return ret; } /* upload firmware image */ @@ -237,8 +237,9 @@ if (ret < 0) { kfree(rec); release_firmware(fw); - snd_printk(KERN_ERR PREFIX "unable to upload ezusb " - "firmware %s: begin message.\n", fwname); + dev_err(&intf->dev, + "unable to upload ezusb firmware %s: begin message.\n", + fwname); return ret; } @@ -248,8 +249,9 @@ if (ret < 0) { kfree(rec); release_firmware(fw); - snd_printk(KERN_ERR PREFIX "unable to upload ezusb " - "firmware %s: data urb.\n", fwname); + dev_err(&intf->dev, + "unable to upload ezusb firmware %s: data urb.\n", + fwname); return ret; } } @@ -260,8 +262,9 @@ ret = usb6fire_fw_ezusb_write(device, 0xa0, postaddr, postdata, postlen); if (ret < 0) { - snd_printk(KERN_ERR PREFIX "unable to upload ezusb " - "firmware %s: post urb.\n", fwname); + dev_err(&intf->dev, + "unable to upload ezusb firmware %s: post urb.\n", + fwname); return ret; } } @@ -269,8 +272,9 @@ data = 0x00; /* resume ezusb cpu */ ret = usb6fire_fw_ezusb_write(device, 0xa0, 0xe600, &data, 1); if (ret < 0) { - snd_printk(KERN_ERR PREFIX "unable to upload ezusb " - "firmware %s: end message.\n", fwname); + dev_err(&intf->dev, + "unable to upload ezusb firmware %s: end message.\n", + fwname); return ret; } return 0; @@ -292,7 +296,7 @@ ret = request_firmware(&fw, fwname, &device->dev); if (ret < 0) { - snd_printk(KERN_ERR PREFIX "unable to get fpga firmware %s.\n", + dev_err(&intf->dev, "unable to get fpga firmware %s.\n", fwname); kfree(buffer); return -EIO; @@ -305,21 +309,21 @@ if (ret < 0) { kfree(buffer); release_firmware(fw); - snd_printk(KERN_ERR PREFIX "unable to upload fpga firmware: " - "begin urb.\n"); + dev_err(&intf->dev, + "unable to upload fpga firmware: begin urb.\n"); return ret; } while (c != end) { for (i = 0; c != end && i < FPGA_BUFSIZE; i++, c++) - buffer[i] = byte_rev_table[(u8) *c]; + buffer[i] = bitrev8((u8)*c); ret = usb6fire_fw_fpga_write(device, buffer, i); if (ret < 0) { release_firmware(fw); kfree(buffer); - snd_printk(KERN_ERR PREFIX "unable to upload fpga " - "firmware: fw urb.\n"); + dev_err(&intf->dev, + "unable to upload fpga firmware: fw urb.\n"); return ret; } } @@ -328,8 +332,8 @@ ret = usb6fire_fw_ezusb_write(device, 9, 0, NULL, 0); if (ret < 0) { - snd_printk(KERN_ERR PREFIX "unable to upload fpga firmware: " - "end urb.\n"); + dev_err(&intf->dev, + "unable to upload fpga firmware: end urb.\n"); return ret; } return 0; @@ -338,7 +342,7 @@ /* check, if the firmware version the devices has currently loaded * is known by this driver. 'version' needs to have 4 bytes version * info data. */ -static int usb6fire_fw_check(u8 *version) +static int usb6fire_fw_check(struct usb_interface *intf, const u8 *version) { int i; @@ -346,10 +350,10 @@ if (!memcmp(version, known_fw_versions + i, 2)) return 0; - snd_printk(KERN_ERR PREFIX "invalid fimware version in device: %*ph. " + dev_err(&intf->dev, "invalid fimware version in device: %4ph. " "please reconnect to power. if this failure " "still happens, check your firmware installation.", - 4, version); + version); return -EINVAL; } @@ -364,16 +368,16 @@ ret = usb6fire_fw_ezusb_read(device, 1, 0, buffer, 8); if (ret < 0) { - snd_printk(KERN_ERR PREFIX "unable to receive device " - "firmware state.\n"); + dev_err(&intf->dev, + "unable to receive device firmware state.\n"); return ret; } if (buffer[0] != 0xeb || buffer[1] != 0xaa || buffer[2] != 0x55) { - snd_printk(KERN_ERR PREFIX "unknown device firmware state " - "received from device: "); + dev_err(&intf->dev, + "unknown device firmware state received from device:"); for (i = 0; i < 8; i++) - snd_printk("%02x ", buffer[i]); - snd_printk("\n"); + printk(KERN_CONT "%02x ", buffer[i]); + printk(KERN_CONT "\n"); return -EIO; } /* do we need fpga loader ezusb firmware? */ @@ -386,7 +390,7 @@ } /* do we need fpga firmware and application ezusb firmware? */ else if (buffer[3] == 0x02) { - ret = usb6fire_fw_check(buffer + 4); + ret = usb6fire_fw_check(intf, buffer + 4); if (ret < 0) return ret; ret = usb6fire_fw_fpga_upload(intf, "6fire/dmx6firecf.bin"); @@ -402,14 +406,14 @@ } /* all fw loaded? */ else if (buffer[3] == 0x03) - return usb6fire_fw_check(buffer + 4); + return usb6fire_fw_check(intf, buffer + 4); /* unknown data? */ else { - snd_printk(KERN_ERR PREFIX "unknown device firmware state " - "received from device: "); + dev_err(&intf->dev, + "unknown device firmware state received from device: "); for (i = 0; i < 8; i++) - snd_printk("%02x ", buffer[i]); - snd_printk("\n"); + printk(KERN_CONT "%02x ", buffer[i]); + printk(KERN_CONT "\n"); return -EIO; } return 0;