add of_match_ptr() macro helper for of_match_table entry
Subsystems (4)
Do people think this is useful, and if so should I continue converting other subsystems?
A message that is not in the archive (sent off-list or not yet received): 1312362703-10189-1-git-send-email-ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org
PATCH 1/2 OF: Add of_match_ptr() macro
Add a macro of_match_ptr() that allows the .of_match_table entry in the driver structures to be assigned without having an #ifdef xxx NULL for the case that OF is not enabled
--- include/linux/of.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/linux/of.h +2 -0
@@ -234,6 +234,7 @@ extern void of_attach_node(struct device_node *);extern void of_detach_node (struct device_node *);#endif +#define of_match_ptr (_ptr) (_ptr)#else /* CONFIG_OF */ static inline bool of_have_populated_dt (void )
@@ -253,6 +254,7 @@ static inline int of_property_read_string(struct device_node *np,return -ENOSYS ; } +#define of_match_ptr (_ptr) NULL#endif /* CONFIG_OF */ static inline int of_property_read_u32(const struct device_node *np,
Signature · 1 line
1.7.1
PATCH 2/2 tty: use of_match_ptr() for of_match_table entry
In reply to a message not in the archiveUse the new of_match_ptr() macro for the of_match_table pointer entry to avoid having to #dfine match NULL
--- drivers/tty/serial/altera_jtaguart.c | 4 +--- drivers/tty/serial/altera_uart.c | 4 +--- drivers/tty/serial/uartlite.c | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-)
drivers/tty/serial/altera_jtaguart.c +1 -3
@@ -472,8 +472,6 @@ static struct of_device_id altera_jtaguart_match[] = { {}, };MODULE_DEVICE_TABLE (of, altera_jtaguart_match); -#else -#define altera_jtaguart_match NULL#endif /* CONFIG_OF */ static struct platform_driver altera_jtaguart_platform_driver = {
@@ -482,7 +480,7 @@ static struct platform_driver altera_jtaguart_platform_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, - .of_match_table = altera_jtaguart_match, + .of_match_table = of_match_ptr(altera_jtaguart_match), }, };
drivers/tty/serial/altera_uart.c +1 -3
@@ -616,8 +616,6 @@ static struct of_device_id altera_uart_match[] = { {}, };MODULE_DEVICE_TABLE (of, altera_uart_match); -#else -#define altera_uart_match NULL#endif /* CONFIG_OF */ static struct platform_driver altera_uart_platform_driver = {
@@ -626,7 +624,7 @@ static struct platform_driver altera_uart_platform_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, - .of_match_table = altera_uart_match, + .of_match_table = of_match_ptr(altera_uart_match), }, };
drivers/tty/serial/uartlite.c +1 -3
@@ -568,8 +568,6 @@ static struct of_device_id ulite_of_match[] __devinitdata = { {} };MODULE_DEVICE_TABLE (of, ulite_of_match); -#else /* CONFIG_OF */ -#define ulite_of_match NULL#endif /* CONFIG_OF */ static int __devinit ulite_probe (struct platform_device *pdev)
@@ -609,7 +607,7 @@ static struct platform_driver ulite_platform_driver = { .driver = { .owner = THIS_MODULE, .name = "uartlite", - .of_match_table = ulite_of_match, + .of_match_table = of_match_ptr(ulite_of_match), }, };
Signature · 1 line
1.7.1
A message that is not in the archive (sent off-list or not yet received): 1312362703-10189-3-git-send-email-ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org
Re: [PATCH 2/2] tty: use of_match_ptr() for of_match_table entry
Quoted 4 lines · Ben Dooks
Use the new
of_match_ptr()macro for theof_match_tablepointer entry to avoid having to #dfine match NULLSigned-off-by Ben Dooks <[email protected]>
Took me a while, but applied both, thanks.
g.
Quoted 75 lines
--- drivers/tty/serial/altera_jtaguart.c | 4 +--- drivers/tty/serial/altera_uart.c | 4 +--- drivers/tty/serial/uartlite.c | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-)drivers/tty/serial/altera_jtaguart.c +1
-3@@ -472,8 +472,6 @@ static struct of_device_id altera_jtaguart_match[] = { {}, };MODULE_DEVICE_TABLE (of, altera_jtaguart_match); -#else -#define altera_jtaguart_match NULL#endif /* CONFIG_OF */ static struct platform_driver altera_jtaguart_platform_driver = {@@ -482,7 +480,7 @@ static struct platform_driver altera_jtaguart_platform_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, - .of_match_table = altera_jtaguart_match, + .of_match_table = of_match_ptr(altera_jtaguart_match), }, };drivers/tty/serial/altera_uart.c +1
-3@@ -616,8 +616,6 @@ static struct of_device_id altera_uart_match[] = { {}, };MODULE_DEVICE_TABLE (of, altera_uart_match); -#else -#define altera_uart_match NULL#endif /* CONFIG_OF */ static struct platform_driver altera_uart_platform_driver = {@@ -626,7 +624,7 @@ static struct platform_driver altera_uart_platform_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, - .of_match_table = altera_uart_match, + .of_match_table = of_match_ptr(altera_uart_match), }, };drivers/tty/serial/uartlite.c +1
-3@@ -568,8 +568,6 @@ static struct of_device_id ulite_of_match[] __devinitdata = { {} };MODULE_DEVICE_TABLE (of, ulite_of_match); -#else /* CONFIG_OF */ -#define ulite_of_match NULL#endif /* CONFIG_OF */ static int __devinit ulite_probe (struct platform_device *pdev)@@ -609,7 +607,7 @@ static struct platform_driver ulite_platform_driver = { .driver = { .owner = THIS_MODULE, .name = "uartlite", - .of_match_table = ulite_of_match, + .of_match_table = of_match_ptr(ulite_of_match), }, };Signature · 1 line
1.7.1