From 8f1a484a6c9e27b893dec6b7535d5fa994d90eb0 Mon Sep 17 00:00:00 2001 From: Mike Nicholson Date: Wed, 19 Dec 2018 14:03:43 -0600 Subject: Call firmware_request_direct() (no userspace) --- mtac.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mtac.c b/mtac.c index f6ae07c..ed1f075 100644 --- a/mtac.c +++ b/mtac.c @@ -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) -- cgit v1.2.3