Skip to content

Commit cd2a705

Browse files
andredalexandrebelloni
authored andcommitted
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>
1 parent 3b87c68 commit cd2a705

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

drivers/rtc/rtc-s35390a.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ MODULE_DEVICE_TABLE(of, s35390a_of_match);
6363

6464
struct s35390a {
6565
struct i2c_client *client[8];
66-
struct rtc_device *rtc;
6766
int twentyfourhour;
6867
};
6968

@@ -422,6 +421,7 @@ static int s35390a_probe(struct i2c_client *client)
422421
int err, err_read;
423422
unsigned int i;
424423
struct s35390a *s35390a;
424+
struct rtc_device *rtc;
425425
char buf, status1;
426426
struct device *dev = &client->dev;
427427

@@ -447,9 +447,9 @@ static int s35390a_probe(struct i2c_client *client)
447447
}
448448
}
449449

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);
453453

454454
err_read = s35390a_read_status(s35390a, &status1);
455455
if (err_read < 0) {
@@ -480,17 +480,17 @@ static int s35390a_probe(struct i2c_client *client)
480480

481481
device_set_wakeup_capable(dev, 1);
482482

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;
486486

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);
489489

490490
if (status1 & S35390A_FLAG_INT2)
491-
rtc_update_irq(s35390a->rtc, 1, RTC_AF);
491+
rtc_update_irq(rtc, 1, RTC_AF);
492492

493-
return devm_rtc_register_device(s35390a->rtc);
493+
return devm_rtc_register_device(rtc);
494494
}
495495

496496
static struct i2c_driver s35390a_driver = {

0 commit comments

Comments
 (0)