2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 04:34:11 +08:00

AT24 fixes for 4.15-rc3

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAlopTtAACgkQEacuoBRx
 13KotRAAyO8Q5poK+XS/SiDCDUHSW+98kZP6wN2210+6LQ48EBA85cGmApdZn2tG
 918JK3y0sYUzto8EhHTadOnCT9wjOMyhRyxAPx8h2qGNm7ET2xTVWsV5GwNWdvCU
 YB9pD8h9+oSakNriNg5uNuLdNnTfVrhYn07dDp3x13uZQ9KfLV+JQtUYUOefZPpW
 Y/RBemDagFLFggwFR968B1TR+2BPcTc6E1BRiUowbIpNTI5507mo24IDTmaQfd/w
 KGMW0UIVO88aTOCQofFt0b80y0g7m6olt2LZZwVZR/Y8FP39OoTf/W7JeHMiatIw
 oFoEyloj96AcHJuV3g2Suc+/qb07oD3cwx09cKnId5j//x8MX9KnZnlfodcAS9Bz
 mcu0TvOSSwrU1vjkIBlkRuGXcnDVhbdOYzymZJ74cr21CznFRZo/Br9GvLI9VE9n
 zPpVD4Nm8UA6FzSPijFOQK97z1l2CP09XJ4tXu+1udGnebN/JtkD9LeVjO7nnv80
 cuEMBe9rgGIHzvAVCzt+rkBGvzKlkTyNVZoz0mPiRiHPKN73NBaahJrVlYXpd92I
 MJUxkvJlOal242pwLvbfcl9pK8y4Y74Is+z969tuQ6KQGNVGI9wizF9Gjbp+CHy5
 waVVGKVkg02s1ONj/iO5oJICWBfhQ3Slj3VTO8zftRr2Oj+3B+c=
 =E17D
 -----END PGP SIGNATURE-----

Merge tag 'at24-4.15-rc3-fixes-for-wolfram' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into i2c/for-current

Sakari fixed a regression introduced during the 4.15 merge window and
David submitted a fix for an issue that has existed in at24 since
introducing nvmem.
This commit is contained in:
Wolfram Sang 2017-12-12 23:08:33 +01:00
commit a3fe09bc03

View File

@ -562,7 +562,7 @@ static ssize_t at24_eeprom_write_i2c(struct at24_data *at24, const char *buf,
static int at24_read(void *priv, unsigned int off, void *val, size_t count)
{
struct at24_data *at24 = priv;
struct i2c_client *client;
struct device *dev = &at24->client[0]->dev;
char *buf = val;
int ret;
@ -572,11 +572,9 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
if (off + count > at24->chip.byte_len)
return -EINVAL;
client = at24_translate_offset(at24, &off);
ret = pm_runtime_get_sync(&client->dev);
ret = pm_runtime_get_sync(dev);
if (ret < 0) {
pm_runtime_put_noidle(&client->dev);
pm_runtime_put_noidle(dev);
return ret;
}
@ -592,7 +590,7 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
status = at24->read_func(at24, buf, off, count);
if (status < 0) {
mutex_unlock(&at24->lock);
pm_runtime_put(&client->dev);
pm_runtime_put(dev);
return status;
}
buf += status;
@ -602,7 +600,7 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
mutex_unlock(&at24->lock);
pm_runtime_put(&client->dev);
pm_runtime_put(dev);
return 0;
}
@ -610,7 +608,7 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
static int at24_write(void *priv, unsigned int off, void *val, size_t count)
{
struct at24_data *at24 = priv;
struct i2c_client *client;
struct device *dev = &at24->client[0]->dev;
char *buf = val;
int ret;
@ -620,11 +618,9 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
if (off + count > at24->chip.byte_len)
return -EINVAL;
client = at24_translate_offset(at24, &off);
ret = pm_runtime_get_sync(&client->dev);
ret = pm_runtime_get_sync(dev);
if (ret < 0) {
pm_runtime_put_noidle(&client->dev);
pm_runtime_put_noidle(dev);
return ret;
}
@ -640,7 +636,7 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
status = at24->write_func(at24, buf, off, count);
if (status < 0) {
mutex_unlock(&at24->lock);
pm_runtime_put(&client->dev);
pm_runtime_put(dev);
return status;
}
buf += status;
@ -650,7 +646,7 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
mutex_unlock(&at24->lock);
pm_runtime_put(&client->dev);
pm_runtime_put(dev);
return 0;
}
@ -880,7 +876,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
at24->nvmem_config.reg_read = at24_read;
at24->nvmem_config.reg_write = at24_write;
at24->nvmem_config.priv = at24;
at24->nvmem_config.stride = 4;
at24->nvmem_config.stride = 1;
at24->nvmem_config.word_size = 1;
at24->nvmem_config.size = chip.byte_len;