@@ -24,6 +24,7 @@
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/firmware.h>
+#include <linux/sysdata.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/spi/spi.h>
@@ -184,33 +185,41 @@ static int p54spi_request_firmware(struct ieee80211_hw *dev)
return 0;
}
-static int p54spi_request_eeprom(struct ieee80211_hw *dev)
+static int p54spi_load_new_eeprom(void *context,
+ const struct sysdata_file *sysdata)
{
- struct p54s_priv *priv = dev->priv;
- const struct firmware *eeprom;
+ struct ieee80211_hw *dev = context;
int ret;
- /* allow users to customize their eeprom.
- */
+ ret = p54_parse_eeprom(dev, (void *) sysdata->data,
+ sysdata->size);
+ release_sysdata_file(sysdata);
- ret = request_firmware_direct(&eeprom, "3826.eeprom", &priv->spi->dev);
- if (ret < 0) {
-#ifdef CONFIG_P54_SPI_DEFAULT_EEPROM
- dev_info(&priv->spi->dev, "loading default eeprom...\n");
- ret = p54_parse_eeprom(dev, (void *) p54spi_eeprom,
- sizeof(p54spi_eeprom));
-#else
- dev_err(&priv->spi->dev, "Failed to request user eeprom\n");
-#endif /* CONFIG_P54_SPI_DEFAULT_EEPROM */
- } else {
- dev_info(&priv->spi->dev, "loading user eeprom...\n");
- ret = p54_parse_eeprom(dev, (void *) eeprom->data,
- (int)eeprom->size);
- release_firmware(eeprom);
- }
return ret;
}
+static int p54spi_load_default_eeprom(void *context)
+{
+ struct ieee80211_hw *dev = context;
+
+ return p54_parse_eeprom(dev, (void *) p54spi_eeprom,
+ sizeof(p54spi_eeprom));
+}
+
+static int p54spi_request_eeprom(struct ieee80211_hw *dev)
+{
+ struct p54s_priv *priv = dev->priv;
+ const struct sysdata_file_desc p54_spi_eeprom_sysdata = {
+ SYSDATA_DEFAULT_SYNC(p54spi_load_new_eeprom, dev),
+ .optional = !IS_ENABLED(CONFIG_P54_SPI_DEFAULT_EEPROM),
+ SYSDATA_SYNC_OPT_CB(p54spi_load_default_eeprom, dev),
+ };
+
+ return sysdata_file_request("3826.eeprom",
+ &p54_spi_eeprom_sysdata,
+ &priv->spi->dev);
+}
+
static int p54spi_upload_firmware(struct ieee80211_hw *dev)
{
struct p54s_priv *priv = dev->priv;