aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartosz Golaszewski <brgl@bgdev.pl>2018-03-19 05:17:11 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-23 11:25:00 -0400
commitf2adff66604d8e565ecd5d11e637df1527986506 (patch)
tree1dd7983b0e7b14819d7bb320a465f4d86511ed7d
parent1f77d1859c3a43a22ae35f68051014c30728efee (diff)
eeprom: at24: rename chip to pdata in at24_probe()
Reflect the purpose of this variable: it contains platform data so name it such. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/misc/eeprom/at24.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 5cdbf5ba8df7..d97e445fa9db 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -519,7 +519,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
519 struct regmap_config regmap_config = { }; 519 struct regmap_config regmap_config = { };
520 struct nvmem_config nvmem_config = { }; 520 struct nvmem_config nvmem_config = { };
521 const struct at24_chip_data *cd = NULL; 521 const struct at24_chip_data *cd = NULL;
522 struct at24_platform_data chip = { }; 522 struct at24_platform_data pdata = { };
523 unsigned int i, num_addresses; 523 unsigned int i, num_addresses;
524 struct at24_data *at24; 524 struct at24_data *at24;
525 bool writable; 525 bool writable;
@@ -527,7 +527,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
527 int err; 527 int err;
528 528
529 if (client->dev.platform_data) { 529 if (client->dev.platform_data) {
530 chip = *(struct at24_platform_data *)client->dev.platform_data; 530 pdata = *(struct at24_platform_data *)client->dev.platform_data;
531 } else { 531 } else {
532 /* 532 /*
533 * The I2C core allows OF nodes compatibles to match against the 533 * The I2C core allows OF nodes compatibles to match against the
@@ -549,32 +549,32 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
549 if (!cd) 549 if (!cd)
550 return -ENODEV; 550 return -ENODEV;
551 551
552 chip.byte_len = cd->byte_len; 552 pdata.byte_len = cd->byte_len;
553 chip.flags = cd->flags; 553 pdata.flags = cd->flags;
554 at24_properties_to_pdata(&client->dev, &chip); 554 at24_properties_to_pdata(&client->dev, &pdata);
555 } 555 }
556 556
557 if (!chip.page_size) { 557 if (!pdata.page_size) {
558 dev_err(&client->dev, "page_size must not be 0!\n"); 558 dev_err(&client->dev, "page_size must not be 0!\n");
559 return -EINVAL; 559 return -EINVAL;
560 } 560 }
561 if (!is_power_of_2(chip.page_size)) 561 if (!is_power_of_2(pdata.page_size))
562 dev_warn(&client->dev, 562 dev_warn(&client->dev,
563 "page_size looks suspicious (no power of 2)!\n"); 563 "page_size looks suspicious (no power of 2)!\n");
564 564
565 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C) && 565 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C) &&
566 !i2c_check_functionality(client->adapter, 566 !i2c_check_functionality(client->adapter,
567 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) 567 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK))
568 chip.page_size = 1; 568 pdata.page_size = 1;
569 569
570 if (chip.flags & AT24_FLAG_TAKE8ADDR) 570 if (pdata.flags & AT24_FLAG_TAKE8ADDR)
571 num_addresses = 8; 571 num_addresses = 8;
572 else 572 else
573 num_addresses = DIV_ROUND_UP(chip.byte_len, 573 num_addresses = DIV_ROUND_UP(pdata.byte_len,
574 (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); 574 (pdata.flags & AT24_FLAG_ADDR16) ? 65536 : 256);
575 575
576 regmap_config.val_bits = 8; 576 regmap_config.val_bits = 8;
577 regmap_config.reg_bits = (chip.flags & AT24_FLAG_ADDR16) ? 16 : 8; 577 regmap_config.reg_bits = (pdata.flags & AT24_FLAG_ADDR16) ? 16 : 8;
578 regmap_config.disable_locking = true; 578 regmap_config.disable_locking = true;
579 579
580 at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + 580 at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) +
@@ -583,9 +583,9 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
583 return -ENOMEM; 583 return -ENOMEM;
584 584
585 mutex_init(&at24->lock); 585 mutex_init(&at24->lock);
586 at24->chip = chip; 586 at24->chip = pdata;
587 at24->num_addresses = num_addresses; 587 at24->num_addresses = num_addresses;
588 at24->offset_adj = at24_get_offset_adj(chip.flags, chip.byte_len); 588 at24->offset_adj = at24_get_offset_adj(pdata.flags, pdata.byte_len);
589 589
590 at24->wp_gpio = devm_gpiod_get_optional(&client->dev, 590 at24->wp_gpio = devm_gpiod_get_optional(&client->dev,
591 "wp", GPIOD_OUT_HIGH); 591 "wp", GPIOD_OUT_HIGH);
@@ -597,16 +597,16 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
597 if (IS_ERR(at24->client[0].regmap)) 597 if (IS_ERR(at24->client[0].regmap))
598 return PTR_ERR(at24->client[0].regmap); 598 return PTR_ERR(at24->client[0].regmap);
599 599
600 if ((chip.flags & AT24_FLAG_SERIAL) && (chip.flags & AT24_FLAG_MAC)) { 600 if ((pdata.flags & AT24_FLAG_SERIAL) && (pdata.flags & AT24_FLAG_MAC)) {
601 dev_err(&client->dev, 601 dev_err(&client->dev,
602 "invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC."); 602 "invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC.");
603 return -EINVAL; 603 return -EINVAL;
604 } 604 }
605 605
606 writable = !(chip.flags & AT24_FLAG_READONLY); 606 writable = !(pdata.flags & AT24_FLAG_READONLY);
607 if (writable) { 607 if (writable) {
608 at24->write_max = min_t(unsigned int, 608 at24->write_max = min_t(unsigned int,
609 chip.page_size, at24_io_limit); 609 pdata.page_size, at24_io_limit);
610 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C) && 610 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C) &&
611 at24->write_max > I2C_SMBUS_BLOCK_MAX) 611 at24->write_max > I2C_SMBUS_BLOCK_MAX)
612 at24->write_max = I2C_SMBUS_BLOCK_MAX; 612 at24->write_max = I2C_SMBUS_BLOCK_MAX;
@@ -660,7 +660,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
660 nvmem_config.priv = at24; 660 nvmem_config.priv = at24;
661 nvmem_config.stride = 1; 661 nvmem_config.stride = 1;
662 nvmem_config.word_size = 1; 662 nvmem_config.word_size = 1;
663 nvmem_config.size = chip.byte_len; 663 nvmem_config.size = pdata.byte_len;
664 664
665 at24->nvmem = nvmem_register(&nvmem_config); 665 at24->nvmem = nvmem_register(&nvmem_config);
666 666
@@ -670,12 +670,12 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
670 } 670 }
671 671
672 dev_info(&client->dev, "%u byte %s EEPROM, %s, %u bytes/write\n", 672 dev_info(&client->dev, "%u byte %s EEPROM, %s, %u bytes/write\n",
673 chip.byte_len, client->name, 673 pdata.byte_len, client->name,
674 writable ? "writable" : "read-only", at24->write_max); 674 writable ? "writable" : "read-only", at24->write_max);
675 675
676 /* export data to kernel code */ 676 /* export data to kernel code */
677 if (chip.setup) 677 if (pdata.setup)
678 chip.setup(at24->nvmem, chip.context); 678 pdata.setup(at24->nvmem, pdata.context);
679 679
680 return 0; 680 return 0;
681 681