generic: routerboot sysfs: move tag_show_string()

This routine will be shared between hard and soft config drivers.
Also use scnprintf() instead of snprintf().

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This commit is contained in:
Thibaut VARÈNE
2020-05-13 18:43:30 +02:00
committed by Koen Vandeputte
parent 39ec3c5986
commit dac18f66fb
3 changed files with 15 additions and 11 deletions

View File

@@ -175,6 +175,13 @@ static void __exit routerboot_exit(void)
kobject_put(rb_kobj); // recursive afaict
}
/* Common routines */
ssize_t routerboot_tag_show_string(const u8 *pld, u16 pld_len, char *buf)
{
return scnprintf(buf, pld_len+1, "%s\n", pld);
}
module_init(routerboot_init);
module_exit(routerboot_exit);