Re: [OpenWrt-Devel] kernel module runtime configuration
Hi Brent, On Fri, Aug 15, 2014 at 12:45 AM, Brent Thomson brentthom...@gmail.com wrote: Hey all. I'm working on my first Linux kernel module. It's an adaptation of an hd44780-over-GPIO driver. You can see it here: https://github.com/brnt/openwrt-hd44780 The driver is working fine, but I'd like to allow the user to configure which GPIOs are used by the driver. Rather than hard-coding the values in the C file (as they're currently done) I'd prefer to read values from a config file (or the equivalent). The modern way to do this is to add a hd44780-gpio device node to the device tree, cfr. spi-over-gpio: Documentation/devicetree/bindings/spi/spi-gpio.txt Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] kernel module runtime configuration
Hello Brent, On 08/14/2014 03:45 PM, Brent Thomson wrote: Hey all. I'm working on my first Linux kernel module. It's an adaptation of an hd44780-over-GPIO driver. You can see it here: https://github.com/brnt/openwrt-hd44780 The driver is working fine, but I'd like to allow the user to configure which GPIOs are used by the driver. Rather than hard-coding the values in the C file (as they're currently done) I'd prefer to read values from a config file (or the equivalent). Is there a best practice for doing this at the kernel level module? In my googling, I've seen comments indicating that reading from files at the kernel level is a no-no? I'd prefer not to have to pass commands to insmod and instead allow a static file (potentially managed by uci). What's the right way to do this? I believe configfs is the prefered interface for specifying such a configuration. You could take a look at target/linux/generic/patches-3.10/863-gpiommc.patch to see how you can leverage this. -- Florian ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel