On Thu, 2013-12-05 at 19:53 +0100, Johannes Berg wrote: > On Thu, 2013-12-05 at 18:53 +0000, Coelho, Luciano wrote: > > On Thu, 2013-12-05 at 17:04 +0100, Johannes Berg wrote: > > > On Thu, 2013-12-05 at 17:25 +0200, Luciano Coelho wrote: > > > > The return value of ieee80211_mesh_csa_beacon is not aligned with the > > > > return value of ieee80211_csa_beacon() and > > > > ieee80211_ibss_csa_beacon(). For consistency and to be able to use > > > > both functions with similar code, change ieee80211_mesh_csa_beacon() > > > > not to send the bss changed notification itself, but return what has > > > > changed so the caller can send the notification instead. > > > > > > It seems to me that the caller should be updated? > > > > With this patch only, the caller just checks if the return value is < 0 > > (ie. an error), otherwise it assumes it was okay. With this patch, we > > still return < 0 on errors, but we return positive, saying that the > > beacon has changed. > > > > My next patch (5/5) changes the caller so that the value is used > > properly (ie. ORing the return value to the changed variable). > > But doesn't that leave this patch broken? No. We used to return 0 in case of success (or -ENOMEM on failure). The caller checks the return value like this: err = ieee80211_mesh_csa_beacon(sdata, params, (ifmsh->csa_role == IEEE80211_MESH_CSA_ROLE_INIT)); if (err < 0) { ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE; return err; } With my change, instead of returning 0 on success, we return BSS_CHANGED_BEACON. The if (err < 0) will still evaluate to false, so it will be the same as before. Note that this patch is on top of the "mac80211: refactor ieee80211_mesh_chanswitch()". -- Luca. ��.n��������+%������w��{.n�����{���zW����ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f