[PATCH v2 1/2] drivers: libata: introduce sysctl directory

From: Enrico Weigelt, metux IT consult
Date: Wed Jun 05 2019 - 07:40:37 EST


Register a sysctl directory for libata, so upcoming knobs
can be added here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@xxxxxxxxx>
---
drivers/ata/libata-core.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index aaa57e0..2af2470 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -160,6 +160,21 @@ struct ata_force_ent {
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);

+static struct ctl_table ctl_libata[] = {
+ {}
+};
+
+static struct ctl_table libata_dir_table[] = {
+ {
+ .procname = "libata",
+ .maxlen = 0,
+ .mode = 0555,
+ .child = ctl_libata,
+ },
+ { },
+};
+
+static struct ctl_table_header *libata_sysctl_header;

static bool ata_sstatus_online(u32 sstatus)
{
@@ -7043,6 +7058,8 @@ static int __init ata_init(void)
goto err_out;
}

+ libata_sysctl_header = register_sysctl_table(libata_dir_table);
+
printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n");
return 0;

@@ -7056,6 +7073,7 @@ static void __exit ata_exit(void)
libata_transport_exit();
ata_sff_exit();
kfree(ata_force_tbl);
+ unregister_sysctl_table(libata_sysctl_header);
}

subsys_initcall(ata_init);
--
1.9.1