Skip to content
Commit b680f4fa authored by Sven Van Asbroeck's avatar Sven Van Asbroeck Committed by Bartosz Golaszewski
Browse files

eeprom: at24: convert magic numbers to structs

Fundamental properties such as capacity and page size differ among
at24-type chips. But these chips do not have an id register, so this
can't be discovered at runtime.

Traditionally, at24-type eeprom properties were determined in two ways:
- by passing a 'struct at24_platform_data' via platform_data, or
- by naming the chip type in the devicetree, which passes a 'magic
  number' to probe(), which is then converted to a 'struct
  at24_platform_data'.

Recently a bug was discovered because the magic number rounds down all
chip sizes to the lowest power of two. This was addressed by
a work-around commit 5478e478

 ("eeprom: at24: correctly set the
size for at24mac402"), with the wish that magic numbers should over
time be converted to structs.

This patch replaces the magic numbers with 'struct at24_chip_data'.

Signed-off-by: default avatarSven Van Asbroeck <svendev@arcx.com>
Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
parent eef69398
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment