/* Returns zero if carrier state does not change, nonzero if it does.  */
static int bond_set_carrier(struct bonding *bond)
/* Returns zero if carrier state does not change, nonzero if it does.  */
static int bond_set_carrier(struct bonding *bond)
{
	struct slave *slave;
	int i;
	if (bond->slave_cnt == 0)
		goto down;
	if (bond->params.mode == BOND_MODE_8023AD)
		return bond_3ad_set_carrier(bond);
	bond_for_each_slave(bond, slave, i) {
		if (slave->link == BOND_LINK_UP) {
			if (!netif_carrier_ok(bond->dev)) {
				netif_carrier_on(bond->dev);
				return 1;
			}
			return 0;
		}
	}
down:
	if (netif_carrier_ok(bond->dev)) {
		netif_carrier_off(bond->dev);
		return 1;
	}
	return 0;
}