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

rtc: m48t86: drop needless struct m48t86_rtc_info::rtc member

The memory pointed to by the ::rtc 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-7-d4689a71668c@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

André Draszik and committed by
Alexandre Belloni
013df5bd a55d4480

+7 -7
+7 -7
drivers/rtc/rtc-m48t86.c
··· 41 41 struct m48t86_rtc_info { 42 42 void __iomem *index_reg; 43 43 void __iomem *data_reg; 44 - struct rtc_device *rtc; 45 44 }; 46 45 47 46 static unsigned char m48t86_readb(struct device *dev, unsigned long addr) ··· 218 219 static int m48t86_rtc_probe(struct platform_device *pdev) 219 220 { 220 221 struct m48t86_rtc_info *info; 222 + struct rtc_device *rtc; 221 223 unsigned char reg; 222 224 int err; 223 225 struct nvmem_config m48t86_nvmem_cfg = { ··· 250 250 return -ENODEV; 251 251 } 252 252 253 - info->rtc = devm_rtc_allocate_device(&pdev->dev); 254 - if (IS_ERR(info->rtc)) 255 - return PTR_ERR(info->rtc); 253 + rtc = devm_rtc_allocate_device(&pdev->dev); 254 + if (IS_ERR(rtc)) 255 + return PTR_ERR(rtc); 256 256 257 - info->rtc->ops = &m48t86_rtc_ops; 257 + rtc->ops = &m48t86_rtc_ops; 258 258 259 - err = devm_rtc_register_device(info->rtc); 259 + err = devm_rtc_register_device(rtc); 260 260 if (err) 261 261 return err; 262 262 263 - devm_rtc_nvmem_register(info->rtc, &m48t86_nvmem_cfg); 263 + devm_rtc_nvmem_register(rtc, &m48t86_nvmem_cfg); 264 264 265 265 /* read battery status */ 266 266 reg = m48t86_readb(&pdev->dev, M48T86_D);