Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

altera_ps2: Add devicetree support

Add match table for device tree binding.

v2: use const and add compat version.
v3: change compatible vendor to ALTR.
add dts binding doc.
v4: condition module device table export for of.

Signed-off-by: Walter Goossens <waltergoossens@home.nl>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
[dustan.bower@gmail.com: fixed missing semicolon]
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

authored by

Walter Goossens and committed by
Grant Likely
0bfd95a2 b5d937de

+17 -2
+4
Documentation/devicetree/bindings/serio/altera_ps2.txt
··· 1 + Altera UP PS/2 controller 2 + 3 + Required properties: 4 + - compatible : should be "ALTR,ps2-1.0".
+13 -2
drivers/input/serio/altera_ps2.c
··· 19 19 #include <linux/platform_device.h> 20 20 #include <linux/io.h> 21 21 #include <linux/slab.h> 22 + #include <linux/of.h> 22 23 23 24 #define DRV_NAME "altera_ps2" 24 25 ··· 174 173 return 0; 175 174 } 176 175 176 + #ifdef CONFIG_OF 177 + static const struct of_device_id altera_ps2_match[] = { 178 + { .compatible = "ALTR,ps2-1.0", }, 179 + {}, 180 + }; 181 + MODULE_DEVICE_TABLE(of, altera_ps2_match); 182 + #else /* CONFIG_OF */ 183 + #define altera_ps2_match NULL 184 + #endif /* CONFIG_OF */ 185 + 177 186 /* 178 187 * Our device driver structure 179 188 */ ··· 193 182 .driver = { 194 183 .name = DRV_NAME, 195 184 .owner = THIS_MODULE, 185 + .of_match_table = altera_ps2_match, 196 186 }, 197 187 }; 198 188 ··· 201 189 { 202 190 return platform_driver_register(&altera_ps2_driver); 203 191 } 192 + module_init(altera_ps2_init); 204 193 205 194 static void __exit altera_ps2_exit(void) 206 195 { 207 196 platform_driver_unregister(&altera_ps2_driver); 208 197 } 209 - 210 - module_init(altera_ps2_init); 211 198 module_exit(altera_ps2_exit); 212 199 213 200 MODULE_DESCRIPTION("Altera University Program PS2 controller driver");