Subject: linux-next: manual merge of the wireless-next tree with the wireless tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 3 Jun 2024 11:01:12 +1000

Hi all,

Today's linux-next merge of the wireless-next tree got a conflict in:

  drivers/net/wireless/microchip/wilc1000/netdev.c

between commit:

  ebfb5e8fc8b4 ("Revert "wifi: wilc1000: convert list management to RCU"")

from the wireless tree and commit:

  6fe46d5c0a84 ("wifi: wilc1000: set net device registration as last step during interface creation")

from the wireless-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/net/wireless/microchip/wilc1000/netdev.c
index 710e29bea560,4e2698528a49..000000000000
--- a/drivers/net/wireless/microchip/wilc1000/netdev.c
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
@@@ -679,9 -669,9 +672,9 @@@ static int wilc_set_mac_addr(struct net
  			return 0;
  		}
  	}
 -	rcu_read_unlock();
 +	srcu_read_unlock(&wilc->srcu, srcu_idx);
  
- 	result = wilc_set_mac_address(vif, (u8 *)addr->sa_data);
+ 	result = wilc_set_mac_address(vif, addr->sa_data);
  	if (result)
  		return result;
  
@@@ -972,6 -959,28 +966,28 @@@ struct wilc_vif *wilc_netdev_ifc_init(s
  	vif->priv.wdev.iftype = type;
  	vif->priv.dev = ndev;
  
+ 	ndev->needs_free_netdev = true;
+ 	vif->iftype = vif_type;
+ 	vif->idx = wilc_get_available_idx(wl);
+ 	vif->mac_opened = 0;
+ 
+ 	memcpy(mac_address, wl->nv_mac_address, ETH_ALEN);
+ 	/* WILC firmware uses locally administered MAC address for the
+ 	 * second virtual interface (bit 1 of first byte set), but
+ 	 * since it is possibly not loaded/running yet, reproduce this behavior
+ 	 * in the driver during interface creation.
+ 	 */
+ 	if (vif->idx)
+ 		mac_address[0] |= 0x2;
+ 
+ 	eth_hw_addr_set(vif->ndev, mac_address);
+ 
+ 	mutex_lock(&wl->vif_mutex);
+ 	list_add_tail_rcu(&vif->list, &wl->vif_list);
+ 	wl->vif_num += 1;
+ 	mutex_unlock(&wl->vif_mutex);
 -	synchronize_rcu();
++	synchronize_srcu(&wl->srcu);
+ 
  	if (rtnl_locked)
  		ret = cfg80211_register_netdevice(ndev);
  	else
@@@ -979,26 -988,17 +995,17 @@@
  
  	if (ret) {
  		ret = -EFAULT;
- 		goto error;
+ 		goto error_remove_vif;
  	}
  
- 	ndev->needs_free_netdev = true;
- 	vif->iftype = vif_type;
- 	vif->idx = wilc_get_available_idx(wl);
- 	vif->mac_opened = 0;
- 	mutex_lock(&wl->vif_mutex);
- 	list_add_tail_rcu(&vif->list, &wl->vif_list);
- 	wl->vif_num += 1;
- 	mutex_unlock(&wl->vif_mutex);
- 	synchronize_srcu(&wl->srcu);
- 
  	return vif;
  
- error:
- 	if (rtnl_locked)
- 		cfg80211_unregister_netdevice(ndev);
- 	else
- 		unregister_netdev(ndev);
+ error_remove_vif:
+ 	mutex_lock(&wl->vif_mutex);
+ 	list_del_rcu(&vif->list);
+ 	wl->vif_num -= 1;
+ 	mutex_unlock(&wl->vif_mutex);
 -	synchronize_rcu();
++	synchronize_srcu(&wl->srcu);
  	free_netdev(ndev);
  	return ERR_PTR(ret);
  }