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

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

Tested-by: Tóth János <gomba007@gmail.com>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://lore.kernel.org/r/20250304-rtc-cleanups-v2-13-d4689a71668c@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

André Draszik and committed by
Alexandre Belloni
d94bc2bb cd2a7052

+8 -8
+8 -8
drivers/rtc/rtc-sd2405al.c
··· 42 42 43 43 struct sd2405al { 44 44 struct device *dev; 45 - struct rtc_device *rtc; 46 45 struct regmap *regmap; 47 46 }; 48 47 ··· 166 167 static int sd2405al_probe(struct i2c_client *client) 167 168 { 168 169 struct sd2405al *sd2405al; 170 + struct rtc_device *rtc; 169 171 int ret; 170 172 171 173 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) ··· 182 182 if (IS_ERR(sd2405al->regmap)) 183 183 return PTR_ERR(sd2405al->regmap); 184 184 185 - sd2405al->rtc = devm_rtc_allocate_device(&client->dev); 186 - if (IS_ERR(sd2405al->rtc)) 187 - return PTR_ERR(sd2405al->rtc); 185 + rtc = devm_rtc_allocate_device(&client->dev); 186 + if (IS_ERR(rtc)) 187 + return PTR_ERR(rtc); 188 188 189 - sd2405al->rtc->ops = &sd2405al_rtc_ops; 190 - sd2405al->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; 191 - sd2405al->rtc->range_max = RTC_TIMESTAMP_END_2099; 189 + rtc->ops = &sd2405al_rtc_ops; 190 + rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; 191 + rtc->range_max = RTC_TIMESTAMP_END_2099; 192 192 193 193 dev_set_drvdata(&client->dev, sd2405al); 194 194 195 - ret = devm_rtc_register_device(sd2405al->rtc); 195 + ret = devm_rtc_register_device(rtc); 196 196 if (ret < 0) 197 197 return ret; 198 198