WIP FPC-III support
[linux/fpc-iii.git] / drivers / rtc / nvmem.c
blob07ede21cee347ce08be451293f8f8d9c4f696341
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * RTC subsystem, nvmem interface
5 * Copyright (C) 2017 Alexandre Belloni
6 */
8 #include <linux/err.h>
9 #include <linux/types.h>
10 #include <linux/nvmem-consumer.h>
11 #include <linux/rtc.h>
13 int devm_rtc_nvmem_register(struct rtc_device *rtc,
14 struct nvmem_config *nvmem_config)
16 struct device *dev = rtc->dev.parent;
17 struct nvmem_device *nvmem;
19 if (!nvmem_config)
20 return -ENODEV;
22 nvmem_config->dev = dev;
23 nvmem_config->owner = rtc->owner;
24 nvmem = devm_nvmem_register(dev, nvmem_config);
25 if (IS_ERR(nvmem))
26 dev_err(dev, "failed to register nvmem device for RTC\n");
28 return PTR_ERR_OR_ZERO(nvmem);
30 EXPORT_SYMBOL_GPL(devm_rtc_nvmem_register);