mirror of
https://github.com/torvalds/linux.git
synced 2024-11-08 13:11:45 +00:00
mac802154: introduce hw_to_local function
This patch replace the mac802154_to_priv macro with a static inline function named hw_to_local. This brings a similar naming convention like mac80211 stack. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
d98be45b36
commit
60741361c3
@ -99,10 +99,14 @@ struct ieee802154_sub_if_data {
|
|||||||
struct mac802154_llsec sec;
|
struct mac802154_llsec sec;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define mac802154_to_priv(_hw) container_of(_hw, struct ieee802154_local, hw)
|
|
||||||
|
|
||||||
#define MAC802154_CHAN_NONE 0xff /* No channel is assigned */
|
#define MAC802154_CHAN_NONE 0xff /* No channel is assigned */
|
||||||
|
|
||||||
|
static inline struct ieee802154_local *
|
||||||
|
hw_to_local(struct ieee802154_hw *hw)
|
||||||
|
{
|
||||||
|
return container_of(hw, struct ieee802154_local, hw);
|
||||||
|
}
|
||||||
|
|
||||||
extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
|
extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
|
||||||
extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
|
extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ EXPORT_SYMBOL(ieee802154_alloc_hw);
|
|||||||
|
|
||||||
void ieee802154_free_hw(struct ieee802154_hw *hw)
|
void ieee802154_free_hw(struct ieee802154_hw *hw)
|
||||||
{
|
{
|
||||||
struct ieee802154_local *local = mac802154_to_priv(hw);
|
struct ieee802154_local *local = hw_to_local(hw);
|
||||||
|
|
||||||
BUG_ON(!list_empty(&local->interfaces));
|
BUG_ON(!list_empty(&local->interfaces));
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ EXPORT_SYMBOL(ieee802154_free_hw);
|
|||||||
|
|
||||||
int ieee802154_register_hw(struct ieee802154_hw *hw)
|
int ieee802154_register_hw(struct ieee802154_hw *hw)
|
||||||
{
|
{
|
||||||
struct ieee802154_local *local = mac802154_to_priv(hw);
|
struct ieee802154_local *local = hw_to_local(hw);
|
||||||
int rc = -ENOSYS;
|
int rc = -ENOSYS;
|
||||||
|
|
||||||
if (hw->flags & IEEE802154_HW_TXPOWER) {
|
if (hw->flags & IEEE802154_HW_TXPOWER) {
|
||||||
@ -381,7 +381,7 @@ EXPORT_SYMBOL(ieee802154_register_hw);
|
|||||||
|
|
||||||
void ieee802154_unregister_hw(struct ieee802154_hw *hw)
|
void ieee802154_unregister_hw(struct ieee802154_hw *hw)
|
||||||
{
|
{
|
||||||
struct ieee802154_local *local = mac802154_to_priv(hw);
|
struct ieee802154_local *local = hw_to_local(hw);
|
||||||
struct ieee802154_sub_if_data *sdata, *next;
|
struct ieee802154_sub_if_data *sdata, *next;
|
||||||
|
|
||||||
flush_workqueue(local->dev_workqueue);
|
flush_workqueue(local->dev_workqueue);
|
||||||
|
@ -49,7 +49,7 @@ struct rx_work {
|
|||||||
static void
|
static void
|
||||||
mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
|
mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
|
||||||
{
|
{
|
||||||
struct ieee802154_local *local = mac802154_to_priv(hw);
|
struct ieee802154_local *local = hw_to_local(hw);
|
||||||
|
|
||||||
mac_cb(skb)->lqi = lqi;
|
mac_cb(skb)->lqi = lqi;
|
||||||
skb->protocol = htons(ETH_P_IEEE802154);
|
skb->protocol = htons(ETH_P_IEEE802154);
|
||||||
@ -90,7 +90,7 @@ static void mac802154_rx_worker(struct work_struct *work)
|
|||||||
void
|
void
|
||||||
ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
|
ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
|
||||||
{
|
{
|
||||||
struct ieee802154_local *local = mac802154_to_priv(hw);
|
struct ieee802154_local *local = hw_to_local(hw);
|
||||||
struct rx_work *work;
|
struct rx_work *work;
|
||||||
|
|
||||||
if (!skb)
|
if (!skb)
|
||||||
|
@ -88,7 +88,7 @@ netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
|
|||||||
goto err_tx;
|
goto err_tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
mac802154_monitors_rx(mac802154_to_priv(&local->hw), skb);
|
mac802154_monitors_rx(local, skb);
|
||||||
|
|
||||||
if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
|
if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
|
||||||
u16 crc = crc_ccitt(0, skb->data, skb->len);
|
u16 crc = crc_ccitt(0, skb->data, skb->len);
|
||||||
|
Loading…
Reference in New Issue
Block a user