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

leds: syscon: Make the driver explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/leds/Kconfig:config LEDS_SYSCON
drivers/leds/Kconfig: bool "LED support for LEDs on system controllers"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: linux-leds@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>

authored by

Paul Gortmaker and committed by
Jacek Anaszewski
f7d98a65 067a8f3c

+3 -15
+3 -15
drivers/leds/leds-syscon.c
··· 20 20 * MA 02111-1307 USA 21 21 */ 22 22 #include <linux/io.h> 23 - #include <linux/module.h> 23 + #include <linux/init.h> 24 24 #include <linux/of_device.h> 25 25 #include <linux/of_address.h> 26 26 #include <linux/platform_device.h> ··· 139 139 return 0; 140 140 } 141 141 142 - static int syscon_led_remove(struct platform_device *pdev) 143 - { 144 - struct syscon_led *sled = platform_get_drvdata(pdev); 145 - 146 - led_classdev_unregister(&sled->cdev); 147 - /* Turn it off */ 148 - regmap_update_bits(sled->map, sled->offset, sled->mask, 0); 149 - return 0; 150 - } 151 - 152 142 static const struct of_device_id of_syscon_leds_match[] = { 153 143 { .compatible = "register-bit-led", }, 154 144 {}, 155 145 }; 156 146 157 - MODULE_DEVICE_TABLE(of, of_syscon_leds_match); 158 - 159 147 static struct platform_driver syscon_led_driver = { 160 148 .probe = syscon_led_probe, 161 - .remove = syscon_led_remove, 162 149 .driver = { 163 150 .name = "leds-syscon", 164 151 .of_match_table = of_syscon_leds_match, 152 + .suppress_bind_attrs = true, 165 153 }, 166 154 }; 167 - module_platform_driver(syscon_led_driver); 155 + builtin_platform_driver(syscon_led_driver);