diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2021-05-24 22:17:28 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-05-27 14:49:40 +0200 |
commit | 8700a7328e89371493c267edb4c8812645f6e38b (patch) | |
tree | acb7118b88ebd7ce323110013c34b33837c16e3d /drivers/misc/eeprom | |
parent | eeprom: ee1004: Move call to ee1004_set_current_page to ee1004_eeprom_read (diff) | |
download | linux-8700a7328e89371493c267edb4c8812645f6e38b.tar.xz linux-8700a7328e89371493c267edb4c8812645f6e38b.zip |
eeprom: ee1004: Add constant EE1004_NUM_PAGES
Add a constant for the number of pages.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/6167f9c5-995a-03c3-c324-e93e2a6c969b@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/eeprom')
-rw-r--r-- | drivers/misc/eeprom/ee1004.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/misc/eeprom/ee1004.c b/drivers/misc/eeprom/ee1004.c index 65fe11d8f7d7..5173d040c7ae 100644 --- a/drivers/misc/eeprom/ee1004.c +++ b/drivers/misc/eeprom/ee1004.c @@ -32,16 +32,17 @@ */ #define EE1004_ADDR_SET_PAGE 0x36 -#define EE1004_EEPROM_SIZE 512 +#define EE1004_NUM_PAGES 2 #define EE1004_PAGE_SIZE 256 #define EE1004_PAGE_SHIFT 8 +#define EE1004_EEPROM_SIZE (EE1004_PAGE_SIZE * EE1004_NUM_PAGES) /* * Mutex protects ee1004_set_page and ee1004_dev_count, and must be held * from page selection to end of read. */ static DEFINE_MUTEX(ee1004_bus_lock); -static struct i2c_client *ee1004_set_page[2]; +static struct i2c_client *ee1004_set_page[EE1004_NUM_PAGES]; static unsigned int ee1004_dev_count; static int ee1004_current_page; @@ -172,7 +173,7 @@ static int ee1004_probe(struct i2c_client *client) /* Use 2 dummy devices for page select command */ mutex_lock(&ee1004_bus_lock); if (++ee1004_dev_count == 1) { - for (cnr = 0; cnr < 2; cnr++) { + for (cnr = 0; cnr < EE1004_NUM_PAGES; cnr++) { struct i2c_client *cl; cl = i2c_new_dummy_device(client->adapter, EE1004_ADDR_SET_PAGE + cnr); @@ -222,7 +223,7 @@ static int ee1004_remove(struct i2c_client *client) /* Remove page select clients if this is the last device */ mutex_lock(&ee1004_bus_lock); if (--ee1004_dev_count == 0) { - for (i = 0; i < 2; i++) { + for (i = 0; i < EE1004_NUM_PAGES; i++) { i2c_unregister_device(ee1004_set_page[i]); ee1004_set_page[i] = NULL; } |