diff options
author | Mike Nicholson <mike.nicholson@multitech.com> | 2018-12-19 14:03:43 -0600 |
---|---|---|
committer | Mike Nicholson <mike.nicholson@multitech.com> | 2018-12-19 14:03:43 -0600 |
commit | 8f1a484a6c9e27b893dec6b7535d5fa994d90eb0 (patch) | |
tree | b5532cb0549ce742efc2ac6b3d358445c3a1cfb8 | |
parent | d892b3cd8de9ca9be82cd50bbe337409d5343d8d (diff) | |
download | mtac-8f1a484a6c9e27b893dec6b7535d5fa994d90eb0.tar.gz mtac-8f1a484a6c9e27b893dec6b7535d5fa994d90eb0.tar.bz2 mtac-8f1a484a6c9e27b893dec6b7535d5fa994d90eb0.zip |
Call firmware_request_direct() (no userspace)
-rw-r--r-- | mtac.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -19,6 +19,12 @@ /* accessory card EEPROMs, read outside of driver */ uint8_t mts_ap_eeprom[NUM_AP][512]; EXPORT_SYMBOL(mts_ap_eeprom); + +static const char* eeprom_file_name[NUM_AP] = { +#if NUM_AP > 0 + "1-0050/eeprom", "1-0052/eeprom" +#endif +}; /* info for accessory port (contains function pointers for setup and teardown, * gpio pin list for the device inserted into the port. */ @@ -469,8 +475,6 @@ EXPORT_SYMBOL(mtac_free); static int __init mtac_init(void) { int port_index; -#define MTS_IO_FWNAME_LEN (32) - char fwname[MTS_IO_FWNAME_LEN]; const struct firmware* fw = NULL; int ret; @@ -478,20 +482,17 @@ static int __init mtac_init(void) mutex_lock(&mtac_mutex); for (port_index = 0; port_index < NUM_AP; port_index++) { - snprintf(fwname, MTS_IO_FWNAME_LEN, "mtac%d_eeprom.bin", port_index+1); - fwname[MTS_IO_FWNAME_LEN-1] = '\0'; - mts_ap_eeprom[port_index][0] = 0x00; /* initialize to not present */ - if((ret = request_firmware(&fw, fwname, &mts_io_platform_device->dev)) == 0) { + if((ret = request_firmware_direct(&fw, eeprom_file_name[port_index], &mts_io_platform_device->dev)) == 0) { if(fw->size == sizeof(mts_ap_eeprom[0])) { memcpy(mts_ap_eeprom[port_index], fw->data, sizeof(mts_ap_eeprom[0])); - log_info("EEPROM contents loaded (%s)", fwname); + log_info("EEPROM contents loaded (%s)", eeprom_file_name[port_index]); } else { - log_error("EEPROM invalid size (%s:%d)", fwname, fw->size); + log_error("EEPROM invalid size (%s:%d)", eeprom_file_name[port_index], fw->size); } release_firmware(fw); } else { - log_error("EEPROM unable to read (%s:%d)", fwname, ret); + log_error("EEPROM unable to read (%s:%d)", eeprom_file_name[port_index], ret); } if (mts_ap_eeprom[port_index][0] == 0xFF) |