Lines Matching +full:primary +full:- +full:device

1 // SPDX-License-Identifier: GPL-2.0
12 static ssize_t qeth_bridge_port_role_state_show(struct device *dev, in qeth_bridge_port_role_state_show()
24 mutex_lock(&card->sbp_lock); in qeth_bridge_port_role_state_show()
26 card->options.sbp.supported_funcs) in qeth_bridge_port_role_state_show()
28 &card->options.sbp.role, &state); in qeth_bridge_port_role_state_show()
39 rc = -EIO; in qeth_bridge_port_role_state_show()
42 switch (card->options.sbp.role) { in qeth_bridge_port_role_state_show()
46 word = "primary"; break; in qeth_bridge_port_role_state_show()
50 rc = -EIO; in qeth_bridge_port_role_state_show()
54 card->options.sbp.role, state); in qeth_bridge_port_role_state_show()
58 mutex_unlock(&card->sbp_lock); in qeth_bridge_port_role_state_show()
63 static ssize_t qeth_bridge_port_role_show(struct device *dev, in qeth_bridge_port_role_show()
74 static ssize_t qeth_bridge_port_role_store(struct device *dev, in qeth_bridge_port_role_store()
81 if (sysfs_streq(buf, "primary")) in qeth_bridge_port_role_store()
88 return -EINVAL; in qeth_bridge_port_role_store()
90 mutex_lock(&card->conf_mutex); in qeth_bridge_port_role_store()
91 mutex_lock(&card->sbp_lock); in qeth_bridge_port_role_store()
94 rc = -EBUSY; in qeth_bridge_port_role_store()
95 else if (card->options.sbp.reflect_promisc) in qeth_bridge_port_role_store()
97 rc = -EPERM; in qeth_bridge_port_role_store()
101 card->options.sbp.role = role; in qeth_bridge_port_role_store()
103 card->options.sbp.role = role; in qeth_bridge_port_role_store()
105 mutex_unlock(&card->sbp_lock); in qeth_bridge_port_role_store()
106 mutex_unlock(&card->conf_mutex); in qeth_bridge_port_role_store()
114 static ssize_t qeth_bridge_port_state_show(struct device *dev, in qeth_bridge_port_state_show()
128 static ssize_t qeth_bridgeport_hostnotification_show(struct device *dev, in qeth_bridgeport_hostnotification_show()
137 enabled = card->options.sbp.hostnotification; in qeth_bridgeport_hostnotification_show()
142 static ssize_t qeth_bridgeport_hostnotification_store(struct device *dev, in qeth_bridgeport_hostnotification_store()
153 mutex_lock(&card->conf_mutex); in qeth_bridgeport_hostnotification_store()
154 mutex_lock(&card->sbp_lock); in qeth_bridgeport_hostnotification_store()
157 rc = -EBUSY; in qeth_bridgeport_hostnotification_store()
160 /* sbp_lock ensures ordering vs notifications-stopped events */ in qeth_bridgeport_hostnotification_store()
162 card->options.sbp.hostnotification = enable; in qeth_bridgeport_hostnotification_store()
164 card->options.sbp.hostnotification = enable; in qeth_bridgeport_hostnotification_store()
166 mutex_unlock(&card->sbp_lock); in qeth_bridgeport_hostnotification_store()
167 mutex_unlock(&card->conf_mutex); in qeth_bridgeport_hostnotification_store()
176 static ssize_t qeth_bridgeport_reflect_show(struct device *dev, in qeth_bridgeport_reflect_show()
185 if (card->options.sbp.reflect_promisc) { in qeth_bridgeport_reflect_show()
186 if (card->options.sbp.reflect_promisc_primary) in qeth_bridgeport_reflect_show()
187 state = "primary"; in qeth_bridgeport_reflect_show()
196 static ssize_t qeth_bridgeport_reflect_store(struct device *dev, in qeth_bridgeport_reflect_store()
200 int enable, primary; in qeth_bridgeport_reflect_store() local
205 primary = 0; in qeth_bridgeport_reflect_store()
206 } else if (sysfs_streq(buf, "primary")) { in qeth_bridgeport_reflect_store()
208 primary = 1; in qeth_bridgeport_reflect_store()
211 primary = 0; in qeth_bridgeport_reflect_store()
213 return -EINVAL; in qeth_bridgeport_reflect_store()
215 mutex_lock(&card->conf_mutex); in qeth_bridgeport_reflect_store()
216 mutex_lock(&card->sbp_lock); in qeth_bridgeport_reflect_store()
219 rc = -EBUSY; in qeth_bridgeport_reflect_store()
220 else if (card->options.sbp.role != QETH_SBP_ROLE_NONE) in qeth_bridgeport_reflect_store()
221 rc = -EPERM; in qeth_bridgeport_reflect_store()
223 card->options.sbp.reflect_promisc = enable; in qeth_bridgeport_reflect_store()
224 card->options.sbp.reflect_promisc_primary = primary; in qeth_bridgeport_reflect_store()
228 mutex_unlock(&card->sbp_lock); in qeth_bridgeport_reflect_store()
229 mutex_unlock(&card->conf_mutex); in qeth_bridgeport_reflect_store()
274 static ssize_t qeth_vnicc_timeout_show(struct device *dev, in qeth_vnicc_timeout_show()
282 if (rc == -EBUSY) in qeth_vnicc_timeout_show()
284 if (rc == -EOPNOTSUPP) in qeth_vnicc_timeout_show()
290 static ssize_t qeth_vnicc_timeout_store(struct device *dev, in qeth_vnicc_timeout_store()
302 mutex_lock(&card->conf_mutex); in qeth_vnicc_timeout_store()
304 mutex_unlock(&card->conf_mutex); in qeth_vnicc_timeout_store()
309 static ssize_t qeth_vnicc_char_show(struct device *dev, in qeth_vnicc_char_show()
317 vnicc = qeth_l2_vnicc_sysfs_attr_to_char(attr->attr.name); in qeth_vnicc_char_show()
320 if (rc == -EBUSY) in qeth_vnicc_char_show()
322 if (rc == -EOPNOTSUPP) in qeth_vnicc_char_show()
328 static ssize_t qeth_vnicc_char_store(struct device *dev, in qeth_vnicc_char_store()
338 return -EINVAL; in qeth_vnicc_char_store()
340 vnicc = qeth_l2_vnicc_sysfs_attr_to_char(attr->attr.name); in qeth_vnicc_char_store()
341 mutex_lock(&card->conf_mutex); in qeth_vnicc_char_store()
343 mutex_unlock(&card->conf_mutex); in qeth_vnicc_char_store()