From 89ccc8e6dc81bc1d613454b9944c2f3324d43e2a Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Fri, 2 Jan 2009 18:27:00 +0900 Subject: Use separate section for parsers array Instead of hardcoding the array of parsers, use the linker to do the work for us. Signed-off-by: Jeremy Kerr --- discover/parser-utils.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'discover/parser-utils.h') diff --git a/discover/parser-utils.h b/discover/parser-utils.h index e82e3f9..955f5f4 100644 --- a/discover/parser-utils.h +++ b/discover/parser-utils.h @@ -7,6 +7,16 @@ #define artwork_pathname(file) (PKG_SHARE_DIR "/artwork/" file) +#define define_parser(__name, __priority, __parse_fn) \ + struct parser \ + __attribute__((unused, section("parsers"))) \ + __ ## __name ## _parser = { \ + .name = #__name, \ + .priority = __priority, \ + .parse = __parse_fn, \ + }; + + void device_add_boot_option(struct device *device, struct boot_option *boot_option); -- cgit v1.2.1