dmaengine: imx-sdma: Let the core do the device node validation
[linux/fpc-iii.git] / drivers / net / wireless / mediatek / mt76 / util.h
blob018d475504a255fb8e4f7511b8d31c2c9a0ad08f
1 /*
2 * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
3 * Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #ifndef __MT76_UTIL_H
16 #define __MT76_UTIL_H
18 #include <linux/skbuff.h>
19 #include <linux/bitops.h>
20 #include <linux/bitfield.h>
22 #define MT76_INCR(_var, _size) \
23 _var = (((_var) + 1) % _size)
25 int mt76_wcid_alloc(unsigned long *mask, int size);
27 static inline void
28 mt76_wcid_free(unsigned long *mask, int idx)
30 mask[idx / BITS_PER_LONG] &= ~BIT(idx % BITS_PER_LONG);
33 static inline void
34 mt76_skb_set_moredata(struct sk_buff *skb, bool enable)
36 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
38 if (enable)
39 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA);
40 else
41 hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_MOREDATA);
44 #endif