* [PATCH 00/18] a few rtc driver cleanups
@ 2025-02-28 14:07 André Draszik
2025-02-28 14:07 ` [PATCH 01/18] rtc: max77686: drop needless struct max77686_rtc_info::rtc member André Draszik
` (18 more replies)
0 siblings, 19 replies; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
Hi,
While looking at RTC, I noticed that various drivers are keeping
pointers to data that they're not using themselves throughout their
lifetime.
So I took the liberty to drop these pointers and this series is the
result.
The last two patches also convert two drivers to using dev_err_probe(),
as I looked slightly closer into those two. They don't exactly fit the
general subject of removal of unneeded pointers, but I wanted to share
them anyway, since they're ready.
All of this was compile-tested only.
Cheers,
Andre'
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
André Draszik (18):
rtc: max77686: drop needless struct max77686_rtc_info::rtc member
rtc: s5m: drop needless struct s5m_rtc_info::i2c member
rtc: aspeed: drop needless struct aspeed_rtc::rtc_dev member
rtc: ds2404: drop needless struct ds2404::rtc member
rtc: ep93xx: drop needless struct ep93xx_rtc::rtc member
rtc: ftrtc010: drop needless struct ftrtc010_rtc::rtc_dev member
rtc: m48t86: drop needless struct m48t86_rtc_info::rtc member
rtc: meson: drop needless struct meson_rtc::rtc member
rtc: meson-vrtc: drop needless struct meson_vrtc_data::rtc member
rtc: pl030: drop needless struct pl030_rtc::rtc member
rtc: rx8581: drop needless struct rx8581::rtc member
rtc: s35390a: drop needless struct s35390a::rtc member
rtc: sd2405al: drop needless struct sd2405al::rtc member
rtc: sd3078: drop needless struct sd3078::rtc member
rtc: rx8581: drop needless struct rx8581
rtc: sd3078: drop needless struct sd3078
rtc: max77686: use dev_err_probe() where appropriate
rtc: s5m: convert to dev_err_probe() where appropriate
drivers/rtc/rtc-aspeed.c | 16 ++++-----
drivers/rtc/rtc-ds2404.c | 14 ++++----
drivers/rtc/rtc-ep93xx.c | 16 ++++-----
drivers/rtc/rtc-ftrtc010.c | 17 +++++----
drivers/rtc/rtc-m48t86.c | 14 ++++----
drivers/rtc/rtc-max77686.c | 37 +++++++++----------
drivers/rtc/rtc-meson-vrtc.c | 12 +++----
drivers/rtc/rtc-meson.c | 16 ++++-----
drivers/rtc/rtc-pl030.c | 14 ++++----
drivers/rtc/rtc-rx8581.c | 85 +++++++++++++++++++-------------------------
drivers/rtc/rtc-s35390a.c | 22 ++++++------
drivers/rtc/rtc-s5m.c | 58 +++++++++++++-----------------
drivers/rtc/rtc-sd2405al.c | 16 ++++-----
drivers/rtc/rtc-sd3078.c | 71 +++++++++++++++---------------------
14 files changed, 183 insertions(+), 225 deletions(-)
---
base-commit: 0226d0ce98a477937ed295fb7df4cc30b46fc304
change-id: 20250228-rtc-cleanups-12c0b5123ea4
Best regards,
--
André Draszik <andre.draszik@linaro.org>
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 01/18] rtc: max77686: drop needless struct max77686_rtc_info::rtc member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-02-28 17:30 ` Krzysztof Kozlowski
2025-02-28 14:07 ` [PATCH 02/18] rtc: s5m: drop needless struct s5m_rtc_info::i2c member André Draszik
` (17 subsequent siblings)
18 siblings, 1 reply; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
When this driver was converted to using the devres managed i2c device
in commit 59a7f24fceb3 ("rtc: max77686: convert to
devm_i2c_new_dummy_device()"), struct max77686_rtc_info::rtc 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.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
drivers/rtc/rtc-max77686.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 7bb044d2ac25aeaaf2404b47b7e7bd485ae3d39e..6b0d02b44c8097453f704cbec9f02580fb869ca3 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -85,7 +85,6 @@ struct max77686_rtc_driver_data {
struct max77686_rtc_info {
struct device *dev;
- struct i2c_client *rtc;
struct rtc_device *rtc_dev;
struct mutex lock;
@@ -691,6 +690,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
{
struct device *parent = info->dev->parent;
struct i2c_client *parent_i2c = to_i2c_client(parent);
+ struct i2c_client *client;
int ret;
if (info->drv_data->rtc_irq_from_platform) {
@@ -714,14 +714,14 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
goto add_rtc_irq;
}
- info->rtc = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter,
- info->drv_data->rtc_i2c_addr);
- if (IS_ERR(info->rtc)) {
+ client = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter,
+ info->drv_data->rtc_i2c_addr);
+ if (IS_ERR(client)) {
dev_err(info->dev, "Failed to allocate I2C device for RTC\n");
- return PTR_ERR(info->rtc);
+ return PTR_ERR(client);
}
- info->rtc_regmap = devm_regmap_init_i2c(info->rtc,
+ info->rtc_regmap = devm_regmap_init_i2c(client,
info->drv_data->regmap_config);
if (IS_ERR(info->rtc_regmap)) {
ret = PTR_ERR(info->rtc_regmap);
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 02/18] rtc: s5m: drop needless struct s5m_rtc_info::i2c member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
2025-02-28 14:07 ` [PATCH 01/18] rtc: max77686: drop needless struct max77686_rtc_info::rtc member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-02-28 17:31 ` Krzysztof Kozlowski
2025-03-01 17:47 ` kernel test robot
2025-02-28 14:07 ` [PATCH 03/18] rtc: aspeed: drop needless struct aspeed_rtc::rtc_dev member André Draszik
` (16 subsequent siblings)
18 siblings, 2 replies; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
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.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
drivers/rtc/rtc-s5m.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 36acca5b2639e272dd9baed06ea5582f635702b0..77dd61c30681b8f0a2f23063ad5f7eb52f5b7158 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -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, 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",
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 03/18] rtc: aspeed: drop needless struct aspeed_rtc::rtc_dev member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
2025-02-28 14:07 ` [PATCH 01/18] rtc: max77686: drop needless struct max77686_rtc_info::rtc member André Draszik
2025-02-28 14:07 ` [PATCH 02/18] rtc: s5m: drop needless struct s5m_rtc_info::i2c member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-03-18 0:58 ` Andrew Jeffery
2025-02-28 14:07 ` [PATCH 04/18] rtc: ds2404: drop needless struct ds2404::rtc member André Draszik
` (15 subsequent siblings)
18 siblings, 1 reply; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
The memory pointed to by the ::rtc_dev 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>
---
drivers/rtc/rtc-aspeed.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-aspeed.c b/drivers/rtc/rtc-aspeed.c
index 880b015eebaf796f68ed82c29998f345e1fd418b..0d0053b52f9b90a61725bf29435bfc8071977f9e 100644
--- a/drivers/rtc/rtc-aspeed.c
+++ b/drivers/rtc/rtc-aspeed.c
@@ -8,7 +8,6 @@
#include <linux/io.h>
struct aspeed_rtc {
- struct rtc_device *rtc_dev;
void __iomem *base;
};
@@ -85,6 +84,7 @@ static const struct rtc_class_ops aspeed_rtc_ops = {
static int aspeed_rtc_probe(struct platform_device *pdev)
{
struct aspeed_rtc *rtc;
+ struct rtc_device *rtc_dev;
rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
if (!rtc)
@@ -94,17 +94,17 @@ static int aspeed_rtc_probe(struct platform_device *pdev)
if (IS_ERR(rtc->base))
return PTR_ERR(rtc->base);
- rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(rtc->rtc_dev))
- return PTR_ERR(rtc->rtc_dev);
+ rtc_dev = devm_rtc_allocate_device(&pdev->dev);
+ if (IS_ERR(rtc_dev))
+ return PTR_ERR(rtc_dev);
platform_set_drvdata(pdev, rtc);
- rtc->rtc_dev->ops = &aspeed_rtc_ops;
- rtc->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_1900;
- rtc->rtc_dev->range_max = 38814989399LL; /* 3199-12-31 23:59:59 */
+ rtc_dev->ops = &aspeed_rtc_ops;
+ rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_1900;
+ rtc_dev->range_max = 38814989399LL; /* 3199-12-31 23:59:59 */
- return devm_rtc_register_device(rtc->rtc_dev);
+ return devm_rtc_register_device(rtc_dev);
}
static const struct of_device_id aspeed_rtc_match[] = {
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 04/18] rtc: ds2404: drop needless struct ds2404::rtc member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (2 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 03/18] rtc: aspeed: drop needless struct aspeed_rtc::rtc_dev member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-02-28 14:07 ` [PATCH 05/18] rtc: ep93xx: drop needless struct ep93xx_rtc::rtc member André Draszik
` (14 subsequent siblings)
18 siblings, 0 replies; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
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>
---
drivers/rtc/rtc-ds2404.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/rtc/rtc-ds2404.c b/drivers/rtc/rtc-ds2404.c
index 3231fd9f61da49bdaf00e46486fc34836094ee78..217694eca36c3432a8db3b874374e347eeb802d9 100644
--- a/drivers/rtc/rtc-ds2404.c
+++ b/drivers/rtc/rtc-ds2404.c
@@ -31,7 +31,6 @@ struct ds2404 {
struct gpio_desc *rst_gpiod;
struct gpio_desc *clk_gpiod;
struct gpio_desc *dq_gpiod;
- struct rtc_device *rtc;
};
static int ds2404_gpio_map(struct ds2404 *chip, struct platform_device *pdev)
@@ -182,6 +181,7 @@ static const struct rtc_class_ops ds2404_rtc_ops = {
static int rtc_probe(struct platform_device *pdev)
{
struct ds2404 *chip;
+ struct rtc_device *rtc;
int retval = -EBUSY;
chip = devm_kzalloc(&pdev->dev, sizeof(struct ds2404), GFP_KERNEL);
@@ -190,9 +190,9 @@ static int rtc_probe(struct platform_device *pdev)
chip->dev = &pdev->dev;
- chip->rtc = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(chip->rtc))
- return PTR_ERR(chip->rtc);
+ rtc = devm_rtc_allocate_device(&pdev->dev);
+ if (IS_ERR(rtc))
+ return PTR_ERR(rtc);
retval = ds2404_gpio_map(chip, pdev);
if (retval)
@@ -200,10 +200,10 @@ static int rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, chip);
- chip->rtc->ops = &ds2404_rtc_ops;
- chip->rtc->range_max = U32_MAX;
+ rtc->ops = &ds2404_rtc_ops;
+ rtc->range_max = U32_MAX;
- retval = devm_rtc_register_device(chip->rtc);
+ retval = devm_rtc_register_device(rtc);
if (retval)
return retval;
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 05/18] rtc: ep93xx: drop needless struct ep93xx_rtc::rtc member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (3 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 04/18] rtc: ds2404: drop needless struct ds2404::rtc member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-02-28 14:07 ` [PATCH 06/18] rtc: ftrtc010: drop needless struct ftrtc010_rtc::rtc_dev member André Draszik
` (13 subsequent siblings)
18 siblings, 0 replies; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
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>
---
drivers/rtc/rtc-ep93xx.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index 1fdd20d01560ef4fae2b996cf366b4f812329225..dcdcdd06f30d1ff6d0939f6bcad2c17c03c5a65e 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -28,7 +28,6 @@
struct ep93xx_rtc {
void __iomem *mmio_base;
- struct rtc_device *rtc;
};
static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload,
@@ -123,6 +122,7 @@ static const struct attribute_group ep93xx_rtc_sysfs_files = {
static int ep93xx_rtc_probe(struct platform_device *pdev)
{
struct ep93xx_rtc *ep93xx_rtc;
+ struct rtc_device *rtc;
int err;
ep93xx_rtc = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_rtc), GFP_KERNEL);
@@ -135,18 +135,18 @@ static int ep93xx_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ep93xx_rtc);
- ep93xx_rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(ep93xx_rtc->rtc))
- return PTR_ERR(ep93xx_rtc->rtc);
+ rtc = devm_rtc_allocate_device(&pdev->dev);
+ if (IS_ERR(rtc))
+ return PTR_ERR(rtc);
- ep93xx_rtc->rtc->ops = &ep93xx_rtc_ops;
- ep93xx_rtc->rtc->range_max = U32_MAX;
+ rtc->ops = &ep93xx_rtc_ops;
+ rtc->range_max = U32_MAX;
- err = rtc_add_group(ep93xx_rtc->rtc, &ep93xx_rtc_sysfs_files);
+ err = rtc_add_group(rtc, &ep93xx_rtc_sysfs_files);
if (err)
return err;
- return devm_rtc_register_device(ep93xx_rtc->rtc);
+ return devm_rtc_register_device(rtc);
}
static const struct of_device_id ep93xx_rtc_of_ids[] = {
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 06/18] rtc: ftrtc010: drop needless struct ftrtc010_rtc::rtc_dev member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (4 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 05/18] rtc: ep93xx: drop needless struct ep93xx_rtc::rtc member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-03-01 18:12 ` Linus Walleij
2025-02-28 14:07 ` [PATCH 07/18] rtc: m48t86: drop needless struct m48t86_rtc_info::rtc member André Draszik
` (12 subsequent siblings)
18 siblings, 1 reply; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
The memory pointed to by the ::rtc_dev 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>
---
drivers/rtc/rtc-ftrtc010.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/rtc/rtc-ftrtc010.c b/drivers/rtc/rtc-ftrtc010.c
index cb4a5d101f537e20a685bb022e6f6516b0df8271..02608d3784958e69ec0ecbdb9fcc8b333b19e7cc 100644
--- a/drivers/rtc/rtc-ftrtc010.c
+++ b/drivers/rtc/rtc-ftrtc010.c
@@ -28,7 +28,6 @@ MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:" DRV_NAME);
struct ftrtc010_rtc {
- struct rtc_device *rtc_dev;
void __iomem *rtc_base;
int rtc_irq;
struct clk *pclk;
@@ -113,6 +112,7 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev)
struct ftrtc010_rtc *rtc;
struct device *dev = &pdev->dev;
struct resource *res;
+ struct rtc_device *rtc_dev;
int ret;
rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
@@ -160,29 +160,28 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev)
goto err_disable_extclk;
}
- rtc->rtc_dev = devm_rtc_allocate_device(dev);
- if (IS_ERR(rtc->rtc_dev)) {
- ret = PTR_ERR(rtc->rtc_dev);
+ rtc_dev = devm_rtc_allocate_device(dev);
+ if (IS_ERR(rtc_dev)) {
+ ret = PTR_ERR(rtc_dev);
goto err_disable_extclk;
}
- rtc->rtc_dev->ops = &ftrtc010_rtc_ops;
+ rtc_dev->ops = &ftrtc010_rtc_ops;
sec = readl(rtc->rtc_base + FTRTC010_RTC_SECOND);
min = readl(rtc->rtc_base + FTRTC010_RTC_MINUTE);
hour = readl(rtc->rtc_base + FTRTC010_RTC_HOUR);
days = readl(rtc->rtc_base + FTRTC010_RTC_DAYS);
- rtc->rtc_dev->range_min = (u64)days * 86400 + hour * 3600 +
- min * 60 + sec;
- rtc->rtc_dev->range_max = U32_MAX + rtc->rtc_dev->range_min;
+ rtc_dev->range_min = (u64)days * 86400 + hour * 3600 + min * 60 + sec;
+ rtc_dev->range_max = U32_MAX + rtc_dev->range_min;
ret = devm_request_irq(dev, rtc->rtc_irq, ftrtc010_rtc_interrupt,
IRQF_SHARED, pdev->name, dev);
if (unlikely(ret))
goto err_disable_extclk;
- return devm_rtc_register_device(rtc->rtc_dev);
+ return devm_rtc_register_device(rtc_dev);
err_disable_extclk:
clk_disable_unprepare(rtc->extclk);
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 07/18] rtc: m48t86: drop needless struct m48t86_rtc_info::rtc member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (5 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 06/18] rtc: ftrtc010: drop needless struct ftrtc010_rtc::rtc_dev member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-02-28 14:07 ` [PATCH 08/18] rtc: meson: drop needless struct meson_rtc::rtc member André Draszik
` (11 subsequent siblings)
18 siblings, 0 replies; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
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>
---
drivers/rtc/rtc-m48t86.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c
index dd4a62e2d39c73b1c8c3f50a59fd4fffc0b45105..10cd054fe86f9e6be74eb282222b2751dd91cc7e 100644
--- a/drivers/rtc/rtc-m48t86.c
+++ b/drivers/rtc/rtc-m48t86.c
@@ -41,7 +41,6 @@
struct m48t86_rtc_info {
void __iomem *index_reg;
void __iomem *data_reg;
- struct rtc_device *rtc;
};
static unsigned char m48t86_readb(struct device *dev, unsigned long addr)
@@ -219,6 +218,7 @@ static bool m48t86_verify_chip(struct platform_device *pdev)
static int m48t86_rtc_probe(struct platform_device *pdev)
{
struct m48t86_rtc_info *info;
+ struct rtc_device *rtc;
unsigned char reg;
int err;
struct nvmem_config m48t86_nvmem_cfg = {
@@ -250,17 +250,17 @@ static int m48t86_rtc_probe(struct platform_device *pdev)
return -ENODEV;
}
- info->rtc = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(info->rtc))
- return PTR_ERR(info->rtc);
+ rtc = devm_rtc_allocate_device(&pdev->dev);
+ if (IS_ERR(rtc))
+ return PTR_ERR(rtc);
- info->rtc->ops = &m48t86_rtc_ops;
+ rtc->ops = &m48t86_rtc_ops;
- err = devm_rtc_register_device(info->rtc);
+ err = devm_rtc_register_device(rtc);
if (err)
return err;
- devm_rtc_nvmem_register(info->rtc, &m48t86_nvmem_cfg);
+ devm_rtc_nvmem_register(rtc, &m48t86_nvmem_cfg);
/* read battery status */
reg = m48t86_readb(&pdev->dev, M48T86_D);
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 08/18] rtc: meson: drop needless struct meson_rtc::rtc member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (6 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 07/18] rtc: m48t86: drop needless struct m48t86_rtc_info::rtc member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-02-28 14:07 ` [PATCH 09/18] rtc: meson-vrtc: drop needless struct meson_vrtc_data::rtc member André Draszik
` (10 subsequent siblings)
18 siblings, 0 replies; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
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>
---
drivers/rtc/rtc-meson.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-meson.c b/drivers/rtc/rtc-meson.c
index db1d626edca5fbb590f26c1cdd0774d350244a99..47e9ebf58ffc2f2b6c65932f8ec3773a213a62ef 100644
--- a/drivers/rtc/rtc-meson.c
+++ b/drivers/rtc/rtc-meson.c
@@ -59,7 +59,6 @@
#define MESON_STATIC_DEFAULT (MESON_STATIC_BIAS_CUR | MESON_STATIC_VOLTAGE)
struct meson_rtc {
- struct rtc_device *rtc; /* rtc device we created */
struct device *dev; /* device we bound from */
struct reset_control *reset; /* reset source */
struct regulator *vdd; /* voltage input */
@@ -292,6 +291,7 @@ static int meson_rtc_probe(struct platform_device *pdev)
};
struct device *dev = &pdev->dev;
struct meson_rtc *rtc;
+ struct rtc_device *rtc_dev;
void __iomem *base;
int ret;
u32 tm;
@@ -300,16 +300,16 @@ static int meson_rtc_probe(struct platform_device *pdev)
if (!rtc)
return -ENOMEM;
- rtc->rtc = devm_rtc_allocate_device(dev);
- if (IS_ERR(rtc->rtc))
- return PTR_ERR(rtc->rtc);
+ rtc_dev = devm_rtc_allocate_device(dev);
+ if (IS_ERR(rtc_dev))
+ return PTR_ERR(rtc_dev);
platform_set_drvdata(pdev, rtc);
rtc->dev = dev;
- rtc->rtc->ops = &meson_rtc_ops;
- rtc->rtc->range_max = U32_MAX;
+ rtc_dev->ops = &meson_rtc_ops;
+ rtc_dev->range_max = U32_MAX;
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
@@ -365,11 +365,11 @@ static int meson_rtc_probe(struct platform_device *pdev)
}
meson_rtc_nvmem_config.priv = rtc;
- ret = devm_rtc_nvmem_register(rtc->rtc, &meson_rtc_nvmem_config);
+ ret = devm_rtc_nvmem_register(rtc_dev, &meson_rtc_nvmem_config);
if (ret)
goto out_disable_vdd;
- ret = devm_rtc_register_device(rtc->rtc);
+ ret = devm_rtc_register_device(rtc_dev);
if (ret)
goto out_disable_vdd;
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 09/18] rtc: meson-vrtc: drop needless struct meson_vrtc_data::rtc member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (7 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 08/18] rtc: meson: drop needless struct meson_rtc::rtc member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-02-28 14:07 ` [PATCH 10/18] rtc: pl030: drop needless struct pl030_rtc::rtc member André Draszik
` (9 subsequent siblings)
18 siblings, 0 replies; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
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>
---
drivers/rtc/rtc-meson-vrtc.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-meson-vrtc.c b/drivers/rtc/rtc-meson-vrtc.c
index 5849729f7d01d7ec7868ff3bbdc5ed599aaa8238..7d38258cbe376e5a1b2af6250cb6d04c313175fb 100644
--- a/drivers/rtc/rtc-meson-vrtc.c
+++ b/drivers/rtc/rtc-meson-vrtc.c
@@ -13,7 +13,6 @@
struct meson_vrtc_data {
void __iomem *io_alarm;
- struct rtc_device *rtc;
unsigned long alarm_time;
bool enabled;
};
@@ -65,6 +64,7 @@ static const struct rtc_class_ops meson_vrtc_ops = {
static int meson_vrtc_probe(struct platform_device *pdev)
{
struct meson_vrtc_data *vrtc;
+ struct rtc_device *rtc;
vrtc = devm_kzalloc(&pdev->dev, sizeof(*vrtc), GFP_KERNEL);
if (!vrtc)
@@ -78,12 +78,12 @@ static int meson_vrtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, vrtc);
- vrtc->rtc = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(vrtc->rtc))
- return PTR_ERR(vrtc->rtc);
+ rtc = devm_rtc_allocate_device(&pdev->dev);
+ if (IS_ERR(rtc))
+ return PTR_ERR(rtc);
- vrtc->rtc->ops = &meson_vrtc_ops;
- return devm_rtc_register_device(vrtc->rtc);
+ rtc->ops = &meson_vrtc_ops;
+ return devm_rtc_register_device(rtc);
}
static int __maybe_unused meson_vrtc_suspend(struct device *dev)
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 10/18] rtc: pl030: drop needless struct pl030_rtc::rtc member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (8 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 09/18] rtc: meson-vrtc: drop needless struct meson_vrtc_data::rtc member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-03-01 18:11 ` Linus Walleij
2025-02-28 14:07 ` [PATCH 11/18] rtc: rx8581: drop needless struct rx8581::rtc member André Draszik
` (8 subsequent siblings)
18 siblings, 1 reply; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
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>
---
drivers/rtc/rtc-pl030.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/rtc/rtc-pl030.c b/drivers/rtc/rtc-pl030.c
index 39038c0754ee55a952e5986afe711cffff35840b..e7c81740061bb60c4d8447d6522819685bea9180 100644
--- a/drivers/rtc/rtc-pl030.c
+++ b/drivers/rtc/rtc-pl030.c
@@ -21,7 +21,6 @@
#define RTC_CR_MIE (1 << 0)
struct pl030_rtc {
- struct rtc_device *rtc;
void __iomem *base;
};
@@ -86,6 +85,7 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id)
{
struct pl030_rtc *rtc;
int ret;
+ struct rtc_device *rtc_dev;
ret = amba_request_regions(dev, NULL);
if (ret)
@@ -97,14 +97,14 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id)
goto err_rtc;
}
- rtc->rtc = devm_rtc_allocate_device(&dev->dev);
- if (IS_ERR(rtc->rtc)) {
- ret = PTR_ERR(rtc->rtc);
+ rtc_dev = devm_rtc_allocate_device(&dev->dev);
+ if (IS_ERR(rtc_dev)) {
+ ret = PTR_ERR(rtc_dev);
goto err_rtc;
}
- rtc->rtc->ops = &pl030_ops;
- rtc->rtc->range_max = U32_MAX;
+ rtc_dev->ops = &pl030_ops;
+ rtc_dev->range_max = U32_MAX;
rtc->base = ioremap(dev->res.start, resource_size(&dev->res));
if (!rtc->base) {
ret = -ENOMEM;
@@ -121,7 +121,7 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id)
if (ret)
goto err_irq;
- ret = devm_rtc_register_device(rtc->rtc);
+ ret = devm_rtc_register_device(rtc_dev);
if (ret)
goto err_reg;
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 11/18] rtc: rx8581: drop needless struct rx8581::rtc member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (9 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 10/18] rtc: pl030: drop needless struct pl030_rtc::rtc member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-02-28 14:07 ` [PATCH 12/18] rtc: s35390a: drop needless struct s35390a::rtc member André Draszik
` (7 subsequent siblings)
18 siblings, 0 replies; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
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>
---
drivers/rtc/rtc-rx8581.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c
index b18c12887bdc3705ea4cee9b8d75086a05b24e71..785ebaca07ac971eee34559f8d1e0a8a872cbba9 100644
--- a/drivers/rtc/rtc-rx8581.c
+++ b/drivers/rtc/rtc-rx8581.c
@@ -54,7 +54,6 @@
struct rx8581 {
struct regmap *regmap;
- struct rtc_device *rtc;
};
struct rx85x1_config {
@@ -252,6 +251,7 @@ static int rx8581_probe(struct i2c_client *client)
struct rx8581 *rx8581;
const struct rx85x1_config *config = &rx8581_config;
const void *data = of_device_get_match_data(&client->dev);
+ struct rtc_device *rtc;
static struct nvmem_config nvmem_cfg[] = {
{
.name = "rx85x1-",
@@ -286,21 +286,21 @@ static int rx8581_probe(struct i2c_client *client)
if (IS_ERR(rx8581->regmap))
return PTR_ERR(rx8581->regmap);
- rx8581->rtc = devm_rtc_allocate_device(&client->dev);
- if (IS_ERR(rx8581->rtc))
- return PTR_ERR(rx8581->rtc);
+ rtc = devm_rtc_allocate_device(&client->dev);
+ if (IS_ERR(rtc))
+ return PTR_ERR(rtc);
- rx8581->rtc->ops = &rx8581_rtc_ops;
- rx8581->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
- rx8581->rtc->range_max = RTC_TIMESTAMP_END_2099;
- rx8581->rtc->start_secs = 0;
- rx8581->rtc->set_start_time = true;
+ rtc->ops = &rx8581_rtc_ops;
+ rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
+ rtc->range_max = RTC_TIMESTAMP_END_2099;
+ rtc->start_secs = 0;
+ rtc->set_start_time = true;
- ret = devm_rtc_register_device(rx8581->rtc);
+ ret = devm_rtc_register_device(rtc);
for (i = 0; i < config->num_nvram; i++) {
nvmem_cfg[i].priv = rx8581;
- devm_rtc_nvmem_register(rx8581->rtc, &nvmem_cfg[i]);
+ devm_rtc_nvmem_register(rtc, &nvmem_cfg[i]);
}
return ret;
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 12/18] rtc: s35390a: drop needless struct s35390a::rtc member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (10 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 11/18] rtc: rx8581: drop needless struct rx8581::rtc member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-02-28 14:07 ` [PATCH 13/18] rtc: sd2405al: drop needless struct sd2405al::rtc member André Draszik
` (6 subsequent siblings)
18 siblings, 0 replies; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
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>
---
drivers/rtc/rtc-s35390a.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index e3dc18882f41445c41fbea56edbd5c869514880c..3408d2ab274194e39cde38a83567d37bd53f6632 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -63,7 +63,6 @@ MODULE_DEVICE_TABLE(of, s35390a_of_match);
struct s35390a {
struct i2c_client *client[8];
- struct rtc_device *rtc;
int twentyfourhour;
};
@@ -422,6 +421,7 @@ static int s35390a_probe(struct i2c_client *client)
int err, err_read;
unsigned int i;
struct s35390a *s35390a;
+ struct rtc_device *rtc;
char buf, status1;
struct device *dev = &client->dev;
@@ -447,9 +447,9 @@ static int s35390a_probe(struct i2c_client *client)
}
}
- s35390a->rtc = devm_rtc_allocate_device(dev);
- if (IS_ERR(s35390a->rtc))
- return PTR_ERR(s35390a->rtc);
+ rtc = devm_rtc_allocate_device(dev);
+ if (IS_ERR(rtc))
+ return PTR_ERR(rtc);
err_read = s35390a_read_status(s35390a, &status1);
if (err_read < 0) {
@@ -480,17 +480,17 @@ static int s35390a_probe(struct i2c_client *client)
device_set_wakeup_capable(dev, 1);
- s35390a->rtc->ops = &s35390a_rtc_ops;
- s35390a->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
- s35390a->rtc->range_max = RTC_TIMESTAMP_END_2099;
+ rtc->ops = &s35390a_rtc_ops;
+ rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
+ rtc->range_max = RTC_TIMESTAMP_END_2099;
- set_bit(RTC_FEATURE_ALARM_RES_MINUTE, s35390a->rtc->features);
- clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, s35390a->rtc->features );
+ set_bit(RTC_FEATURE_ALARM_RES_MINUTE, rtc->features);
+ clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features);
if (status1 & S35390A_FLAG_INT2)
- rtc_update_irq(s35390a->rtc, 1, RTC_AF);
+ rtc_update_irq(rtc, 1, RTC_AF);
- return devm_rtc_register_device(s35390a->rtc);
+ return devm_rtc_register_device(rtc);
}
static struct i2c_driver s35390a_driver = {
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 13/18] rtc: sd2405al: drop needless struct sd2405al::rtc member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (11 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 12/18] rtc: s35390a: drop needless struct s35390a::rtc member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-03-03 14:04 ` Tóth János
2025-02-28 14:07 ` [PATCH 14/18] rtc: sd3078: drop needless struct sd3078::rtc member André Draszik
` (5 subsequent siblings)
18 siblings, 1 reply; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
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>
---
drivers/rtc/rtc-sd2405al.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-sd2405al.c b/drivers/rtc/rtc-sd2405al.c
index d2568c3e387659dfea598cd2ef6bddc5c076cbb9..00c3033e8079b5f10aaabcc7a1d3f19771263a02 100644
--- a/drivers/rtc/rtc-sd2405al.c
+++ b/drivers/rtc/rtc-sd2405al.c
@@ -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;
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 14/18] rtc: sd3078: drop needless struct sd3078::rtc member
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (12 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 13/18] rtc: sd2405al: drop needless struct sd2405al::rtc member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-02-28 14:07 ` [PATCH 15/18] rtc: rx8581: drop needless struct rx8581 André Draszik
` (4 subsequent siblings)
18 siblings, 0 replies; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
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>
---
drivers/rtc/rtc-sd3078.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-sd3078.c b/drivers/rtc/rtc-sd3078.c
index fe27b54beaad1c06b70bf7f22e44c3f6da087267..ebb4d45ce2409982880affbc7a85d5e7410c8f42 100644
--- a/drivers/rtc/rtc-sd3078.c
+++ b/drivers/rtc/rtc-sd3078.c
@@ -37,7 +37,6 @@
#define WRITE_PROTECT_EN 0
struct sd3078 {
- struct rtc_device *rtc;
struct regmap *regmap;
};
@@ -167,6 +166,7 @@ static int sd3078_probe(struct i2c_client *client)
{
int ret;
struct sd3078 *sd3078;
+ struct rtc_device *rtc;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
return -ENODEV;
@@ -183,15 +183,15 @@ static int sd3078_probe(struct i2c_client *client)
i2c_set_clientdata(client, sd3078);
- sd3078->rtc = devm_rtc_allocate_device(&client->dev);
- if (IS_ERR(sd3078->rtc))
- return PTR_ERR(sd3078->rtc);
+ rtc = devm_rtc_allocate_device(&client->dev);
+ if (IS_ERR(rtc))
+ return PTR_ERR(rtc);
- sd3078->rtc->ops = &sd3078_rtc_ops;
- sd3078->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
- sd3078->rtc->range_max = RTC_TIMESTAMP_END_2099;
+ rtc->ops = &sd3078_rtc_ops;
+ rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
+ rtc->range_max = RTC_TIMESTAMP_END_2099;
- ret = devm_rtc_register_device(sd3078->rtc);
+ ret = devm_rtc_register_device(rtc);
if (ret)
return ret;
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 15/18] rtc: rx8581: drop needless struct rx8581
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (13 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 14/18] rtc: sd3078: drop needless struct sd3078::rtc member André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-02-28 14:07 ` [PATCH 16/18] rtc: sd3078: drop needless struct sd3078 André Draszik
` (3 subsequent siblings)
18 siblings, 0 replies; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
This private data struct has one member only, there is no need to
allocate data for it and pass that around via the various callbacks,
just to extract that one member.
Instead, we can just pass that one member and avoid the extra memory
allocation, reducing runtime memory consumption.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
drivers/rtc/rtc-rx8581.c | 63 +++++++++++++++++++-----------------------------
1 file changed, 25 insertions(+), 38 deletions(-)
diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c
index 785ebaca07ac971eee34559f8d1e0a8a872cbba9..20c2dff01bae833ae4e100cc38cd5f030017be75 100644
--- a/drivers/rtc/rtc-rx8581.c
+++ b/drivers/rtc/rtc-rx8581.c
@@ -52,10 +52,6 @@
#define RX8571_USER_RAM 0x10
#define RX8571_NVRAM_SIZE 0x10
-struct rx8581 {
- struct regmap *regmap;
-};
-
struct rx85x1_config {
struct regmap_config regmap;
unsigned int num_nvram;
@@ -71,14 +67,14 @@ static int rx8581_rtc_read_time(struct device *dev, struct rtc_time *tm)
unsigned char date[7];
unsigned int data;
int err;
- struct rx8581 *rx8581 = i2c_get_clientdata(client);
+ struct regmap *regmap = i2c_get_clientdata(client);
/* First we ensure that the "update flag" is not set, we read the
* time and date then re-read the "update flag". If the update flag
* has been set, we know that the time has changed during the read so
* we repeat the whole process again.
*/
- err = regmap_read(rx8581->regmap, RX8581_REG_FLAG, &data);
+ err = regmap_read(regmap, RX8581_REG_FLAG, &data);
if (err < 0)
return err;
@@ -91,20 +87,20 @@ static int rx8581_rtc_read_time(struct device *dev, struct rtc_time *tm)
do {
/* If update flag set, clear it */
if (data & RX8581_FLAG_UF) {
- err = regmap_write(rx8581->regmap, RX8581_REG_FLAG,
- data & ~RX8581_FLAG_UF);
+ err = regmap_write(regmap, RX8581_REG_FLAG,
+ data & ~RX8581_FLAG_UF);
if (err < 0)
return err;
}
/* Now read time and date */
- err = regmap_bulk_read(rx8581->regmap, RX8581_REG_SC, date,
+ err = regmap_bulk_read(regmap, RX8581_REG_SC, date,
sizeof(date));
if (err < 0)
return err;
/* Check flag register */
- err = regmap_read(rx8581->regmap, RX8581_REG_FLAG, &data);
+ err = regmap_read(regmap, RX8581_REG_FLAG, &data);
if (err < 0)
return err;
} while (data & RX8581_FLAG_UF);
@@ -136,7 +132,7 @@ static int rx8581_rtc_set_time(struct device *dev, struct rtc_time *tm)
struct i2c_client *client = to_i2c_client(dev);
int err;
unsigned char buf[7];
- struct rx8581 *rx8581 = i2c_get_clientdata(client);
+ struct regmap *regmap = i2c_get_clientdata(client);
dev_dbg(dev, "%s: secs=%d, mins=%d, hours=%d, "
"mday=%d, mon=%d, year=%d, wday=%d\n",
@@ -159,25 +155,23 @@ static int rx8581_rtc_set_time(struct device *dev, struct rtc_time *tm)
buf[RX8581_REG_DW] = (0x1 << tm->tm_wday);
/* Stop the clock */
- err = regmap_update_bits(rx8581->regmap, RX8581_REG_CTRL,
+ err = regmap_update_bits(regmap, RX8581_REG_CTRL,
RX8581_CTRL_STOP, RX8581_CTRL_STOP);
if (err < 0)
return err;
/* write register's data */
- err = regmap_bulk_write(rx8581->regmap, RX8581_REG_SC,
- buf, sizeof(buf));
+ err = regmap_bulk_write(regmap, RX8581_REG_SC, buf, sizeof(buf));
if (err < 0)
return err;
/* get VLF and clear it */
- err = regmap_update_bits(rx8581->regmap, RX8581_REG_FLAG,
- RX8581_FLAG_VLF, 0);
+ err = regmap_update_bits(regmap, RX8581_REG_FLAG, RX8581_FLAG_VLF, 0);
if (err < 0)
return err;
/* Restart the clock */
- return regmap_update_bits(rx8581->regmap, RX8581_REG_CTRL,
+ return regmap_update_bits(regmap, RX8581_REG_CTRL,
RX8581_CTRL_STOP, 0);
}
@@ -189,29 +183,27 @@ static const struct rtc_class_ops rx8581_rtc_ops = {
static int rx8571_nvram_read(void *priv, unsigned int offset, void *val,
size_t bytes)
{
- struct rx8581 *rx8581 = priv;
+ struct regmap *regmap = priv;
- return regmap_bulk_read(rx8581->regmap, RX8571_USER_RAM + offset,
- val, bytes);
+ return regmap_bulk_read(regmap, RX8571_USER_RAM + offset, val, bytes);
}
static int rx8571_nvram_write(void *priv, unsigned int offset, void *val,
size_t bytes)
{
- struct rx8581 *rx8581 = priv;
+ struct regmap *regmap = priv;
- return regmap_bulk_write(rx8581->regmap, RX8571_USER_RAM + offset,
- val, bytes);
+ return regmap_bulk_write(regmap, RX8571_USER_RAM + offset, val, bytes);
}
static int rx85x1_nvram_read(void *priv, unsigned int offset, void *val,
size_t bytes)
{
- struct rx8581 *rx8581 = priv;
+ struct regmap *regmap = priv;
unsigned int tmp_val;
int ret;
- ret = regmap_read(rx8581->regmap, RX8581_REG_RAM, &tmp_val);
+ ret = regmap_read(regmap, RX8581_REG_RAM, &tmp_val);
(*(unsigned char *)val) = (unsigned char) tmp_val;
return ret;
@@ -220,12 +212,11 @@ static int rx85x1_nvram_read(void *priv, unsigned int offset, void *val,
static int rx85x1_nvram_write(void *priv, unsigned int offset, void *val,
size_t bytes)
{
- struct rx8581 *rx8581 = priv;
+ struct regmap *regmap = priv;
unsigned char tmp_val;
tmp_val = *((unsigned char *)val);
- return regmap_write(rx8581->regmap, RX8581_REG_RAM,
- (unsigned int)tmp_val);
+ return regmap_write(regmap, RX8581_REG_RAM, (unsigned int)tmp_val);
}
static const struct rx85x1_config rx8581_config = {
@@ -248,7 +239,7 @@ static const struct rx85x1_config rx8571_config = {
static int rx8581_probe(struct i2c_client *client)
{
- struct rx8581 *rx8581;
+ struct regmap *regmap;
const struct rx85x1_config *config = &rx8581_config;
const void *data = of_device_get_match_data(&client->dev);
struct rtc_device *rtc;
@@ -276,15 +267,11 @@ static int rx8581_probe(struct i2c_client *client)
if (data)
config = data;
- rx8581 = devm_kzalloc(&client->dev, sizeof(struct rx8581), GFP_KERNEL);
- if (!rx8581)
- return -ENOMEM;
-
- i2c_set_clientdata(client, rx8581);
+ regmap = devm_regmap_init_i2c(client, &config->regmap);
+ if (IS_ERR(regmap))
+ return PTR_ERR(regmap);
- rx8581->regmap = devm_regmap_init_i2c(client, &config->regmap);
- if (IS_ERR(rx8581->regmap))
- return PTR_ERR(rx8581->regmap);
+ i2c_set_clientdata(client, regmap);
rtc = devm_rtc_allocate_device(&client->dev);
if (IS_ERR(rtc))
@@ -299,7 +286,7 @@ static int rx8581_probe(struct i2c_client *client)
ret = devm_rtc_register_device(rtc);
for (i = 0; i < config->num_nvram; i++) {
- nvmem_cfg[i].priv = rx8581;
+ nvmem_cfg[i].priv = regmap;
devm_rtc_nvmem_register(rtc, &nvmem_cfg[i]);
}
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 16/18] rtc: sd3078: drop needless struct sd3078
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (14 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 15/18] rtc: rx8581: drop needless struct rx8581 André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-02-28 14:07 ` [PATCH 17/18] rtc: max77686: use dev_err_probe() where appropriate André Draszik
` (2 subsequent siblings)
18 siblings, 0 replies; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
This private data struct has one member only, there is no need to
allocate data for it and pass that around via the various callbacks,
just to extract that one member.
Instead, we can just pass that one member and avoid the extra memory
allocation, reducing runtime memory consumption.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
drivers/rtc/rtc-sd3078.c | 55 ++++++++++++++++++------------------------------
1 file changed, 20 insertions(+), 35 deletions(-)
diff --git a/drivers/rtc/rtc-sd3078.c b/drivers/rtc/rtc-sd3078.c
index ebb4d45ce2409982880affbc7a85d5e7410c8f42..10cc1dcfc7748144f51ef674939506feee1fb471 100644
--- a/drivers/rtc/rtc-sd3078.c
+++ b/drivers/rtc/rtc-sd3078.c
@@ -36,10 +36,6 @@
*/
#define WRITE_PROTECT_EN 0
-struct sd3078 {
- struct regmap *regmap;
-};
-
/*
* In order to prevent arbitrary modification of the time register,
* when modification of the register,
@@ -48,14 +44,11 @@ struct sd3078 {
* 2. set WRITE2 bit
* 3. set WRITE3 bit
*/
-static void sd3078_enable_reg_write(struct sd3078 *sd3078)
+static void sd3078_enable_reg_write(struct regmap *regmap)
{
- regmap_update_bits(sd3078->regmap, SD3078_REG_CTRL2,
- KEY_WRITE1, KEY_WRITE1);
- regmap_update_bits(sd3078->regmap, SD3078_REG_CTRL1,
- KEY_WRITE2, KEY_WRITE2);
- regmap_update_bits(sd3078->regmap, SD3078_REG_CTRL1,
- KEY_WRITE3, KEY_WRITE3);
+ regmap_update_bits(regmap, SD3078_REG_CTRL2, KEY_WRITE1, KEY_WRITE1);
+ regmap_update_bits(regmap, SD3078_REG_CTRL1, KEY_WRITE2, KEY_WRITE2);
+ regmap_update_bits(regmap, SD3078_REG_CTRL1, KEY_WRITE3, KEY_WRITE3);
}
#if WRITE_PROTECT_EN
@@ -68,14 +61,11 @@ static void sd3078_enable_reg_write(struct sd3078 *sd3078)
* 2. clear WRITE3 bit
* 3. clear WRITE1 bit
*/
-static void sd3078_disable_reg_write(struct sd3078 *sd3078)
+static void sd3078_disable_reg_write(struct regmap *regmap)
{
- regmap_update_bits(sd3078->regmap, SD3078_REG_CTRL1,
- KEY_WRITE2, 0);
- regmap_update_bits(sd3078->regmap, SD3078_REG_CTRL1,
- KEY_WRITE3, 0);
- regmap_update_bits(sd3078->regmap, SD3078_REG_CTRL2,
- KEY_WRITE1, 0);
+ regmap_update_bits(regmap, SD3078_REG_CTRL1, KEY_WRITE2, 0);
+ regmap_update_bits(regmap, SD3078_REG_CTRL1, KEY_WRITE3, 0);
+ regmap_update_bits(regmap, SD3078_REG_CTRL2, KEY_WRITE1, 0);
}
#endif
@@ -84,11 +74,10 @@ static int sd3078_rtc_read_time(struct device *dev, struct rtc_time *tm)
unsigned char hour;
unsigned char rtc_data[NUM_TIME_REGS] = {0};
struct i2c_client *client = to_i2c_client(dev);
- struct sd3078 *sd3078 = i2c_get_clientdata(client);
+ struct regmap *regmap = i2c_get_clientdata(client);
int ret;
- ret = regmap_bulk_read(sd3078->regmap, SD3078_REG_SC, rtc_data,
- NUM_TIME_REGS);
+ ret = regmap_bulk_read(regmap, SD3078_REG_SC, rtc_data, NUM_TIME_REGS);
if (ret < 0) {
dev_err(dev, "reading from RTC failed with err:%d\n", ret);
return ret;
@@ -122,7 +111,7 @@ static int sd3078_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
unsigned char rtc_data[NUM_TIME_REGS];
struct i2c_client *client = to_i2c_client(dev);
- struct sd3078 *sd3078 = i2c_get_clientdata(client);
+ struct regmap *regmap = i2c_get_clientdata(client);
int ret;
rtc_data[SD3078_REG_SC] = bin2bcd(tm->tm_sec);
@@ -134,10 +123,10 @@ static int sd3078_rtc_set_time(struct device *dev, struct rtc_time *tm)
rtc_data[SD3078_REG_YR] = bin2bcd(tm->tm_year - 100);
#if WRITE_PROTECT_EN
- sd3078_enable_reg_write(sd3078);
+ sd3078_enable_reg_write(regmap);
#endif
- ret = regmap_bulk_write(sd3078->regmap, SD3078_REG_SC, rtc_data,
+ ret = regmap_bulk_write(regmap, SD3078_REG_SC, rtc_data,
NUM_TIME_REGS);
if (ret < 0) {
dev_err(dev, "writing to RTC failed with err:%d\n", ret);
@@ -145,7 +134,7 @@ static int sd3078_rtc_set_time(struct device *dev, struct rtc_time *tm)
}
#if WRITE_PROTECT_EN
- sd3078_disable_reg_write(sd3078);
+ sd3078_disable_reg_write(regmap);
#endif
return 0;
@@ -165,23 +154,19 @@ static const struct regmap_config regmap_config = {
static int sd3078_probe(struct i2c_client *client)
{
int ret;
- struct sd3078 *sd3078;
+ struct regmap *regmap;
struct rtc_device *rtc;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
return -ENODEV;
- sd3078 = devm_kzalloc(&client->dev, sizeof(*sd3078), GFP_KERNEL);
- if (!sd3078)
- return -ENOMEM;
-
- sd3078->regmap = devm_regmap_init_i2c(client, ®map_config);
- if (IS_ERR(sd3078->regmap)) {
+ regmap = devm_regmap_init_i2c(client, ®map_config);
+ if (IS_ERR(regmap)) {
dev_err(&client->dev, "regmap allocation failed\n");
- return PTR_ERR(sd3078->regmap);
+ return PTR_ERR(regmap);
}
- i2c_set_clientdata(client, sd3078);
+ i2c_set_clientdata(client, regmap);
rtc = devm_rtc_allocate_device(&client->dev);
if (IS_ERR(rtc))
@@ -195,7 +180,7 @@ static int sd3078_probe(struct i2c_client *client)
if (ret)
return ret;
- sd3078_enable_reg_write(sd3078);
+ sd3078_enable_reg_write(regmap);
return 0;
}
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 17/18] rtc: max77686: use dev_err_probe() where appropriate
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (15 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 16/18] rtc: sd3078: drop needless struct sd3078 André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-03-01 13:18 ` Krzysztof Kozlowski
2025-02-28 14:07 ` [PATCH 18/18] rtc: s5m: convert to " André Draszik
2025-03-01 20:36 ` [PATCH 00/18] a few rtc driver cleanups Alexandre Belloni
18 siblings, 1 reply; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
dev_err_probe() exists to simplify code and harmonise error messages,
there's no reason not to use it here.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
drivers/rtc/rtc-max77686.c | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 6b0d02b44c8097453f704cbec9f02580fb869ca3..69ea3ce75b5a5426d4a56b979773be71c4ee7562 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -704,10 +704,9 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
}
info->regmap = dev_get_regmap(parent, NULL);
- if (!info->regmap) {
- dev_err(info->dev, "Failed to get rtc regmap\n");
- return -ENODEV;
- }
+ if (!info->regmap)
+ return dev_err_probe(info->dev, -ENODEV,
+ "Failed to get rtc regmap\n");
if (info->drv_data->rtc_i2c_addr == MAX77686_INVALID_I2C_ADDR) {
info->rtc_regmap = info->regmap;
@@ -716,28 +715,24 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
client = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter,
info->drv_data->rtc_i2c_addr);
- if (IS_ERR(client)) {
- dev_err(info->dev, "Failed to allocate I2C device for RTC\n");
- return PTR_ERR(client);
- }
+ if (IS_ERR(client))
+ return dev_err_probe(info->dev, PTR_ERR(client),
+ "Failed to allocate I2C device for RTC\n");
info->rtc_regmap = devm_regmap_init_i2c(client,
info->drv_data->regmap_config);
- if (IS_ERR(info->rtc_regmap)) {
- ret = PTR_ERR(info->rtc_regmap);
- dev_err(info->dev, "Failed to allocate RTC regmap: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(info->rtc_regmap))
+ return dev_err_probe(info->dev, PTR_ERR(info->rtc_regmap),
+ "Failed to allocate RTC regmap\n");
add_rtc_irq:
ret = regmap_add_irq_chip(info->rtc_regmap, info->rtc_irq,
IRQF_ONESHOT | IRQF_SHARED,
0, info->drv_data->rtc_irq_chip,
&info->rtc_irq_data);
- if (ret < 0) {
- dev_err(info->dev, "Failed to add RTC irq chip: %d\n", ret);
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(info->dev, ret,
+ "Failed to add RTC irq chip\n");
return 0;
}
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 18/18] rtc: s5m: convert to dev_err_probe() where appropriate
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (16 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 17/18] rtc: max77686: use dev_err_probe() where appropriate André Draszik
@ 2025-02-28 14:07 ` André Draszik
2025-03-01 13:19 ` Krzysztof Kozlowski
2025-03-01 20:36 ` [PATCH 00/18] a few rtc driver cleanups Alexandre Belloni
18 siblings, 1 reply; 30+ messages in thread
From: André Draszik @ 2025-02-28 14:07 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic, André Draszik
dev_err_probe() exists to simplify code and harmonise error messages,
there's no reason not to use it here.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
drivers/rtc/rtc-s5m.c | 50 +++++++++++++++++++++-----------------------------
1 file changed, 21 insertions(+), 29 deletions(-)
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 77dd61c30681b8f0a2f23063ad5f7eb52f5b7158..4c66e38145b02638c48685580c7943bdf79bfbd4 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -626,11 +626,10 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info)
}
info->rtc_24hr_mode = 1;
- if (ret < 0) {
- dev_err(info->dev, "%s: fail to write controlm reg(%d)\n",
- __func__, ret);
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(info->dev, ret,
+ "%s: fail to write controlm reg\n",
+ __func__);
return ret;
}
@@ -669,26 +668,21 @@ static int s5m_rtc_probe(struct platform_device *pdev)
alarm_irq = S5M8767_IRQ_RTCA1;
break;
default:
- dev_err(&pdev->dev,
- "Device type %lu is not supported by RTC driver\n",
- platform_get_device_id(pdev)->driver_data);
- return -ENODEV;
+ return dev_err_probe(&pdev->dev, -ENODEV,
+ "Device type %lu is not supported by RTC driver\n",
+ platform_get_device_id(pdev)->driver_data);
}
i2c = devm_i2c_new_dummy_device(&pdev->dev, i2c->adapter,
RTC_I2C_ADDR);
- if (IS_ERR(i2c)) {
- dev_err(&pdev->dev, "Failed to allocate I2C for RTC\n");
- return PTR_ERR(i2c);
- }
+ if (IS_ERR(i2c))
+ return dev_err_probe(&pdev->dev, PTR_ERR(i2c),
+ "Failed to allocate I2C for RTC\n");
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",
- ret);
- return ret;
- }
+ if (IS_ERR(info->regmap))
+ return dev_err_probe(&pdev->dev, PTR_ERR(info->regmap),
+ "Failed to allocate RTC register map\n");
info->dev = &pdev->dev;
info->s5m87xx = s5m87xx;
@@ -696,11 +690,10 @@ static int s5m_rtc_probe(struct platform_device *pdev)
if (s5m87xx->irq_data) {
info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq);
- if (info->irq <= 0) {
- dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n",
- alarm_irq);
- return -EINVAL;
- }
+ if (info->irq <= 0)
+ return dev_err_probe(&pdev->dev, -EINVAL,
+ "Failed to get virtual IRQ %d\n",
+ alarm_irq);
}
platform_set_drvdata(pdev, info);
@@ -724,11 +717,10 @@ static int s5m_rtc_probe(struct platform_device *pdev)
ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
s5m_rtc_alarm_irq, 0, "rtc-alarm0",
info);
- if (ret < 0) {
- dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
- info->irq, ret);
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret,
+ "Failed to request alarm IRQ %d\n",
+ info->irq);
device_init_wakeup(&pdev->dev, true);
}
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH 01/18] rtc: max77686: drop needless struct max77686_rtc_info::rtc member
2025-02-28 14:07 ` [PATCH 01/18] rtc: max77686: drop needless struct max77686_rtc_info::rtc member André Draszik
@ 2025-02-28 17:30 ` Krzysztof Kozlowski
0 siblings, 0 replies; 30+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-28 17:30 UTC (permalink / raw)
To: André Draszik, Chanwoo Choi, Alexandre Belloni, Joel Stanley,
Andrew Jeffery, Hans Ulli Kroll, Linus Walleij, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic
On 28/02/2025 15:07, André Draszik wrote:
> When this driver was converted to using the devres managed i2c device
> in commit 59a7f24fceb3 ("rtc: max77686: convert to
> devm_i2c_new_dummy_device()"), struct max77686_rtc_info::rtc 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.
>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---
> drivers/rtc/rtc-max77686.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 02/18] rtc: s5m: drop needless struct s5m_rtc_info::i2c member
2025-02-28 14:07 ` [PATCH 02/18] rtc: s5m: drop needless struct s5m_rtc_info::i2c member André Draszik
@ 2025-02-28 17:31 ` Krzysztof Kozlowski
2025-03-01 17:47 ` kernel test robot
1 sibling, 0 replies; 30+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-28 17:31 UTC (permalink / raw)
To: André Draszik, Chanwoo Choi, Alexandre Belloni, Joel Stanley,
Andrew Jeffery, Hans Ulli Kroll, Linus Walleij, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic
On 28/02/2025 15:07, André Draszik wrote:
> 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.
>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 17/18] rtc: max77686: use dev_err_probe() where appropriate
2025-02-28 14:07 ` [PATCH 17/18] rtc: max77686: use dev_err_probe() where appropriate André Draszik
@ 2025-03-01 13:18 ` Krzysztof Kozlowski
0 siblings, 0 replies; 30+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-01 13:18 UTC (permalink / raw)
To: André Draszik, Chanwoo Choi, Alexandre Belloni, Joel Stanley,
Andrew Jeffery, Hans Ulli Kroll, Linus Walleij, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic
On 28/02/2025 15:07, André Draszik wrote:
> dev_err_probe() exists to simplify code and harmonise error messages,
> there's no reason not to use it here.
>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---
> drivers/rtc/rtc-max77686.c | 29 ++++++++++++-----------------
> 1 file changed, 12 insertions(+), 17 deletions(-)
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 18/18] rtc: s5m: convert to dev_err_probe() where appropriate
2025-02-28 14:07 ` [PATCH 18/18] rtc: s5m: convert to " André Draszik
@ 2025-03-01 13:19 ` Krzysztof Kozlowski
0 siblings, 0 replies; 30+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-01 13:19 UTC (permalink / raw)
To: André Draszik, Chanwoo Choi, Alexandre Belloni, Joel Stanley,
Andrew Jeffery, Hans Ulli Kroll, Linus Walleij, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic
On 28/02/2025 15:07, André Draszik wrote:
> dev_err_probe() exists to simplify code and harmonise error messages,
> there's no reason not to use it here.
>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---
> drivers/rtc/rtc-s5m.c | 50 +++++++++++++++++++++------------------------
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 02/18] rtc: s5m: drop needless struct s5m_rtc_info::i2c member
2025-02-28 14:07 ` [PATCH 02/18] rtc: s5m: drop needless struct s5m_rtc_info::i2c member André Draszik
2025-02-28 17:31 ` Krzysztof Kozlowski
@ 2025-03-01 17:47 ` kernel test robot
1 sibling, 0 replies; 30+ messages in thread
From: kernel test robot @ 2025-03-01 17:47 UTC (permalink / raw)
To: André Draszik, Chanwoo Choi, Krzysztof Kozlowski,
Alexandre Belloni, Joel Stanley, Andrew Jeffery, Hans Ulli Kroll,
Linus Walleij, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Tóth János, Dianlong Li
Cc: llvm, oe-kbuild-all, linux-kernel, linux-rtc, linux-samsung-soc,
linux-arm-kernel, linux-aspeed, linux-amlogic, André Draszik
Hi André,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 0226d0ce98a477937ed295fb7df4cc30b46fc304]
url: https://github.com/intel-lab-lkp/linux/commits/Andr-Draszik/rtc-max77686-drop-needless-struct-max77686_rtc_info-rtc-member/20250228-221320
base: 0226d0ce98a477937ed295fb7df4cc30b46fc304
patch link: https://lore.kernel.org/r/20250228-rtc-cleanups-v1-2-b44cec078481%40linaro.org
patch subject: [PATCH 02/18] rtc: s5m: drop needless struct s5m_rtc_info::i2c member
config: arm-randconfig-004-20250301 (https://download.01.org/0day-ci/archive/20250302/202503020150.LkqTktVQ-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 14170b16028c087ca154878f5ed93d3089a965c6)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250302/202503020150.LkqTktVQ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503020150.LkqTktVQ-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/rtc/rtc-s5m.c:11:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:21:
In file included from include/linux/mm.h:2287:
include/linux/vmstat.h:507:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
507 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/rtc/rtc-s5m.c:678:46: warning: variable 'i2c' is uninitialized when used here [-Wuninitialized]
678 | i2c = devm_i2c_new_dummy_device(&pdev->dev, i2c->adapter,
| ^~~
drivers/rtc/rtc-s5m.c:642:24: note: initialize the variable 'i2c' to silence this warning
642 | struct i2c_client *i2c;
| ^
| = NULL
2 warnings generated.
vim +/i2c +678 drivers/rtc/rtc-s5m.c
637
638 static int s5m_rtc_probe(struct platform_device *pdev)
639 {
640 struct sec_pmic_dev *s5m87xx = dev_get_drvdata(pdev->dev.parent);
641 struct s5m_rtc_info *info;
642 struct i2c_client *i2c;
643 const struct regmap_config *regmap_cfg;
644 int ret, alarm_irq;
645
646 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
647 if (!info)
648 return -ENOMEM;
649
650 switch (platform_get_device_id(pdev)->driver_data) {
651 case S2MPS15X:
652 regmap_cfg = &s2mps14_rtc_regmap_config;
653 info->regs = &s2mps15_rtc_regs;
654 alarm_irq = S2MPS14_IRQ_RTCA0;
655 break;
656 case S2MPS14X:
657 regmap_cfg = &s2mps14_rtc_regmap_config;
658 info->regs = &s2mps14_rtc_regs;
659 alarm_irq = S2MPS14_IRQ_RTCA0;
660 break;
661 case S2MPS13X:
662 regmap_cfg = &s2mps14_rtc_regmap_config;
663 info->regs = &s2mps13_rtc_regs;
664 alarm_irq = S2MPS14_IRQ_RTCA0;
665 break;
666 case S5M8767X:
667 regmap_cfg = &s5m_rtc_regmap_config;
668 info->regs = &s5m_rtc_regs;
669 alarm_irq = S5M8767_IRQ_RTCA1;
670 break;
671 default:
672 dev_err(&pdev->dev,
673 "Device type %lu is not supported by RTC driver\n",
674 platform_get_device_id(pdev)->driver_data);
675 return -ENODEV;
676 }
677
> 678 i2c = devm_i2c_new_dummy_device(&pdev->dev, i2c->adapter,
679 RTC_I2C_ADDR);
680 if (IS_ERR(i2c)) {
681 dev_err(&pdev->dev, "Failed to allocate I2C for RTC\n");
682 return PTR_ERR(i2c);
683 }
684
685 info->regmap = devm_regmap_init_i2c(i2c, regmap_cfg);
686 if (IS_ERR(info->regmap)) {
687 ret = PTR_ERR(info->regmap);
688 dev_err(&pdev->dev, "Failed to allocate RTC register map: %d\n",
689 ret);
690 return ret;
691 }
692
693 info->dev = &pdev->dev;
694 info->s5m87xx = s5m87xx;
695 info->device_type = platform_get_device_id(pdev)->driver_data;
696
697 if (s5m87xx->irq_data) {
698 info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq);
699 if (info->irq <= 0) {
700 dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n",
701 alarm_irq);
702 return -EINVAL;
703 }
704 }
705
706 platform_set_drvdata(pdev, info);
707
708 ret = s5m8767_rtc_init_reg(info);
709 if (ret)
710 return ret;
711
712 info->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
713 if (IS_ERR(info->rtc_dev))
714 return PTR_ERR(info->rtc_dev);
715
716 info->rtc_dev->ops = &s5m_rtc_ops;
717
718 info->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_2000;
719 info->rtc_dev->range_max = RTC_TIMESTAMP_END_2099;
720
721 if (!info->irq) {
722 clear_bit(RTC_FEATURE_ALARM, info->rtc_dev->features);
723 } else {
724 ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
725 s5m_rtc_alarm_irq, 0, "rtc-alarm0",
726 info);
727 if (ret < 0) {
728 dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
729 info->irq, ret);
730 return ret;
731 }
732 device_init_wakeup(&pdev->dev, true);
733 }
734
735 return devm_rtc_register_device(info->rtc_dev);
736 }
737
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 10/18] rtc: pl030: drop needless struct pl030_rtc::rtc member
2025-02-28 14:07 ` [PATCH 10/18] rtc: pl030: drop needless struct pl030_rtc::rtc member André Draszik
@ 2025-03-01 18:11 ` Linus Walleij
0 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2025-03-01 18:11 UTC (permalink / raw)
To: André Draszik
Cc: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li, linux-kernel, linux-rtc,
linux-samsung-soc, linux-arm-kernel, linux-aspeed, linux-amlogic
On Fri, Feb 28, 2025 at 3:07 PM André Draszik <andre.draszik@linaro.org> wrote:
> 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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 06/18] rtc: ftrtc010: drop needless struct ftrtc010_rtc::rtc_dev member
2025-02-28 14:07 ` [PATCH 06/18] rtc: ftrtc010: drop needless struct ftrtc010_rtc::rtc_dev member André Draszik
@ 2025-03-01 18:12 ` Linus Walleij
0 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2025-03-01 18:12 UTC (permalink / raw)
To: André Draszik
Cc: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li, linux-kernel, linux-rtc,
linux-samsung-soc, linux-arm-kernel, linux-aspeed, linux-amlogic
On Fri, Feb 28, 2025 at 3:07 PM André Draszik <andre.draszik@linaro.org> wrote:
> The memory pointed to by the ::rtc_dev 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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 00/18] a few rtc driver cleanups
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
` (17 preceding siblings ...)
2025-02-28 14:07 ` [PATCH 18/18] rtc: s5m: convert to " André Draszik
@ 2025-03-01 20:36 ` Alexandre Belloni
2025-03-03 8:45 ` André Draszik
18 siblings, 1 reply; 30+ messages in thread
From: Alexandre Belloni @ 2025-03-01 20:36 UTC (permalink / raw)
To: André Draszik
Cc: Chanwoo Choi, Krzysztof Kozlowski, Joel Stanley, Andrew Jeffery,
Hans Ulli Kroll, Linus Walleij, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Tóth János,
Dianlong Li, linux-kernel, linux-rtc, linux-samsung-soc,
linux-arm-kernel, linux-aspeed, linux-amlogic
On 28/02/2025 14:07:13+0000, André Draszik wrote:
> Hi,
>
> While looking at RTC, I noticed that various drivers are keeping
> pointers to data that they're not using themselves throughout their
> lifetime.
>
> So I took the liberty to drop these pointers and this series is the
> result.
>
> The last two patches also convert two drivers to using dev_err_probe(),
> as I looked slightly closer into those two. They don't exactly fit the
> general subject of removal of unneeded pointers, but I wanted to share
> them anyway, since they're ready.
>
> All of this was compile-tested only.
>
> Cheers,
> Andre'
>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---
> André Draszik (18):
> rtc: max77686: drop needless struct max77686_rtc_info::rtc member
> rtc: s5m: drop needless struct s5m_rtc_info::i2c member
> rtc: aspeed: drop needless struct aspeed_rtc::rtc_dev member
> rtc: ds2404: drop needless struct ds2404::rtc member
> rtc: ep93xx: drop needless struct ep93xx_rtc::rtc member
> rtc: ftrtc010: drop needless struct ftrtc010_rtc::rtc_dev member
> rtc: m48t86: drop needless struct m48t86_rtc_info::rtc member
> rtc: meson: drop needless struct meson_rtc::rtc member
> rtc: meson-vrtc: drop needless struct meson_vrtc_data::rtc member
> rtc: pl030: drop needless struct pl030_rtc::rtc member
> rtc: rx8581: drop needless struct rx8581::rtc member
> rtc: s35390a: drop needless struct s35390a::rtc member
> rtc: sd2405al: drop needless struct sd2405al::rtc member
> rtc: sd3078: drop needless struct sd3078::rtc member
My main concern with this is that as soon as we introduce irq support,
we are going to need the rtc pointer back in the struct. But I guess
that most of them are old enough to say that nobody is interested in irq
support.
> rtc: rx8581: drop needless struct rx8581
> rtc: sd3078: drop needless struct sd3078
I guess you could squash those two with the previous ones touching the
respective drivers because you are the one removing the last remaining
struct member.
> rtc: max77686: use dev_err_probe() where appropriate
> rtc: s5m: convert to dev_err_probe() where appropriate
>
> drivers/rtc/rtc-aspeed.c | 16 ++++-----
> drivers/rtc/rtc-ds2404.c | 14 ++++----
> drivers/rtc/rtc-ep93xx.c | 16 ++++-----
> drivers/rtc/rtc-ftrtc010.c | 17 +++++----
> drivers/rtc/rtc-m48t86.c | 14 ++++----
> drivers/rtc/rtc-max77686.c | 37 +++++++++----------
> drivers/rtc/rtc-meson-vrtc.c | 12 +++----
> drivers/rtc/rtc-meson.c | 16 ++++-----
> drivers/rtc/rtc-pl030.c | 14 ++++----
> drivers/rtc/rtc-rx8581.c | 85 +++++++++++++++++++-------------------------
> drivers/rtc/rtc-s35390a.c | 22 ++++++------
> drivers/rtc/rtc-s5m.c | 58 +++++++++++++-----------------
> drivers/rtc/rtc-sd2405al.c | 16 ++++-----
> drivers/rtc/rtc-sd3078.c | 71 +++++++++++++++---------------------
> 14 files changed, 183 insertions(+), 225 deletions(-)
> ---
> base-commit: 0226d0ce98a477937ed295fb7df4cc30b46fc304
> change-id: 20250228-rtc-cleanups-12c0b5123ea4
>
> Best regards,
> --
> André Draszik <andre.draszik@linaro.org>
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 00/18] a few rtc driver cleanups
2025-03-01 20:36 ` [PATCH 00/18] a few rtc driver cleanups Alexandre Belloni
@ 2025-03-03 8:45 ` André Draszik
0 siblings, 0 replies; 30+ messages in thread
From: André Draszik @ 2025-03-03 8:45 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Chanwoo Choi, Krzysztof Kozlowski, Joel Stanley, Andrew Jeffery,
Hans Ulli Kroll, Linus Walleij, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Tóth János,
Dianlong Li, linux-kernel, linux-rtc, linux-samsung-soc,
linux-arm-kernel, linux-aspeed, linux-amlogic
Hi Alexandre,
On Sat, 2025-03-01 at 21:36 +0100, Alexandre Belloni wrote:
> On 28/02/2025 14:07:13+0000, André Draszik wrote:
> > Hi,
> >
> > While looking at RTC, I noticed that various drivers are keeping
> > pointers to data that they're not using themselves throughout their
> > lifetime.
> >
> > So I took the liberty to drop these pointers and this series is the
> > result.
> >
> > The last two patches also convert two drivers to using dev_err_probe(),
> > as I looked slightly closer into those two. They don't exactly fit the
> > general subject of removal of unneeded pointers, but I wanted to share
> > them anyway, since they're ready.
> >
> > All of this was compile-tested only.
> >
> > Cheers,
> > Andre'
> >
> > Signed-off-by: André Draszik <andre.draszik@linaro.org>
> > ---
> > André Draszik (18):
> > rtc: max77686: drop needless struct max77686_rtc_info::rtc member
> > rtc: s5m: drop needless struct s5m_rtc_info::i2c member
> > rtc: aspeed: drop needless struct aspeed_rtc::rtc_dev member
> > rtc: ds2404: drop needless struct ds2404::rtc member
> > rtc: ep93xx: drop needless struct ep93xx_rtc::rtc member
> > rtc: ftrtc010: drop needless struct ftrtc010_rtc::rtc_dev member
> > rtc: m48t86: drop needless struct m48t86_rtc_info::rtc member
> > rtc: meson: drop needless struct meson_rtc::rtc member
> > rtc: meson-vrtc: drop needless struct meson_vrtc_data::rtc member
> > rtc: pl030: drop needless struct pl030_rtc::rtc member
> > rtc: rx8581: drop needless struct rx8581::rtc member
> > rtc: s35390a: drop needless struct s35390a::rtc member
> > rtc: sd2405al: drop needless struct sd2405al::rtc member
> > rtc: sd3078: drop needless struct sd3078::rtc member
>
> My main concern with this is that as soon as we introduce irq support,
> we are going to need the rtc pointer back in the struct. But I guess
> that most of them are old enough to say that nobody is interested in irq
> support.
Thanks for your thoughts Alexandre - I don't know the history of
these drivers and don't mind either way. I can drop those patches
that would require reintroducing if irq support is added in the
future. I think overall you're OK with keeping them, but please
let me know if I'm misunderstanding :-)
>
> > rtc: rx8581: drop needless struct rx8581
> > rtc: sd3078: drop needless struct sd3078
>
> I guess you could squash those two with the previous ones touching the
> respective drivers because you are the one removing the last remaining
> struct member.
Will do.
Cheers,
Andre'
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 13/18] rtc: sd2405al: drop needless struct sd2405al::rtc member
2025-02-28 14:07 ` [PATCH 13/18] rtc: sd2405al: drop needless struct sd2405al::rtc member André Draszik
@ 2025-03-03 14:04 ` Tóth János
0 siblings, 0 replies; 30+ messages in thread
From: Tóth János @ 2025-03-03 14:04 UTC (permalink / raw)
To: André Draszik
Cc: Chanwoo Choi, Krzysztof Kozlowski, Alexandre Belloni,
Joel Stanley, Andrew Jeffery, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Dianlong Li, linux-kernel, linux-rtc, linux-samsung-soc,
linux-arm-kernel, linux-aspeed, linux-amlogic
Hi!
> We can drop it from the structure and just use a local temporary
> variable, reducing runtime memory consumption by a few bytes.
It works on real hardware.
Tested-by: Tóth János <gomba007@gmail.com>
Regards,
TJ
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 03/18] rtc: aspeed: drop needless struct aspeed_rtc::rtc_dev member
2025-02-28 14:07 ` [PATCH 03/18] rtc: aspeed: drop needless struct aspeed_rtc::rtc_dev member André Draszik
@ 2025-03-18 0:58 ` Andrew Jeffery
0 siblings, 0 replies; 30+ messages in thread
From: Andrew Jeffery @ 2025-03-18 0:58 UTC (permalink / raw)
To: André Draszik, Chanwoo Choi, Krzysztof Kozlowski,
Alexandre Belloni, Joel Stanley, Hans Ulli Kroll, Linus Walleij,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Tóth János, Dianlong Li
Cc: linux-kernel, linux-rtc, linux-samsung-soc, linux-arm-kernel,
linux-aspeed, linux-amlogic
On Fri, 2025-02-28 at 14:07 +0000, André Draszik wrote:
> The memory pointed to by the ::rtc_dev 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>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2025-03-18 1:00 UTC | newest]
Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-28 14:07 [PATCH 00/18] a few rtc driver cleanups André Draszik
2025-02-28 14:07 ` [PATCH 01/18] rtc: max77686: drop needless struct max77686_rtc_info::rtc member André Draszik
2025-02-28 17:30 ` Krzysztof Kozlowski
2025-02-28 14:07 ` [PATCH 02/18] rtc: s5m: drop needless struct s5m_rtc_info::i2c member André Draszik
2025-02-28 17:31 ` Krzysztof Kozlowski
2025-03-01 17:47 ` kernel test robot
2025-02-28 14:07 ` [PATCH 03/18] rtc: aspeed: drop needless struct aspeed_rtc::rtc_dev member André Draszik
2025-03-18 0:58 ` Andrew Jeffery
2025-02-28 14:07 ` [PATCH 04/18] rtc: ds2404: drop needless struct ds2404::rtc member André Draszik
2025-02-28 14:07 ` [PATCH 05/18] rtc: ep93xx: drop needless struct ep93xx_rtc::rtc member André Draszik
2025-02-28 14:07 ` [PATCH 06/18] rtc: ftrtc010: drop needless struct ftrtc010_rtc::rtc_dev member André Draszik
2025-03-01 18:12 ` Linus Walleij
2025-02-28 14:07 ` [PATCH 07/18] rtc: m48t86: drop needless struct m48t86_rtc_info::rtc member André Draszik
2025-02-28 14:07 ` [PATCH 08/18] rtc: meson: drop needless struct meson_rtc::rtc member André Draszik
2025-02-28 14:07 ` [PATCH 09/18] rtc: meson-vrtc: drop needless struct meson_vrtc_data::rtc member André Draszik
2025-02-28 14:07 ` [PATCH 10/18] rtc: pl030: drop needless struct pl030_rtc::rtc member André Draszik
2025-03-01 18:11 ` Linus Walleij
2025-02-28 14:07 ` [PATCH 11/18] rtc: rx8581: drop needless struct rx8581::rtc member André Draszik
2025-02-28 14:07 ` [PATCH 12/18] rtc: s35390a: drop needless struct s35390a::rtc member André Draszik
2025-02-28 14:07 ` [PATCH 13/18] rtc: sd2405al: drop needless struct sd2405al::rtc member André Draszik
2025-03-03 14:04 ` Tóth János
2025-02-28 14:07 ` [PATCH 14/18] rtc: sd3078: drop needless struct sd3078::rtc member André Draszik
2025-02-28 14:07 ` [PATCH 15/18] rtc: rx8581: drop needless struct rx8581 André Draszik
2025-02-28 14:07 ` [PATCH 16/18] rtc: sd3078: drop needless struct sd3078 André Draszik
2025-02-28 14:07 ` [PATCH 17/18] rtc: max77686: use dev_err_probe() where appropriate André Draszik
2025-03-01 13:18 ` Krzysztof Kozlowski
2025-02-28 14:07 ` [PATCH 18/18] rtc: s5m: convert to " André Draszik
2025-03-01 13:19 ` Krzysztof Kozlowski
2025-03-01 20:36 ` [PATCH 00/18] a few rtc driver cleanups Alexandre Belloni
2025-03-03 8:45 ` André Draszik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).