Skip to contentSkip to conversation

rtc: add prefix modalias for rtc modules

PATCH In review huanglei814 2 participants 3 messages Oct 15, 2024 – Oct 16, 2024 1 message not in the archive Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: add prefix modalias for rtc modules

From: huanglei <[email protected]>

When these rtc drivers is built as a module, To wire it up to udev, and let the module be loaded automatically, we need to export these alias from the modules.

---
 drivers/rtc/rtc-ds1302.c | 1 +
 drivers/rtc/rtc-ds1307.c | 1 +
 drivers/rtc/rtc-ds1343.c | 1 +
 drivers/rtc/rtc-ds1347.c | 1 +
 drivers/rtc/rtc-ds1374.c | 1 +
 drivers/rtc/rtc-ds1672.c | 1 +
 6 files changed, 6 insertions(+)
drivers/rtc/rtc-ds1302.c +1 -0
index ecc7d0307932..cc82f8e6326b 100644
@@ -211,3 +211,4 @@ module_spi_driver(ds1302_driver);
 MODULE_DESCRIPTION("Dallas DS1302 RTC driver");
 MODULE_AUTHOR("Paul Mundt, David McCullough");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:rtc-ds1302");
drivers/rtc/rtc-ds1307.c +1 -0
index 872e0b679be4..c402ab5cf383 100644
@@ -2024,3 +2024,4 @@ module_i2c_driver(ds1307_driver);
 
 MODULE_DESCRIPTION("RTC driver for DS1307 and similar chips");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("i2c:rtc-ds1307");
drivers/rtc/rtc-ds1343.c +1 -0
index ed5a6ba89a3e..e9183f745922 100644
@@ -481,3 +481,4 @@ MODULE_DESCRIPTION("DS1343 RTC SPI Driver");
 MODULE_AUTHOR("Raghavendra Chandra Ganiga <[email protected]>,"
 		"Ankur Srivastava <[email protected]>");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:ds1343");
drivers/rtc/rtc-ds1347.c +1 -0
index a40c1a52df65..babdd35cd82d 100644
@@ -181,3 +181,4 @@ module_spi_driver(ds1347_driver);
 MODULE_DESCRIPTION("DS1347 SPI RTC DRIVER");
 MODULE_AUTHOR("Raghavendra C Ganiga <[email protected]>");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:ds1347");
drivers/rtc/rtc-ds1374.c +1 -0
index c2359eb86bc9..3d61ab23c41c 100644
@@ -582,3 +582,4 @@ module_i2c_driver(ds1374_driver);
 MODULE_AUTHOR("Scott Wood <[email protected]>");
 MODULE_DESCRIPTION("Maxim/Dallas DS1374 RTC Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("i2c:rtc-ds1374");
drivers/rtc/rtc-ds1672.c +1 -0
index 6e5314215d00..a2240cd92774 100644
@@ -158,3 +158,4 @@ module_i2c_driver(ds1672_driver);
 MODULE_AUTHOR("Alessandro Zummo <[email protected]>");
 MODULE_DESCRIPTION("Dallas/Maxim DS1672 timekeeper driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("i2c:rtc-ds1672");
Signature · 1 line
2.17.1
#1 lore raw
Quoted 21 lines · On 15/10/2024 04:43, huanglei814 wrote:

From: huanglei <[email protected]>

When these rtc drivers is built as a module, To wire it up to udev, and let the module be loaded automatically, we need to export these alias from the modules.

---
 drivers/rtc/rtc-ds1302.c | 1 +
 drivers/rtc/rtc-ds1307.c | 1 +
 drivers/rtc/rtc-ds1343.c | 1 +
 drivers/rtc/rtc-ds1347.c | 1 +
 drivers/rtc/rtc-ds1374.c | 1 +
 drivers/rtc/rtc-ds1672.c | 1 +
 6 files changed, 6 insertions(+)
drivers/rtc/rtc-ds1302.c +0 -0
index ecc7d0307932..cc82f8e6326b 100644

drivers/rtc/rtc-ds1302.c module_spi_driver(ds1302_driver); · line 214

Quoted 4 lines
drivers/rtc/rtc-ds1302.c +1 -0
@@ -211,3 +211,4 @@ module_spi_driver(ds1302_driver);
 MODULE_DESCRIPTION("Dallas DS1302 RTC driver");
 MODULE_AUTHOR("Paul Mundt, David McCullough");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:rtc-ds1302");

NAK. That's neither correct, nor necessary. Driver has proper tables and is loaded automatically in correct setup. I assume your setup is just incorrect, but without description tricky to say how.

Best regards,
Krzysztof

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 4 lines · huanglei

Thank you for your reply.

However, Most other drivers have already set MODULE_ALIAS,  such as rtc-efi.c have set MODULE_ALIAS("platform:rtc-efi");

That driver might need, but this not. It's not an argument in favor.

Quoted 7 lines

So I think this is necessary. If loaded automatically is required, sometimes it is necessary to match through this alias.

MODULE_ALIAS adds some more info for the userspace programs. In /lib/modules/VERSION/modules.alias you can see the aliases that were parsed from the modules.

Don't explain what mod alias is. We know.

Quoted 3 lines

In this case running  'modprobe spi:rtc-ds1302' would insert the ds1302 module.

Which is wrong. There is proper alias already.

Quoted 32 lines

Now , you can see the difference between applying this patch and not applying it.

This is not applying this patch,  part of  the modules.alias related to rtc_ds1302/ds1347 rtc:

alias platform:rtc-ds1286 rtc_ds1286
alias spi:rtc-ds1305 rtc_ds1305
alias spi:rtc-ds1390 rtc_ds1390
alias platform:ds1511 rtc_ds1511
alias platform:rtc-ds1553 rtc_ds1553
alias platform:rtc-ds1685 rtc_ds1685
alias platform:rtc-ds1742 rtc_ds1742
alias platform:ds2404 rtc_ds2404
alias platform:rtc-efi rtc_efi

And this is applying this patch,  part of  the modules.alias related to rtc_ds1302/ds1347 rtc:

alias platform:rtc-ds1286 rtc_ds1286
alias spi:rtc-ds1302 rtc_ds1302
alias spi:rtc-ds1305 rtc_ds1305
alias spi:ds1347 rtc_ds1347
alias spi:rtc-ds1390 rtc_ds1390
alias platform:ds1511 rtc_ds1511
alias platform:rtc-ds1553 rtc_ds1553
alias platform:rtc-ds1685 rtc_ds1685
alias platform:rtc-ds1742 rtc_ds1742
alias platform:ds2404 rtc_ds2404
alias platform:rtc-efi rtc_efi

Quoted 4 lines

So, if not applying this patch, use modprobe rtc-ds1302/ds1347 may be not  to load automatically.

Therefore, it is strongly recommended applying this patch.

NAK. You do not understand aliases and you do not understand what is already in the driver.

Also, don't top post next time.

Best regards,
Krzysztof