eeprom: at24: remove now unneeded smbus-related code
Remove remaining now unneeded code dealing with SMBUS details. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
This commit is contained in:
parent
dd69a9da71
commit
a23727cb68
@ -513,8 +513,6 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|||||||
struct at24_platform_data chip;
|
struct at24_platform_data chip;
|
||||||
kernel_ulong_t magic = 0;
|
kernel_ulong_t magic = 0;
|
||||||
bool writable;
|
bool writable;
|
||||||
int use_smbus = 0;
|
|
||||||
int use_smbus_write = 0;
|
|
||||||
struct at24_data *at24;
|
struct at24_data *at24;
|
||||||
int err;
|
int err;
|
||||||
unsigned i, num_addresses;
|
unsigned i, num_addresses;
|
||||||
@ -576,33 +574,10 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|||||||
if (chip.flags & AT24_FLAG_MAC && chip.byte_len == 4)
|
if (chip.flags & AT24_FLAG_MAC && chip.byte_len == 4)
|
||||||
chip.byte_len = 6;
|
chip.byte_len = 6;
|
||||||
|
|
||||||
/* Use I2C operations unless we're stuck with SMBus extensions. */
|
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C) &&
|
||||||
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
|
!i2c_check_functionality(client->adapter,
|
||||||
if (chip.flags & AT24_FLAG_ADDR16)
|
I2C_FUNC_SMBUS_WRITE_I2C_BLOCK))
|
||||||
return -EPFNOSUPPORT;
|
chip.page_size = 1;
|
||||||
|
|
||||||
if (i2c_check_functionality(client->adapter,
|
|
||||||
I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
|
|
||||||
use_smbus = I2C_SMBUS_I2C_BLOCK_DATA;
|
|
||||||
} else if (i2c_check_functionality(client->adapter,
|
|
||||||
I2C_FUNC_SMBUS_READ_WORD_DATA)) {
|
|
||||||
use_smbus = I2C_SMBUS_WORD_DATA;
|
|
||||||
} else if (i2c_check_functionality(client->adapter,
|
|
||||||
I2C_FUNC_SMBUS_READ_BYTE_DATA)) {
|
|
||||||
use_smbus = I2C_SMBUS_BYTE_DATA;
|
|
||||||
} else {
|
|
||||||
return -EPFNOSUPPORT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i2c_check_functionality(client->adapter,
|
|
||||||
I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) {
|
|
||||||
use_smbus_write = I2C_SMBUS_I2C_BLOCK_DATA;
|
|
||||||
} else if (i2c_check_functionality(client->adapter,
|
|
||||||
I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) {
|
|
||||||
use_smbus_write = I2C_SMBUS_BYTE_DATA;
|
|
||||||
chip.page_size = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chip.flags & AT24_FLAG_TAKE8ADDR)
|
if (chip.flags & AT24_FLAG_TAKE8ADDR)
|
||||||
num_addresses = 8;
|
num_addresses = 8;
|
||||||
@ -638,19 +613,10 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|||||||
|
|
||||||
writable = !(chip.flags & AT24_FLAG_READONLY);
|
writable = !(chip.flags & AT24_FLAG_READONLY);
|
||||||
if (writable) {
|
if (writable) {
|
||||||
if (!use_smbus || use_smbus_write) {
|
at24->write_max = min_t(unsigned int, chip.page_size, io_limit);
|
||||||
|
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C) &&
|
||||||
unsigned write_max = chip.page_size;
|
at24->write_max > I2C_SMBUS_BLOCK_MAX)
|
||||||
|
at24->write_max = I2C_SMBUS_BLOCK_MAX;
|
||||||
if (write_max > io_limit)
|
|
||||||
write_max = io_limit;
|
|
||||||
if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX)
|
|
||||||
write_max = I2C_SMBUS_BLOCK_MAX;
|
|
||||||
at24->write_max = write_max;
|
|
||||||
} else {
|
|
||||||
dev_warn(&client->dev,
|
|
||||||
"cannot write due to controller restrictions.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* use dummy devices for multiple-address chips */
|
/* use dummy devices for multiple-address chips */
|
||||||
@ -712,12 +678,6 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|||||||
dev_info(&client->dev, "%u byte %s EEPROM, %s, %u bytes/write\n",
|
dev_info(&client->dev, "%u byte %s EEPROM, %s, %u bytes/write\n",
|
||||||
chip.byte_len, client->name,
|
chip.byte_len, client->name,
|
||||||
writable ? "writable" : "read-only", at24->write_max);
|
writable ? "writable" : "read-only", at24->write_max);
|
||||||
if (use_smbus == I2C_SMBUS_WORD_DATA ||
|
|
||||||
use_smbus == I2C_SMBUS_BYTE_DATA) {
|
|
||||||
dev_notice(&client->dev, "Falling back to %s reads, "
|
|
||||||
"performance will suffer\n", use_smbus ==
|
|
||||||
I2C_SMBUS_WORD_DATA ? "word" : "byte");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* export data to kernel code */
|
/* export data to kernel code */
|
||||||
if (chip.setup)
|
if (chip.setup)
|
||||||
|
Loading…
Reference in New Issue
Block a user