]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rtc: s5m: drop needless struct s5m_rtc_info::i2c member
authorAndré Draszik <andre.draszik@linaro.org>
Tue, 4 Mar 2025 17:05:30 +0000 (17:05 +0000)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 5 Mar 2025 22:08:00 +0000 (23:08 +0100)
When this driver was converted to using the devres managed i2c device
in commit 7db7ad0817fe ("rtc: s5m: use devm_i2c_new_dummy_device()"),
struct s5m_rtc_info::i2c became essentially unused.

We can drop it from the structure and just use a local temporary
variable, reducing runtime memory consumption by a few bytes.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://lore.kernel.org/r/20250304-rtc-cleanups-v2-2-d4689a71668c@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-s5m.c

index 36acca5b2639e272dd9baed06ea5582f635702b0..88aed27660348a05886f080a2848fcabbf9666d0 100644 (file)
@@ -146,7 +146,6 @@ static const struct s5m_rtc_reg_config s2mps15_rtc_regs = {
 
 struct s5m_rtc_info {
        struct device *dev;
-       struct i2c_client *i2c;
        struct sec_pmic_dev *s5m87xx;
        struct regmap *regmap;
        struct rtc_device *rtc_dev;
@@ -640,6 +639,7 @@ static int s5m_rtc_probe(struct platform_device *pdev)
 {
        struct sec_pmic_dev *s5m87xx = dev_get_drvdata(pdev->dev.parent);
        struct s5m_rtc_info *info;
+       struct i2c_client *i2c;
        const struct regmap_config *regmap_cfg;
        int ret, alarm_irq;
 
@@ -675,14 +675,14 @@ static int s5m_rtc_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       info->i2c = devm_i2c_new_dummy_device(&pdev->dev, s5m87xx->i2c->adapter,
-                                             RTC_I2C_ADDR);
-       if (IS_ERR(info->i2c)) {
+       i2c = devm_i2c_new_dummy_device(&pdev->dev, s5m87xx->i2c->adapter,
+                                       RTC_I2C_ADDR);
+       if (IS_ERR(i2c)) {
                dev_err(&pdev->dev, "Failed to allocate I2C for RTC\n");
-               return PTR_ERR(info->i2c);
+               return PTR_ERR(i2c);
        }
 
-       info->regmap = devm_regmap_init_i2c(info->i2c, regmap_cfg);
+       info->regmap = devm_regmap_init_i2c(i2c, regmap_cfg);
        if (IS_ERR(info->regmap)) {
                ret = PTR_ERR(info->regmap);
                dev_err(&pdev->dev, "Failed to allocate RTC register map: %d\n",