summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2021-05-24 22:14:43 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-27 14:49:39 +0200
commitb2cd8a2f8eb148366fb974e265f1799e93062ea7 (patch)
tree0e334174deed2b3879f3f57c5f98fe5f4e71c6f4 /drivers/misc
parent2ac99039c568467ea2e593221aa2a741fa63f0b1 (diff)
eeprom: ee1004: Cache current page at initialization of first device only
The value of ee1004_current_page applies to all SPD eeproms connected to the adapter. Therefore it's sufficient if we set ee1004_current_page when the first device is added. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/b9240e58-08bb-3d71-7a9c-9a323b470ab6@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/eeprom/ee1004.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/misc/eeprom/ee1004.c b/drivers/misc/eeprom/ee1004.c
index 460cc22ea85a..d7c693b26d98 100644
--- a/drivers/misc/eeprom/ee1004.c
+++ b/drivers/misc/eeprom/ee1004.c
@@ -187,20 +187,19 @@ static int ee1004_probe(struct i2c_client *client)
}
ee1004_set_page[cnr] = cl;
}
+
+ /* Remember current page to avoid unneeded page select */
+ err = ee1004_get_current_page();
+ if (err < 0)
+ goto err_clients;
+ dev_dbg(&client->dev, "Currently selected page: %d\n", err);
+ ee1004_current_page = err;
} else if (client->adapter != ee1004_set_page[0]->adapter) {
dev_err(&client->dev,
"Driver only supports devices on a single I2C bus\n");
err = -EOPNOTSUPP;
goto err_clients;
}
-
- /* Remember current page to avoid unneeded page select */
- err = ee1004_get_current_page();
- if (err < 0)
- goto err_clients;
- ee1004_current_page = err;
- dev_dbg(&client->dev, "Currently selected page: %d\n",
- ee1004_current_page);
mutex_unlock(&ee1004_bus_lock);
dev_info(&client->dev,