From: Alexander Aring Date: Sat, 25 Oct 2014 07:41:02 +0000 (+0200) Subject: ieee802154: move wpan-phy.h to cfg802154.h X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5ad60d36993596f7b3b958500f9c66c5338cd855;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ieee802154: move wpan-phy.h to cfg802154.h The wpan-phy header contains the wpan_phy struct information. Later this header will be have similar function like cfg80211 header. The cfg80211 header contains the wiphy struct which is identically the wpan_phy struct inside 802.15.4 subsystem. Signed-off-by: Alexander Aring Cc: Alan Ott Signed-off-by: Marcel Holtmann --- diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 83a635f17367..795ac116602c 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c @@ -32,7 +32,7 @@ #include #include -#include +#include struct at86rf230_local; /* at86rf2xx chip depend data. diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c index 571f280204b6..f1770cf892ed 100644 --- a/drivers/net/ieee802154/cc2520.c +++ b/drivers/net/ieee802154/cc2520.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include #define SPI_COMMAND_BUFFER 3 diff --git a/drivers/net/ieee802154/fakehard.c b/drivers/net/ieee802154/fakehard.c index 9ce854f43917..1460bf520498 100644 --- a/drivers/net/ieee802154/fakehard.c +++ b/drivers/net/ieee802154/fakehard.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include struct fakehard_priv { struct wpan_phy *phy; diff --git a/drivers/net/ieee802154/fakelb.c b/drivers/net/ieee802154/fakelb.c index e4b1b1f66bd2..e6e2993b7ec6 100644 --- a/drivers/net/ieee802154/fakelb.c +++ b/drivers/net/ieee802154/fakelb.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include static int numlbs = 1; diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c index 0006b9ad5127..bea7349db6ad 100644 --- a/drivers/net/ieee802154/mrf24j40.c +++ b/drivers/net/ieee802154/mrf24j40.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h new file mode 100644 index 000000000000..5c674673ef20 --- /dev/null +++ b/include/net/cfg802154.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2007, 2008, 2009 Siemens AG + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Written by: + * Dmitry Eremin-Solenikov + */ + +#ifndef __NET_CFG802154_H +#define __NET_CFG802154_H + +#include +#include +#include + +/* According to the IEEE 802.15.4 stadard the upper most significant bits of + * the 32-bit channel bitmaps shall be used as an integer value to specify 32 + * possible channel pages. The lower 27 bits of the channel bit map shall be + * used as a bit mask to specify channel numbers within a channel page. + */ +#define WPAN_NUM_CHANNELS 27 +#define WPAN_NUM_PAGES 32 + +struct wpan_phy { + struct mutex pib_lock; + + /* + * This is a PIB according to 802.15.4-2011. + * We do not provide timing-related variables, as they + * aren't used outside of driver + */ + u8 current_channel; + u8 current_page; + u32 channels_supported[32]; + s8 transmit_power; + u8 cca_mode; + u8 min_be; + u8 max_be; + u8 csma_retries; + s8 frame_retries; + + bool lbt; + s32 cca_ed_level; + + struct device dev; + int idx; + + struct net_device *(*add_iface)(struct wpan_phy *phy, + const char *name, int type); + void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); + + int (*set_txpower)(struct wpan_phy *phy, int db); + int (*set_lbt)(struct wpan_phy *phy, bool on); + int (*set_cca_mode)(struct wpan_phy *phy, u8 cca_mode); + int (*set_cca_ed_level)(struct wpan_phy *phy, int level); + int (*set_csma_params)(struct wpan_phy *phy, u8 min_be, u8 max_be, + u8 retries); + int (*set_frame_retries)(struct wpan_phy *phy, s8 retries); + + char priv[0] __aligned(NETDEV_ALIGN); +}; + +#define to_phy(_dev) container_of(_dev, struct wpan_phy, dev) + +struct wpan_phy *wpan_phy_alloc(size_t priv_size); +static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev) +{ + phy->dev.parent = dev; +} + +int wpan_phy_register(struct wpan_phy *phy); +void wpan_phy_unregister(struct wpan_phy *phy); +void wpan_phy_free(struct wpan_phy *phy); +/* Same semantics as for class_for_each_device */ +int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data); + +static inline void *wpan_phy_priv(struct wpan_phy *phy) +{ + BUG_ON(!phy); + return &phy->priv; +} + +struct wpan_phy *wpan_phy_find(const char *str); + +static inline void wpan_phy_put(struct wpan_phy *phy) +{ + put_device(&phy->dev); +} + +static inline const char *wpan_phy_name(struct wpan_phy *phy) +{ + return dev_name(&phy->dev); +} + +#endif /* __NET_CFG802154_H */ diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h deleted file mode 100644 index 1e9795f116ba..000000000000 --- a/include/net/wpan-phy.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2007, 2008, 2009 Siemens AG - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Written by: - * Dmitry Eremin-Solenikov - */ - -#ifndef WPAN_PHY_H -#define WPAN_PHY_H - -#include -#include -#include - -/* According to the IEEE 802.15.4 stadard the upper most significant bits of - * the 32-bit channel bitmaps shall be used as an integer value to specify 32 - * possible channel pages. The lower 27 bits of the channel bit map shall be - * used as a bit mask to specify channel numbers within a channel page. - */ -#define WPAN_NUM_CHANNELS 27 -#define WPAN_NUM_PAGES 32 - -struct wpan_phy { - struct mutex pib_lock; - - /* - * This is a PIB according to 802.15.4-2011. - * We do not provide timing-related variables, as they - * aren't used outside of driver - */ - u8 current_channel; - u8 current_page; - u32 channels_supported[32]; - s8 transmit_power; - u8 cca_mode; - u8 min_be; - u8 max_be; - u8 csma_retries; - s8 frame_retries; - - bool lbt; - s32 cca_ed_level; - - struct device dev; - int idx; - - struct net_device *(*add_iface)(struct wpan_phy *phy, - const char *name, int type); - void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); - - int (*set_txpower)(struct wpan_phy *phy, int db); - int (*set_lbt)(struct wpan_phy *phy, bool on); - int (*set_cca_mode)(struct wpan_phy *phy, u8 cca_mode); - int (*set_cca_ed_level)(struct wpan_phy *phy, int level); - int (*set_csma_params)(struct wpan_phy *phy, u8 min_be, u8 max_be, - u8 retries); - int (*set_frame_retries)(struct wpan_phy *phy, s8 retries); - - char priv[0] __aligned(NETDEV_ALIGN); -}; - -#define to_phy(_dev) container_of(_dev, struct wpan_phy, dev) - -struct wpan_phy *wpan_phy_alloc(size_t priv_size); -static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev) -{ - phy->dev.parent = dev; -} - -int wpan_phy_register(struct wpan_phy *phy); -void wpan_phy_unregister(struct wpan_phy *phy); -void wpan_phy_free(struct wpan_phy *phy); -/* Same semantics as for class_for_each_device */ -int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data); - -static inline void *wpan_phy_priv(struct wpan_phy *phy) -{ - BUG_ON(!phy); - return &phy->priv; -} - -struct wpan_phy *wpan_phy_find(const char *str); - -static inline void wpan_phy_put(struct wpan_phy *phy) -{ - put_device(&phy->dev); -} - -static inline const char *wpan_phy_name(struct wpan_phy *phy) -{ - return dev_name(&phy->dev); -} -#endif diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c index 78a1529e8bb2..a9c8e3e98387 100644 --- a/net/ieee802154/nl-mac.c +++ b/net/ieee802154/nl-mac.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include "ieee802154.h" diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c index e943e20bcf09..0afe760ff512 100644 --- a/net/ieee802154/nl-phy.c +++ b/net/ieee802154/nl-phy.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include /* for rtnl_{un,}lock */ diff --git a/net/ieee802154/wpan-class.c b/net/ieee802154/wpan-class.c index e4c6fb31a360..760b7d752190 100644 --- a/net/ieee802154/wpan-class.c +++ b/net/ieee802154/wpan-class.c @@ -17,7 +17,7 @@ #include #include -#include +#include #include "ieee802154.h" diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c index 5adcbd87a4f5..5a604074555b 100644 --- a/net/mac802154/iface.c +++ b/net/mac802154/iface.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "ieee802154_i.h" diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c index 7c4b05ba2fe1..f118ea06d344 100644 --- a/net/mac802154/mac_cmd.c +++ b/net/mac802154/mac_cmd.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/net/mac802154/main.c b/net/mac802154/main.c index d11e42ae10d6..9798c741739c 100644 --- a/net/mac802154/main.c +++ b/net/mac802154/main.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "ieee802154_i.h" diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c index 91cd3b260243..7c9467216199 100644 --- a/net/mac802154/mib.c +++ b/net/mac802154/mib.c @@ -21,7 +21,7 @@ #include #include -#include +#include #include "ieee802154_i.h" diff --git a/net/mac802154/monitor.c b/net/mac802154/monitor.c index 2647a9e002ea..ca1dedd9b229 100644 --- a/net/mac802154/monitor.c +++ b/net/mac802154/monitor.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include "ieee802154_i.h" diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c index ef11cc6fa323..8f537bf731ca 100644 --- a/net/mac802154/tx.c +++ b/net/mac802154/tx.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "ieee802154_i.h"