/* eeprom_layout_setup() - setup layout struct with the layout data and metadata as dictated by layout_version @layout: A pointer to an existing struct layout. @buf: A buffer initialized with the eeprom data. @buf_size: Size of buf in bytes. @layout version: The version number of the layout.  */
void eeprom_layout_setup(struct eeprom_layout *layout, unsigned char *buf, unsigned int buf_size, int layout_version)
/* eeprom_layout_setup() - setup layout struct with the layout data and metadata as dictated by layout_version @layout: A pointer to an existing struct layout. @buf: A buffer initialized with the eeprom data. @buf_size: Size of buf in bytes. @layout version: The version number of the layout.  */
void eeprom_layout_setup(struct eeprom_layout *layout, unsigned char *buf, unsigned int buf_size, int layout_version)
{
	int i;
	if (layout_version == LAYOUT_VERSION_AUTODETECT)
		layout->layout_version = eeprom_layout_detect(buf);
	else
		layout->layout_version = layout_version;
	eeprom_layout_assign(layout, layout_version);
	layout->data = buf;
	for (i = 0; i < layout->num_of_fields; i++) {
		layout->fields[i].buf = buf;
		buf += layout->fields[i].size;
	}
	layout->data_size = buf_size;
	layout->print = eeprom_layout_print;
	layout->update = eeprom_layout_update_field;
}