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

rtc: s35390a: drop needless struct s35390a::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-12-d4689a71668c@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

André Draszik and committed by
Alexandre Belloni
cd2a7052 3b87c687

+11 -11
+11 -11
drivers/rtc/rtc-s35390a.c
··· 63 63 64 64 struct s35390a { 65 65 struct i2c_client *client[8]; 66 - struct rtc_device *rtc; 67 66 int twentyfourhour; 68 67 }; 69 68 ··· 421 422 int err, err_read; 422 423 unsigned int i; 423 424 struct s35390a *s35390a; 425 + struct rtc_device *rtc; 424 426 char buf, status1; 425 427 struct device *dev = &client->dev; 426 428 ··· 447 447 } 448 448 } 449 449 450 - s35390a->rtc = devm_rtc_allocate_device(dev); 451 - if (IS_ERR(s35390a->rtc)) 452 - return PTR_ERR(s35390a->rtc); 450 + rtc = devm_rtc_allocate_device(dev); 451 + if (IS_ERR(rtc)) 452 + return PTR_ERR(rtc); 453 453 454 454 err_read = s35390a_read_status(s35390a, &status1); 455 455 if (err_read < 0) { ··· 480 480 481 481 device_set_wakeup_capable(dev, 1); 482 482 483 - s35390a->rtc->ops = &s35390a_rtc_ops; 484 - s35390a->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; 485 - s35390a->rtc->range_max = RTC_TIMESTAMP_END_2099; 483 + rtc->ops = &s35390a_rtc_ops; 484 + rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; 485 + rtc->range_max = RTC_TIMESTAMP_END_2099; 486 486 487 - set_bit(RTC_FEATURE_ALARM_RES_MINUTE, s35390a->rtc->features); 488 - clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, s35390a->rtc->features ); 487 + set_bit(RTC_FEATURE_ALARM_RES_MINUTE, rtc->features); 488 + clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features); 489 489 490 490 if (status1 & S35390A_FLAG_INT2) 491 - rtc_update_irq(s35390a->rtc, 1, RTC_AF); 491 + rtc_update_irq(rtc, 1, RTC_AF); 492 492 493 - return devm_rtc_register_device(s35390a->rtc); 493 + return devm_rtc_register_device(rtc); 494 494 } 495 495 496 496 static struct i2c_driver s35390a_driver = {