Skip to content

Commit 8ca769e

Browse files
julianwiedmanndavem330
authored andcommitted
s390/qeth: shift some bridgeport code around
qeth_l2_setup_bridgeport_attrs() is entirely unrelated to sysfs functionality, move it where it belongs. While at it merge all the bridgeport-specific code in the set-online path together. Signed-off-by: Julian Wiedmann <[email protected]> Reviewed-by: Alexandra Winter <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 14a1d24 commit 8ca769e

File tree

3 files changed

+22
-39
lines changed

3 files changed

+22
-39
lines changed

drivers/s390/net/qeth_l2.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ extern const struct attribute_group *qeth_l2_attr_groups[];
1313

1414
int qeth_l2_create_device_attributes(struct device *);
1515
void qeth_l2_remove_device_attributes(struct device *);
16-
void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card);
1716
int qeth_bridgeport_query_ports(struct qeth_card *card,
1817
enum qeth_sbp_roles *role,
1918
enum qeth_sbp_states *state);

drivers/s390/net/qeth_l2_main.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,24 @@ static void qeth_l2_trace_features(struct qeth_card *card)
728728
sizeof(card->options.vnicc.sup_chars));
729729
}
730730

731+
static void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card)
732+
{
733+
if (!card->options.sbp.reflect_promisc &&
734+
card->options.sbp.role != QETH_SBP_ROLE_NONE) {
735+
/* Conditional to avoid spurious error messages */
736+
qeth_bridgeport_setrole(card, card->options.sbp.role);
737+
/* Let the callback function refresh the stored role value. */
738+
qeth_bridgeport_query_ports(card, &card->options.sbp.role,
739+
NULL);
740+
}
741+
if (card->options.sbp.hostnotification) {
742+
if (qeth_bridgeport_an_set(card, 1))
743+
card->options.sbp.hostnotification = 0;
744+
} else {
745+
qeth_bridgeport_an_set(card, 0);
746+
}
747+
}
748+
731749
static int qeth_l2_set_online(struct ccwgroup_device *gdev)
732750
{
733751
struct qeth_card *card = dev_get_drvdata(&gdev->dev);
@@ -748,9 +766,11 @@ static int qeth_l2_set_online(struct ccwgroup_device *gdev)
748766

749767
mutex_lock(&card->sbp_lock);
750768
qeth_bridgeport_query_support(card);
751-
if (card->options.sbp.supported_funcs)
769+
if (card->options.sbp.supported_funcs) {
770+
qeth_l2_setup_bridgeport_attrs(card);
752771
dev_info(&card->gdev->dev,
753-
"The device represents a Bridge Capable Port\n");
772+
"The device represents a Bridge Capable Port\n");
773+
}
754774
mutex_unlock(&card->sbp_lock);
755775

756776
qeth_l2_register_dev_addr(card);
@@ -761,8 +781,6 @@ static int qeth_l2_set_online(struct ccwgroup_device *gdev)
761781
qeth_trace_features(card);
762782
qeth_l2_trace_features(card);
763783

764-
qeth_l2_setup_bridgeport_attrs(card);
765-
766784
card->state = CARD_STATE_HARDSETUP;
767785
qeth_print_status_message(card);
768786

drivers/s390/net/qeth_l2_sys.c

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -246,40 +246,6 @@ static struct attribute_group qeth_l2_bridgeport_attr_group = {
246246
.attrs = qeth_l2_bridgeport_attrs,
247247
};
248248

249-
/**
250-
* qeth_l2_setup_bridgeport_attrs() - set/restore attrs when turning online.
251-
* @card: qeth_card structure pointer
252-
*
253-
* Note: this function is called with conf_mutex held by the caller
254-
*/
255-
void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card)
256-
{
257-
int rc;
258-
259-
if (!card)
260-
return;
261-
if (!card->options.sbp.supported_funcs)
262-
return;
263-
264-
mutex_lock(&card->sbp_lock);
265-
if (!card->options.sbp.reflect_promisc &&
266-
card->options.sbp.role != QETH_SBP_ROLE_NONE) {
267-
/* Conditional to avoid spurious error messages */
268-
qeth_bridgeport_setrole(card, card->options.sbp.role);
269-
/* Let the callback function refresh the stored role value. */
270-
qeth_bridgeport_query_ports(card,
271-
&card->options.sbp.role, NULL);
272-
}
273-
if (card->options.sbp.hostnotification) {
274-
rc = qeth_bridgeport_an_set(card, 1);
275-
if (rc)
276-
card->options.sbp.hostnotification = 0;
277-
} else {
278-
qeth_bridgeport_an_set(card, 0);
279-
}
280-
mutex_unlock(&card->sbp_lock);
281-
}
282-
283249
/* VNIC CHARS support */
284250

285251
/* convert sysfs attr name to VNIC characteristic */

0 commit comments

Comments
 (0)