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)
*
*/
#ifdef CONFIG_PROC_FS
#define MASK2STR(m,s) { .mask = m, .str = s }
void irlan_print_filter(struct seq_file *seq, int filter_type)
{
if (filter_type & IRLAN_DIRECTED)
seq_printf(seq, "%s", "DIRECTED ");
if (filter_type & IRLAN_FUNCTIONAL)
seq_printf(seq, "%s", "FUNCTIONAL ");
if (filter_type & IRLAN_GROUP)
seq_printf(seq, "%s", "GROUP ");
if (filter_type & IRLAN_MAC_FRAME)
seq_printf(seq, "%s", "MAC_FRAME ");
if (filter_type & IRLAN_MULTICAST)
seq_printf(seq, "%s", "MULTICAST ");
if (filter_type & IRLAN_BROADCAST)
seq_printf(seq, "%s", "BROADCAST ");
if (filter_type & IRLAN_IPX_SOCKET)
seq_printf(seq, "%s", "IPX_SOCKET");
static struct {
int mask;
const char *str;
} filter_mask2str[] = {
MASK2STR(IRLAN_DIRECTED, "DIRECTED"),
MASK2STR(IRLAN_FUNCTIONAL, "FUNCTIONAL"),
MASK2STR(IRLAN_GROUP, "GROUP"),
MASK2STR(IRLAN_MAC_FRAME, "MAC_FRAME"),
MASK2STR(IRLAN_MULTICAST, "MULTICAST"),
MASK2STR(IRLAN_BROADCAST, "BROADCAST"),
MASK2STR(IRLAN_IPX_SOCKET, "IPX_SOCKET"),
MASK2STR(0, NULL)
}, *p;
for (p = filter_mask2str; p->str; p++) {
if (filter_type & p->mask)
seq_printf(seq, "%s ", p->str);
}
seq_putc(seq, '\n');
}
#undef MASK2STR
#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