diff options
author | Samuel Holland <samuel@sholland.org> | 2021-09-28 11:03:32 +0300 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2021-10-24 00:50:27 +0300 |
commit | 814691c7f7d1f958ac30c3dca5070a95c1f658dd (patch) | |
tree | 2f1459862203d20f4db9b73e3b22676e5188da53 /drivers/rtc | |
parent | f8d4e4fa51ec817edfee49c173521a1102f7f7a6 (diff) | |
download | linux-814691c7f7d1f958ac30c3dca5070a95c1f658dd.tar.xz |
rtc: sun6i: Allow probing without an early clock provider
Some SoCs have an RTC supported by this RTC driver, but do not have an
early clock provider declared here. Currently, this prevents the RTC
driver from probing, because it expects a global struct to already be
allocated. Fix probing the driver by copying the missing pieces from the
clock provider setup function, replacing them with the devm variants.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210928080335.36706-7-samuel@sholland.org
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-sun6i.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index adec1b14a8de..711832c758ae 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -673,8 +673,17 @@ static int sun6i_rtc_probe(struct platform_device *pdev) struct sun6i_rtc_dev *chip = sun6i_rtc; int ret; - if (!chip) - return -ENODEV; + if (!chip) { + chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + spin_lock_init(&chip->lock); + + chip->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(chip->base)) + return PTR_ERR(chip->base); + } platform_set_drvdata(pdev, chip); |