Skip to content

Commit

Permalink
s390/qeth: shift some bridgeport code around
Browse files Browse the repository at this point in the history
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 <jwi@linux.ibm.com>
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Julian Wiedmann authored and David S. Miller committed Jan 26, 2020
1 parent 14a1d24 commit 8ca769e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 39 deletions.
1 change: 0 additions & 1 deletion drivers/s390/net/qeth_l2.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ extern const struct attribute_group *qeth_l2_attr_groups[];

int qeth_l2_create_device_attributes(struct device *);
void qeth_l2_remove_device_attributes(struct device *);
void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card);
int qeth_bridgeport_query_ports(struct qeth_card *card,
enum qeth_sbp_roles *role,
enum qeth_sbp_states *state);
Expand Down
26 changes: 22 additions & 4 deletions drivers/s390/net/qeth_l2_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,24 @@ static void qeth_l2_trace_features(struct qeth_card *card)
sizeof(card->options.vnicc.sup_chars));
}

static void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card)
{
if (!card->options.sbp.reflect_promisc &&
card->options.sbp.role != QETH_SBP_ROLE_NONE) {
/* Conditional to avoid spurious error messages */
qeth_bridgeport_setrole(card, card->options.sbp.role);
/* Let the callback function refresh the stored role value. */
qeth_bridgeport_query_ports(card, &card->options.sbp.role,
NULL);
}
if (card->options.sbp.hostnotification) {
if (qeth_bridgeport_an_set(card, 1))
card->options.sbp.hostnotification = 0;
} else {
qeth_bridgeport_an_set(card, 0);
}
}

static int qeth_l2_set_online(struct ccwgroup_device *gdev)
{
struct qeth_card *card = dev_get_drvdata(&gdev->dev);
Expand All @@ -748,9 +766,11 @@ static int qeth_l2_set_online(struct ccwgroup_device *gdev)

mutex_lock(&card->sbp_lock);
qeth_bridgeport_query_support(card);
if (card->options.sbp.supported_funcs)
if (card->options.sbp.supported_funcs) {
qeth_l2_setup_bridgeport_attrs(card);
dev_info(&card->gdev->dev,
"The device represents a Bridge Capable Port\n");
"The device represents a Bridge Capable Port\n");
}
mutex_unlock(&card->sbp_lock);

qeth_l2_register_dev_addr(card);
Expand All @@ -761,8 +781,6 @@ static int qeth_l2_set_online(struct ccwgroup_device *gdev)
qeth_trace_features(card);
qeth_l2_trace_features(card);

qeth_l2_setup_bridgeport_attrs(card);

card->state = CARD_STATE_HARDSETUP;
qeth_print_status_message(card);

Expand Down
34 changes: 0 additions & 34 deletions drivers/s390/net/qeth_l2_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,40 +246,6 @@ static struct attribute_group qeth_l2_bridgeport_attr_group = {
.attrs = qeth_l2_bridgeport_attrs,
};

/**
* qeth_l2_setup_bridgeport_attrs() - set/restore attrs when turning online.
* @card: qeth_card structure pointer
*
* Note: this function is called with conf_mutex held by the caller
*/
void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card)
{
int rc;

if (!card)
return;
if (!card->options.sbp.supported_funcs)
return;

mutex_lock(&card->sbp_lock);
if (!card->options.sbp.reflect_promisc &&
card->options.sbp.role != QETH_SBP_ROLE_NONE) {
/* Conditional to avoid spurious error messages */
qeth_bridgeport_setrole(card, card->options.sbp.role);
/* Let the callback function refresh the stored role value. */
qeth_bridgeport_query_ports(card,
&card->options.sbp.role, NULL);
}
if (card->options.sbp.hostnotification) {
rc = qeth_bridgeport_an_set(card, 1);
if (rc)
card->options.sbp.hostnotification = 0;
} else {
qeth_bridgeport_an_set(card, 0);
}
mutex_unlock(&card->sbp_lock);
}

/* VNIC CHARS support */

/* convert sysfs attr name to VNIC characteristic */
Expand Down

0 comments on commit 8ca769e

Please sign in to comment.