|
@@ -370,11 +370,14 @@ static ssize_t at24_regmap_write(struct at24_data *at24, const char *buf,
|
|
|
|
|
|
static int at24_read(void *priv, unsigned int off, void *val, size_t count)
|
|
static int at24_read(void *priv, unsigned int off, void *val, size_t count)
|
|
{
|
|
{
|
|
- struct at24_data *at24 = priv;
|
|
|
|
- struct device *dev = &at24->client[0].client->dev;
|
|
|
|
|
|
+ struct at24_data *at24;
|
|
|
|
+ struct device *dev;
|
|
char *buf = val;
|
|
char *buf = val;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
|
|
+ at24 = priv;
|
|
|
|
+ dev = &at24->client[0].client->dev;
|
|
|
|
+
|
|
if (unlikely(!count))
|
|
if (unlikely(!count))
|
|
return count;
|
|
return count;
|
|
|
|
|
|
@@ -416,11 +419,14 @@ 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)
|
|
static int at24_write(void *priv, unsigned int off, void *val, size_t count)
|
|
{
|
|
{
|
|
- struct at24_data *at24 = priv;
|
|
|
|
- struct device *dev = &at24->client[0].client->dev;
|
|
|
|
|
|
+ struct at24_data *at24;
|
|
|
|
+ struct device *dev;
|
|
char *buf = val;
|
|
char *buf = val;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
|
|
+ at24 = priv;
|
|
|
|
+ dev = &at24->client[0].client->dev;
|
|
|
|
+
|
|
if (unlikely(!count))
|
|
if (unlikely(!count))
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
@@ -515,15 +521,15 @@ static unsigned int at24_get_offset_adj(u8 flags, unsigned int byte_len)
|
|
|
|
|
|
static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|
static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|
{
|
|
{
|
|
- struct at24_platform_data chip = { 0 };
|
|
|
|
- const struct at24_chip_data *cd = NULL;
|
|
|
|
- bool writable;
|
|
|
|
- struct at24_data *at24;
|
|
|
|
- int err;
|
|
|
|
- unsigned int i, num_addresses;
|
|
|
|
struct regmap_config regmap_config = { };
|
|
struct regmap_config regmap_config = { };
|
|
struct nvmem_config nvmem_config = { };
|
|
struct nvmem_config nvmem_config = { };
|
|
|
|
+ const struct at24_chip_data *cd = NULL;
|
|
|
|
+ struct at24_platform_data chip = { 0 };
|
|
|
|
+ unsigned int i, num_addresses;
|
|
|
|
+ struct at24_data *at24;
|
|
|
|
+ bool writable;
|
|
u8 test_byte;
|
|
u8 test_byte;
|
|
|
|
+ int err;
|
|
|
|
|
|
if (client->dev.platform_data) {
|
|
if (client->dev.platform_data) {
|
|
chip = *(struct at24_platform_data *)client->dev.platform_data;
|
|
chip = *(struct at24_platform_data *)client->dev.platform_data;
|