Commit 8329fcf1 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

mac802154: remove check if operation is supported

This patch removes the check if operation is supported by driver layer.
This is done now by capabilities flags, if these are valid then the
driver should support the operation, otherwise a WARN_ON occurs.
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 791021bf
...@@ -98,10 +98,6 @@ ieee802154_set_cca_mode(struct wpan_phy *wpan_phy, ...@@ -98,10 +98,6 @@ ieee802154_set_cca_mode(struct wpan_phy *wpan_phy,
if (wpan_phy_cca_cmp(&wpan_phy->cca, cca)) if (wpan_phy_cca_cmp(&wpan_phy->cca, cca))
return 0; return 0;
/* check if phy support this setting */
if (!(local->hw.flags & IEEE802154_HW_CCA_MODE))
return -EOPNOTSUPP;
ret = drv_set_cca_mode(local, cca); ret = drv_set_cca_mode(local, cca);
if (!ret) if (!ret)
wpan_phy->cca = *cca; wpan_phy->cca = *cca;
...@@ -127,17 +123,12 @@ ieee802154_set_backoff_exponent(struct wpan_phy *wpan_phy, ...@@ -127,17 +123,12 @@ ieee802154_set_backoff_exponent(struct wpan_phy *wpan_phy,
struct wpan_dev *wpan_dev, struct wpan_dev *wpan_dev,
u8 min_be, u8 max_be) u8 min_be, u8 max_be)
{ {
struct ieee802154_local *local = wpan_phy_priv(wpan_phy);
ASSERT_RTNL(); ASSERT_RTNL();
if (wpan_dev->min_be == min_be && if (wpan_dev->min_be == min_be &&
wpan_dev->max_be == max_be) wpan_dev->max_be == max_be)
return 0; return 0;
if (!(local->hw.flags & IEEE802154_HW_CSMA_PARAMS))
return -EOPNOTSUPP;
wpan_dev->min_be = min_be; wpan_dev->min_be = min_be;
wpan_dev->max_be = max_be; wpan_dev->max_be = max_be;
return 0; return 0;
...@@ -161,16 +152,11 @@ ieee802154_set_max_csma_backoffs(struct wpan_phy *wpan_phy, ...@@ -161,16 +152,11 @@ ieee802154_set_max_csma_backoffs(struct wpan_phy *wpan_phy,
struct wpan_dev *wpan_dev, struct wpan_dev *wpan_dev,
u8 max_csma_backoffs) u8 max_csma_backoffs)
{ {
struct ieee802154_local *local = wpan_phy_priv(wpan_phy);
ASSERT_RTNL(); ASSERT_RTNL();
if (wpan_dev->csma_retries == max_csma_backoffs) if (wpan_dev->csma_retries == max_csma_backoffs)
return 0; return 0;
if (!(local->hw.flags & IEEE802154_HW_CSMA_PARAMS))
return -EOPNOTSUPP;
wpan_dev->csma_retries = max_csma_backoffs; wpan_dev->csma_retries = max_csma_backoffs;
return 0; return 0;
} }
...@@ -180,16 +166,11 @@ ieee802154_set_max_frame_retries(struct wpan_phy *wpan_phy, ...@@ -180,16 +166,11 @@ ieee802154_set_max_frame_retries(struct wpan_phy *wpan_phy,
struct wpan_dev *wpan_dev, struct wpan_dev *wpan_dev,
s8 max_frame_retries) s8 max_frame_retries)
{ {
struct ieee802154_local *local = wpan_phy_priv(wpan_phy);
ASSERT_RTNL(); ASSERT_RTNL();
if (wpan_dev->frame_retries == max_frame_retries) if (wpan_dev->frame_retries == max_frame_retries)
return 0; return 0;
if (!(local->hw.flags & IEEE802154_HW_FRAME_RETRIES))
return -EOPNOTSUPP;
wpan_dev->frame_retries = max_frame_retries; wpan_dev->frame_retries = max_frame_retries;
return 0; return 0;
} }
...@@ -198,16 +179,11 @@ static int ...@@ -198,16 +179,11 @@ static int
ieee802154_set_lbt_mode(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev, ieee802154_set_lbt_mode(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
bool mode) bool mode)
{ {
struct ieee802154_local *local = wpan_phy_priv(wpan_phy);
ASSERT_RTNL(); ASSERT_RTNL();
if (wpan_dev->lbt == mode) if (wpan_dev->lbt == mode)
return 0; return 0;
if (!(local->hw.flags & IEEE802154_HW_LBT))
return -EOPNOTSUPP;
wpan_dev->lbt = mode; wpan_dev->lbt = mode;
return 0; return 0;
} }
......
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