/* * Exporting to user space over generic netlink * * Parse the state get command from user space, return a combination * value that describe the current state. * * No attributes. */ static int wimax_gnl_doit_state_get(struct sk_buff *skb, struct genl_info *info) { int result, ifindex; struct wimax_dev *wimax_dev; struct device *dev; d_fnstart(3, NULL, "(skb %p info %p)\n", skb, info); result = -ENODEV; if (info->attrs[WIMAX_GNL_STGET_IFIDX] == NULL) { printk(KERN_ERR "WIMAX_GNL_OP_STATE_GET: can't find IFIDX " "attribute\n"); goto error_no_wimax_dev; } ifindex = nla_get_u32(info->attrs[WIMAX_GNL_STGET_IFIDX]); wimax_dev = wimax_dev_get_by_genl_info(info, ifindex); if (wimax_dev == NULL) goto error_no_wimax_dev; dev = wimax_dev_to_dev(wimax_dev); /* Execute the operation and send the result back to user space */ result = wimax_state_get(wimax_dev); dev_put(wimax_dev->net_dev); error_no_wimax_dev: d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result); return result; }
void i2400m_report_tlv_rf_switches_status( struct i2400m *i2400m, const struct i2400m_tlv_rf_switches_status *rfss) { struct device *dev = i2400m_dev(i2400m); enum i2400m_rf_switch_status hw, sw; enum wimax_st wimax_state; sw = le32_to_cpu(rfss->sw_rf_switch); hw = le32_to_cpu(rfss->hw_rf_switch); d_fnstart(3, dev, "(i2400m %p rfss %p [hw %u sw %u])\n", i2400m, rfss, hw, sw); wimax_state = wimax_state_get(&i2400m->wimax_dev); if (wimax_state < WIMAX_ST_RADIO_OFF) { d_printf(3, dev, "ignoring RF switches report, state %u\n", wimax_state); goto out; } switch (sw) { case I2400M_RF_SWITCH_ON: wimax_report_rfkill_sw(&i2400m->wimax_dev, WIMAX_RF_ON); break; case I2400M_RF_SWITCH_OFF: wimax_report_rfkill_sw(&i2400m->wimax_dev, WIMAX_RF_OFF); break; default: dev_err(dev, "HW BUG? Unknown RF SW state 0x%x\n", sw); } switch (hw) { case I2400M_RF_SWITCH_ON: wimax_report_rfkill_hw(&i2400m->wimax_dev, WIMAX_RF_ON); break; case I2400M_RF_SWITCH_OFF: wimax_report_rfkill_hw(&i2400m->wimax_dev, WIMAX_RF_OFF); break; default: dev_err(dev, "HW BUG? Unknown RF HW state 0x%x\n", hw); } out: d_fnend(3, dev, "(i2400m %p rfss %p [hw %u sw %u]) = void\n", i2400m, rfss, hw, sw); }