Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: aspeed: drop needless struct aspeed_rtc::rtc_dev member

The memory pointed to by the ::rtc_dev member is managed via devres,
and no code in this driver uses it past _probe().

We can drop it from the structure and just use a local temporary
variable, reducing runtime memory consumption by a few bytes.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://lore.kernel.org/r/20250304-rtc-cleanups-v2-3-d4689a71668c@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

André Draszik and committed by
Alexandre Belloni
d19111df afe5f9f9

+8 -8
+8 -8
drivers/rtc/rtc-aspeed.c
··· 8 8 #include <linux/io.h> 9 9 10 10 struct aspeed_rtc { 11 - struct rtc_device *rtc_dev; 12 11 void __iomem *base; 13 12 }; 14 13 ··· 84 85 static int aspeed_rtc_probe(struct platform_device *pdev) 85 86 { 86 87 struct aspeed_rtc *rtc; 88 + struct rtc_device *rtc_dev; 87 89 88 90 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); 89 91 if (!rtc) ··· 94 94 if (IS_ERR(rtc->base)) 95 95 return PTR_ERR(rtc->base); 96 96 97 - rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev); 98 - if (IS_ERR(rtc->rtc_dev)) 99 - return PTR_ERR(rtc->rtc_dev); 97 + rtc_dev = devm_rtc_allocate_device(&pdev->dev); 98 + if (IS_ERR(rtc_dev)) 99 + return PTR_ERR(rtc_dev); 100 100 101 101 platform_set_drvdata(pdev, rtc); 102 102 103 - rtc->rtc_dev->ops = &aspeed_rtc_ops; 104 - rtc->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_1900; 105 - rtc->rtc_dev->range_max = 38814989399LL; /* 3199-12-31 23:59:59 */ 103 + rtc_dev->ops = &aspeed_rtc_ops; 104 + rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_1900; 105 + rtc_dev->range_max = 38814989399LL; /* 3199-12-31 23:59:59 */ 106 106 107 - return devm_rtc_register_device(rtc->rtc_dev); 107 + return devm_rtc_register_device(rtc_dev); 108 108 } 109 109 110 110 static const struct of_device_id aspeed_rtc_match[] = {