Search Linux Wireless

RE: [PATCH] wifi: mt76: mt7925: add rfkill_poll for hardware rfkill

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allan Wang <allan.wang@xxxxxxxxxxxx> wrote:

[...]

> @@ -2205,6 +2208,18 @@ static void mt7925_unassign_vif_chanctx(struct ieee80211_hw *hw,
>         mutex_unlock(&dev->mt76.mutex);
>  }
> 
> +static void mt7925_rfkill_poll(struct ieee80211_hw *hw)
> +{
> +       struct mt792x_phy *phy = mt792x_hw_phy(hw);
> +       int ret = 0;

no need initializer.

> +
> +       mt792x_mutex_acquire(phy->dev);
> +       ret = mt7925_mcu_wf_rf_pin_ctrl(phy);
> +       mt792x_mutex_release(phy->dev);
> +
> +       wiphy_rfkill_set_hw_state(hw->wiphy, ret ? false : true);

wiphy_rfkill_set_hw_state(hw->wiphy, ret == 0);

or

wiphy_rfkill_set_hw_state(hw->wiphy, !ret);

> +}
> +
>  const struct ieee80211_ops mt7925_ops = {
>         .tx = mt792x_tx,
>         .start = mt7925_start,
> @@ -2265,6 +2280,7 @@ const struct ieee80211_ops mt7925_ops = {
>         .link_info_changed = mt7925_link_info_changed,
>         .change_vif_links = mt7925_change_vif_links,
>         .change_sta_links = mt7925_change_sta_links,
> +       .rfkill_poll = mt7925_rfkill_poll,
>  };
>  EXPORT_SYMBOL_GPL(mt7925_ops);
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> index 286f602623c0..31fa092d2c8c 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> @@ -3633,6 +3633,45 @@ int mt7925_mcu_set_rate_txpower(struct mt76_phy *phy)
>         return 0;
>  }
> 
> +int mt7925_mcu_wf_rf_pin_ctrl(struct mt792x_phy *phy)
> +{
> +#define UNI_CMD_RADIO_STATUS_GET       0
> +       struct mt792x_dev *dev = phy->dev;
> +       struct sk_buff *skb;
> +       int ret;
> +

Should avoid empty line in declarations? 

> +       struct {
> +               __le16 tag;
> +               __le16 len;
> +               u8 rsv[4];
> +       } __packed req = {
> +               .tag = UNI_CMD_RADIO_STATUS_GET,
> +               .len = cpu_to_le16(sizeof(req)),
> +       };
> +
> +       struct mt7925_radio_status_event {
> +               __le16 tag;
> +               __le16 len;
> +
> +               u8 data;
> +               u8 rsv[3];
> +       } __packed * status;

I remember this should be "__packed *status", but checkpatch reports
false-alarm. 

> +
> +       ret = mt76_mcu_send_and_get_msg(&dev->mt76,
> +                                       MCU_UNI_CMD(RADIO_STATUS),
> +                                       &req, sizeof(req), true, &skb);
> +       if (ret)
> +               return ret;
> +
> +       skb_pull(skb, sizeof(struct tlv));
> +       status = (struct mt7925_radio_status_event *)skb->data;
> +       ret = (int)status->data;

I feel int casting is unnecessary.

> +
> +       dev_kfree_skb(skb);
> +
> +       return ret;
> +}
> +
>  int mt7925_mcu_set_rxfilter(struct mt792x_dev *dev, u32 fif,
>                             u8 bit_op, u32 bit_map)
>  {

[...]






[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux