at24 fixes for v5.9-rc5 - delay registration of the nvmem provider until after power is enabled
Unified · Split
| @@ -692,10 +692,6 @@ static int at24_probe(struct i2c_client *client) · 691 unmodified lines | |||
| 692 | nvmem_config.word_size = 1; | 692 | nvmem_config.word_size = 1; |
| 693 | nvmem_config.size = byte_len; | 693 | nvmem_config.size = byte_len; |
| 694 | 694 | ||
| 695 | at24->nvmem = devm_nvmem_register(dev, &nvmem_config); | ||
| 696 | if (IS_ERR(at24->nvmem)) | ||
| 697 | return PTR_ERR(at24->nvmem); | ||
| 698 | |||
| 699 | i2c_set_clientdata(client, at24); | 695 | i2c_set_clientdata(client, at24); |
| 700 | 696 | ||
| 701 | err = regulator_enable(at24->vcc_reg); | 697 | err = regulator_enable(at24->vcc_reg); |
| @@ -708,6 +704,13 @@ static int at24_probe(struct i2c_client *client) · 6 unmodified lines | |||
| 708 | pm_runtime_set_active(dev); | 704 | pm_runtime_set_active(dev); |
| 709 | pm_runtime_enable(dev); | 705 | pm_runtime_enable(dev); |
| 710 | 706 | ||
| 707 | at24->nvmem = devm_nvmem_register(dev, &nvmem_config); | ||
| 708 | if (IS_ERR(at24->nvmem)) { | ||
| 709 | pm_runtime_disable(dev); | ||
| 710 | regulator_disable(at24->vcc_reg); | ||
| 711 | return PTR_ERR(at24->nvmem); | ||
| 712 | } | ||
| 713 | |||
| 711 | /* | 714 | /* |
| 712 | * Perform a one-byte test read to verify that the | 715 | * Perform a one-byte test read to verify that the |
| 713 | * chip is functional. | 716 | * chip is functional. |