mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 15:10:38 +00:00
eeprom: at24: use a common prefix for all symbols in at24.c
There are a couple symbols defined in the driver source file which are missing the at24_ prefix. This patch fixes that. For module params: use module_param_named() in order to not break userspace. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
This commit is contained in:
parent
aa4ce22897
commit
ec3c2d518b
@ -93,17 +93,17 @@ struct at24_data {
|
|||||||
*
|
*
|
||||||
* This value is forced to be a power of two so that writes align on pages.
|
* This value is forced to be a power of two so that writes align on pages.
|
||||||
*/
|
*/
|
||||||
static unsigned int io_limit = 128;
|
static unsigned int at24_io_limit = 128;
|
||||||
module_param(io_limit, uint, 0);
|
module_param_named(io_limit, at24_io_limit, uint, 0);
|
||||||
MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)");
|
MODULE_PARM_DESC(at24_io_limit, "Maximum bytes per I/O (default 128)");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Specs often allow 5 msec for a page write, sometimes 20 msec;
|
* Specs often allow 5 msec for a page write, sometimes 20 msec;
|
||||||
* it's important to recover from write timeouts.
|
* it's important to recover from write timeouts.
|
||||||
*/
|
*/
|
||||||
static unsigned int write_timeout = 25;
|
static unsigned int at24_write_timeout = 25;
|
||||||
module_param(write_timeout, uint, 0);
|
module_param_named(write_timeout, at24_write_timeout, uint, 0);
|
||||||
MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)");
|
MODULE_PARM_DESC(at24_write_timeout, "Time (in ms) to try writes (default 25)");
|
||||||
|
|
||||||
#define AT24_SIZE_BYTELEN 5
|
#define AT24_SIZE_BYTELEN 5
|
||||||
#define AT24_SIZE_FLAGS 8
|
#define AT24_SIZE_FLAGS 8
|
||||||
@ -126,8 +126,9 @@ MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)");
|
|||||||
* iteration of processing the request. Both should be unsigned integers
|
* iteration of processing the request. Both should be unsigned integers
|
||||||
* holding at least 32 bits.
|
* holding at least 32 bits.
|
||||||
*/
|
*/
|
||||||
#define loop_until_timeout(tout, op_time) \
|
#define at24_loop_until_timeout(tout, op_time) \
|
||||||
for (tout = jiffies + msecs_to_jiffies(write_timeout), op_time = 0; \
|
for (tout = jiffies + msecs_to_jiffies(at24_write_timeout), \
|
||||||
|
op_time = 0; \
|
||||||
op_time ? time_before(op_time, tout) : true; \
|
op_time ? time_before(op_time, tout) : true; \
|
||||||
usleep_range(1000, 1500), op_time = jiffies)
|
usleep_range(1000, 1500), op_time = jiffies)
|
||||||
|
|
||||||
@ -286,8 +287,8 @@ static size_t at24_adjust_read_count(struct at24_data *at24,
|
|||||||
count = remainder;
|
count = remainder;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > io_limit)
|
if (count > at24_io_limit)
|
||||||
count = io_limit;
|
count = at24_io_limit;
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@ -309,7 +310,7 @@ static ssize_t at24_regmap_read(struct at24_data *at24, char *buf,
|
|||||||
/* adjust offset for mac and serial read ops */
|
/* adjust offset for mac and serial read ops */
|
||||||
offset += at24->offset_adj;
|
offset += at24->offset_adj;
|
||||||
|
|
||||||
loop_until_timeout(timeout, read_time) {
|
at24_loop_until_timeout(timeout, read_time) {
|
||||||
ret = regmap_bulk_read(regmap, offset, buf, count);
|
ret = regmap_bulk_read(regmap, offset, buf, count);
|
||||||
dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n",
|
dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n",
|
||||||
count, offset, ret, jiffies);
|
count, offset, ret, jiffies);
|
||||||
@ -360,7 +361,7 @@ static ssize_t at24_regmap_write(struct at24_data *at24, const char *buf,
|
|||||||
client = at24_client->client;
|
client = at24_client->client;
|
||||||
count = at24_adjust_write_count(at24, offset, count);
|
count = at24_adjust_write_count(at24, offset, count);
|
||||||
|
|
||||||
loop_until_timeout(timeout, write_time) {
|
at24_loop_until_timeout(timeout, write_time) {
|
||||||
ret = regmap_bulk_write(regmap, offset, buf, count);
|
ret = regmap_bulk_write(regmap, offset, buf, count);
|
||||||
dev_dbg(&client->dev, "write %zu@%d --> %d (%ld)\n",
|
dev_dbg(&client->dev, "write %zu@%d --> %d (%ld)\n",
|
||||||
count, offset, ret, jiffies);
|
count, offset, ret, jiffies);
|
||||||
@ -628,7 +629,8 @@ 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) {
|
||||||
at24->write_max = min_t(unsigned int, chip.page_size, io_limit);
|
at24->write_max = min_t(unsigned int,
|
||||||
|
chip.page_size, at24_io_limit);
|
||||||
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C) &&
|
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C) &&
|
||||||
at24->write_max > I2C_SMBUS_BLOCK_MAX)
|
at24->write_max > I2C_SMBUS_BLOCK_MAX)
|
||||||
at24->write_max = I2C_SMBUS_BLOCK_MAX;
|
at24->write_max = I2C_SMBUS_BLOCK_MAX;
|
||||||
@ -743,12 +745,12 @@ static struct i2c_driver at24_driver = {
|
|||||||
|
|
||||||
static int __init at24_init(void)
|
static int __init at24_init(void)
|
||||||
{
|
{
|
||||||
if (!io_limit) {
|
if (!at24_io_limit) {
|
||||||
pr_err("at24: io_limit must not be 0!\n");
|
pr_err("at24: at24_io_limit must not be 0!\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
io_limit = rounddown_pow_of_two(io_limit);
|
at24_io_limit = rounddown_pow_of_two(at24_io_limit);
|
||||||
return i2c_add_driver(&at24_driver);
|
return i2c_add_driver(&at24_driver);
|
||||||
}
|
}
|
||||||
module_init(at24_init);
|
module_init(at24_init);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user