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

rtc: ftrtc010: drop needless struct ftrtc010_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.

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

authored by

André Draszik and committed by
Alexandre Belloni
a55d4480 5d0ad519

+8 -9
+8 -9
drivers/rtc/rtc-ftrtc010.c
··· 28 28 MODULE_ALIAS("platform:" DRV_NAME); 29 29 30 30 struct ftrtc010_rtc { 31 - struct rtc_device *rtc_dev; 32 31 void __iomem *rtc_base; 33 32 int rtc_irq; 34 33 struct clk *pclk; ··· 112 113 struct ftrtc010_rtc *rtc; 113 114 struct device *dev = &pdev->dev; 114 115 struct resource *res; 116 + struct rtc_device *rtc_dev; 115 117 int ret; 116 118 117 119 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); ··· 160 160 goto err_disable_extclk; 161 161 } 162 162 163 - rtc->rtc_dev = devm_rtc_allocate_device(dev); 164 - if (IS_ERR(rtc->rtc_dev)) { 165 - ret = PTR_ERR(rtc->rtc_dev); 163 + rtc_dev = devm_rtc_allocate_device(dev); 164 + if (IS_ERR(rtc_dev)) { 165 + ret = PTR_ERR(rtc_dev); 166 166 goto err_disable_extclk; 167 167 } 168 168 169 - rtc->rtc_dev->ops = &ftrtc010_rtc_ops; 169 + rtc_dev->ops = &ftrtc010_rtc_ops; 170 170 171 171 sec = readl(rtc->rtc_base + FTRTC010_RTC_SECOND); 172 172 min = readl(rtc->rtc_base + FTRTC010_RTC_MINUTE); 173 173 hour = readl(rtc->rtc_base + FTRTC010_RTC_HOUR); 174 174 days = readl(rtc->rtc_base + FTRTC010_RTC_DAYS); 175 175 176 - rtc->rtc_dev->range_min = (u64)days * 86400 + hour * 3600 + 177 - min * 60 + sec; 178 - rtc->rtc_dev->range_max = U32_MAX + rtc->rtc_dev->range_min; 176 + rtc_dev->range_min = (u64)days * 86400 + hour * 3600 + min * 60 + sec; 177 + rtc_dev->range_max = U32_MAX + rtc_dev->range_min; 179 178 180 179 ret = devm_request_irq(dev, rtc->rtc_irq, ftrtc010_rtc_interrupt, 181 180 IRQF_SHARED, pdev->name, dev); 182 181 if (unlikely(ret)) 183 182 goto err_disable_extclk; 184 183 185 - return devm_rtc_register_device(rtc->rtc_dev); 184 + return devm_rtc_register_device(rtc_dev); 186 185 187 186 err_disable_extclk: 188 187 clk_disable_unprepare(rtc->extclk);