diff options
Diffstat (limited to 'drivers/nvmem/rave-sp-eeprom.c')
-rw-r--r-- | drivers/nvmem/rave-sp-eeprom.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/drivers/nvmem/rave-sp-eeprom.c b/drivers/nvmem/rave-sp-eeprom.c index f27491e547..aae337853c 100644 --- a/drivers/nvmem/rave-sp-eeprom.c +++ b/drivers/nvmem/rave-sp-eeprom.c @@ -1,20 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * EEPROM driver for RAVE SP * * Copyright (C) 2017 Zodiac Inflight Innovations - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include <common.h> @@ -292,12 +280,7 @@ static int rave_sp_eeprom_write(void *ctx, unsigned offset, const void *val, siz offset, (void *)val, bytes); } -static const struct nvmem_bus rave_sp_eeprom_nvmem_bus = { - .write = rave_sp_eeprom_write, - .read = rave_sp_eeprom_read, -}; - -static int rave_sp_eeprom_probe(struct device_d *dev) +static int rave_sp_eeprom_probe(struct device *dev) { struct rave_sp *sp = dev->parent->priv; struct nvmem_config config = { 0 }; @@ -305,7 +288,7 @@ static int rave_sp_eeprom_probe(struct device_d *dev) struct nvmem_device *nvmem; u32 reg[2], size; - if (of_property_read_u32_array(dev->device_node, + if (of_property_read_u32_array(dev->of_node, "reg", reg, ARRAY_SIZE(reg))) { dev_err(dev, "Failed to parse \"reg\" property\n"); return -EINVAL; @@ -334,14 +317,15 @@ static int rave_sp_eeprom_probe(struct device_d *dev) /* * If a name is specified via DT, override the above with it. */ - of_property_read_string(dev->device_node, "zii,eeprom-name", + of_property_read_string(dev->of_node, "zii,eeprom-name", &config.name); config.dev = dev; config.priv = eeprom; config.word_size = 1; config.stride = 1; config.size = reg[1]; - config.bus = &rave_sp_eeprom_nvmem_bus; + config.reg_write = rave_sp_eeprom_write; + config.reg_read = rave_sp_eeprom_read; nvmem = nvmem_register(&config); if (IS_ERR(nvmem)) { @@ -356,8 +340,9 @@ static __maybe_unused const struct of_device_id rave_sp_eeprom_of_match[] = { { .compatible = "zii,rave-sp-eeprom" }, {} }; +MODULE_DEVICE_TABLE(of, rave_sp_eeprom_of_match); -static struct driver_d rave_sp_eeprom_driver = { +static struct driver rave_sp_eeprom_driver = { .name = "rave-sp-eeprom", .probe = rave_sp_eeprom_probe, .of_compatible = DRV_OF_COMPAT(rave_sp_eeprom_of_match), |