++
++static struct avila_board_info * __init avila_find_board_info(char *model)
++{
++ int i;
++
++ for (i = 0; i < ARRAY_SIZE(avila_boards); i++) {
++ struct avila_board_info *info = &avila_boards[i];
++ if (strncmp(info->model, model, strlen(info->model)) == 0)
++ return info;
++ }
++
++ return NULL;
++}
++
++struct avila_eeprom_header {
++ unsigned char mac0[ETH_ALEN];
++ unsigned char mac1[ETH_ALEN];
++ unsigned char res0[4];
++ unsigned char magic[2];
++ unsigned char config[14];
++ unsigned char model[16];
++};
++
++static int __init avila_eeprom_notify(struct notifier_block *self,
++ unsigned long event, void *t)
++{
++ struct eeprom_data *ee = t;
++ struct avila_eeprom_header hdr;
++
++ if (avila_info)
++ return NOTIFY_DONE;
++
++ /* The eeprom is at address 0x51 */
++ if (event != EEPROM_REGISTER || ee->client.addr != 0x51)
++ return NOTIFY_DONE;
++
++ ee->attr->read(&ee->client.dev.kobj, ee->attr, (char *)&hdr,
++ 0, sizeof(hdr));
++
++ if (hdr.magic[0] != 'G' || hdr.magic[1] != 'W')
++ return NOTIFY_DONE;
++
++ memcpy(&avila_npeb_data.hwaddr, hdr.mac0, ETH_ALEN);
++ memcpy(&avila_npec_data.hwaddr, hdr.mac1, ETH_ALEN);
++
++ avila_info = avila_find_board_info(hdr.model);
++
++ return NOTIFY_OK;
++}
++
++static struct notifier_block avila_eeprom_notifier __initdata = {
++ .notifier_call = avila_eeprom_notify
++};
++
++static void __init avila_register_eeprom_notifier(void)
++{
++ register_eeprom_notifier(&avila_eeprom_notifier);
++}
++
++static void __init avila_unregister_eeprom_notifier(void)
++{
++ unregister_eeprom_notifier(&avila_eeprom_notifier);
++}
++#else /* CONFIG_SENSORS_EEPROM */
++static inline void avila_register_eeprom_notifier(void) {};
++static inline void avila_unregister_eeprom_notifier(void) {};
++#endif /* CONFIG_SENSORS_EEPROM */