Commit 55ea13df authored by François Romieu's avatar François Romieu Committed by Stephen Hemminger

[IRDA]: style: Separate data from code in irlan_print_filter().

parent b61458a4
...@@ -218,23 +218,29 @@ void irlan_check_command_param(struct irlan_cb *self, char *param, char *value) ...@@ -218,23 +218,29 @@ void irlan_check_command_param(struct irlan_cb *self, char *param, char *value)
* *
*/ */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
#define MASK2STR(m,s) { .mask = m, .str = s }
void irlan_print_filter(struct seq_file *seq, int filter_type) void irlan_print_filter(struct seq_file *seq, int filter_type)
{ {
if (filter_type & IRLAN_DIRECTED) static struct {
seq_printf(seq, "%s", "DIRECTED "); int mask;
if (filter_type & IRLAN_FUNCTIONAL) const char *str;
seq_printf(seq, "%s", "FUNCTIONAL "); } filter_mask2str[] = {
if (filter_type & IRLAN_GROUP) MASK2STR(IRLAN_DIRECTED, "DIRECTED"),
seq_printf(seq, "%s", "GROUP "); MASK2STR(IRLAN_FUNCTIONAL, "FUNCTIONAL"),
if (filter_type & IRLAN_MAC_FRAME) MASK2STR(IRLAN_GROUP, "GROUP"),
seq_printf(seq, "%s", "MAC_FRAME "); MASK2STR(IRLAN_MAC_FRAME, "MAC_FRAME"),
if (filter_type & IRLAN_MULTICAST) MASK2STR(IRLAN_MULTICAST, "MULTICAST"),
seq_printf(seq, "%s", "MULTICAST "); MASK2STR(IRLAN_BROADCAST, "BROADCAST"),
if (filter_type & IRLAN_BROADCAST) MASK2STR(IRLAN_IPX_SOCKET, "IPX_SOCKET"),
seq_printf(seq, "%s", "BROADCAST "); MASK2STR(0, NULL)
if (filter_type & IRLAN_IPX_SOCKET) }, *p;
seq_printf(seq, "%s", "IPX_SOCKET");
for (p = filter_mask2str; p->str; p++) {
if (filter_type & p->mask)
seq_printf(seq, "%s ", p->str);
}
seq_putc(seq, '\n'); seq_putc(seq, '\n');
} }
#undef MASK2STR
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment