mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2025-04-19 20:58:31 +09:00
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>
This commit is contained in:
parent
cd2a705248
commit
d94bc2bbf8
@ -42,7 +42,6 @@
|
||||
|
||||
struct sd2405al {
|
||||
struct device *dev;
|
||||
struct rtc_device *rtc;
|
||||
struct regmap *regmap;
|
||||
};
|
||||
|
||||
@ -167,6 +166,7 @@ static const struct regmap_config sd2405al_regmap_conf = {
|
||||
static int sd2405al_probe(struct i2c_client *client)
|
||||
{
|
||||
struct sd2405al *sd2405al;
|
||||
struct rtc_device *rtc;
|
||||
int ret;
|
||||
|
||||
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
|
||||
@ -182,17 +182,17 @@ static int sd2405al_probe(struct i2c_client *client)
|
||||
if (IS_ERR(sd2405al->regmap))
|
||||
return PTR_ERR(sd2405al->regmap);
|
||||
|
||||
sd2405al->rtc = devm_rtc_allocate_device(&client->dev);
|
||||
if (IS_ERR(sd2405al->rtc))
|
||||
return PTR_ERR(sd2405al->rtc);
|
||||
rtc = devm_rtc_allocate_device(&client->dev);
|
||||
if (IS_ERR(rtc))
|
||||
return PTR_ERR(rtc);
|
||||
|
||||
sd2405al->rtc->ops = &sd2405al_rtc_ops;
|
||||
sd2405al->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
sd2405al->rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
rtc->ops = &sd2405al_rtc_ops;
|
||||
rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
|
||||
dev_set_drvdata(&client->dev, sd2405al);
|
||||
|
||||
ret = devm_rtc_register_device(sd2405al->rtc);
|
||||
ret = devm_rtc_register_device(rtc);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user