Commit | Line | Data |
---|---|---|
cdf7545a | 1 | // SPDX-License-Identifier: GPL-2.0 |
697e5a47 AB |
2 | /* |
3 | * RTC subsystem, nvmem interface | |
4 | * | |
5 | * Copyright (C) 2017 Alexandre Belloni | |
697e5a47 AB |
6 | */ |
7 | ||
8 | #include <linux/err.h> | |
9 | #include <linux/types.h> | |
10 | #include <linux/nvmem-consumer.h> | |
11 | #include <linux/rtc.h> | |
697e5a47 | 12 | |
2cc82121 AB |
13 | int rtc_nvmem_register(struct rtc_device *rtc, |
14 | struct nvmem_config *nvmem_config) | |
697e5a47 | 15 | { |
41c9e132 | 16 | struct nvmem_device *nvmem; |
ab3ea36e | 17 | |
4cce9d39 | 18 | if (!nvmem_config) |
2cc82121 | 19 | return -ENODEV; |
697e5a47 | 20 | |
ac75779b | 21 | nvmem_config->dev = rtc->dev.parent; |
4cce9d39 | 22 | nvmem_config->owner = rtc->owner; |
41c9e132 | 23 | nvmem = devm_nvmem_register(rtc->dev.parent, nvmem_config); |
2cc82121 | 24 | |
25ece305 | 25 | return PTR_ERR_OR_ZERO(nvmem); |
697e5a47 | 26 | } |
fd5cd21d | 27 | EXPORT_SYMBOL_GPL(rtc_nvmem_register); |