* [PATCH 1/2] rtc: mt2712: remove unnecessary error string
@ 2020-04-15 20:00 Alexandre Belloni
2020-04-15 20:00 ` [PATCH 2/2] rtc: mt2712: switch to devm_platform_ioremap_resource Alexandre Belloni
0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Belloni @ 2020-04-15 20:00 UTC (permalink / raw)
To: linux-rtc, linux-kernel; +Cc: Alexandre Belloni
Remove the unnecessary error string as the core will already display error
messages when registration fails (i.e. never).
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-mt2712.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/rtc/rtc-mt2712.c b/drivers/rtc/rtc-mt2712.c
index f6bdbabd7202..9868d98f397c 100644
--- a/drivers/rtc/rtc-mt2712.c
+++ b/drivers/rtc/rtc-mt2712.c
@@ -354,13 +354,7 @@ static int mt2712_rtc_probe(struct platform_device *pdev)
mt2712_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
mt2712_rtc->rtc->range_max = MT2712_RTC_TIMESTAMP_END_2127;
- ret = rtc_register_device(mt2712_rtc->rtc);
- if (ret) {
- dev_err(&pdev->dev, "register rtc device failed\n");
- return ret;
- }
-
- return 0;
+ return rtc_register_device(mt2712_rtc->rtc);
}
#ifdef CONFIG_PM_SLEEP
--
2.25.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] rtc: mt2712: switch to devm_platform_ioremap_resource
2020-04-15 20:00 [PATCH 1/2] rtc: mt2712: remove unnecessary error string Alexandre Belloni
@ 2020-04-15 20:00 ` Alexandre Belloni
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2020-04-15 20:00 UTC (permalink / raw)
To: linux-rtc, linux-kernel; +Cc: Alexandre Belloni
Using devm_platform_ioremap_resource instead of open coding it reduces the
size of the binary.
text data bss dec hex filename
3728 216 0 3944 f68 drivers/rtc/rtc-mt2712.o
3744 216 0 3960 f78 drivers/rtc/rtc-mt2712.o.old
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
Note that while I don't approve the trend of doing this change tree wide, it is
way faster to do it myself now and avoid getting the same patch from someone I
don't trust (yet).
drivers/rtc/rtc-mt2712.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-mt2712.c b/drivers/rtc/rtc-mt2712.c
index 9868d98f397c..d5f691c8a035 100644
--- a/drivers/rtc/rtc-mt2712.c
+++ b/drivers/rtc/rtc-mt2712.c
@@ -310,7 +310,6 @@ static const struct rtc_class_ops mt2712_rtc_ops = {
static int mt2712_rtc_probe(struct platform_device *pdev)
{
- struct resource *res;
struct mt2712_rtc *mt2712_rtc;
int ret;
@@ -319,8 +318,7 @@ static int mt2712_rtc_probe(struct platform_device *pdev)
if (!mt2712_rtc)
return -ENOMEM;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- mt2712_rtc->base = devm_ioremap_resource(&pdev->dev, res);
+ mt2712_rtc->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(mt2712_rtc->base))
return PTR_ERR(mt2712_rtc->base);
--
2.25.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-15 20:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-15 20:00 [PATCH 1/2] rtc: mt2712: remove unnecessary error string Alexandre Belloni
2020-04-15 20:00 ` [PATCH 2/2] rtc: mt2712: switch to devm_platform_ioremap_resource Alexandre Belloni
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).