Skip to content

Commit

Permalink
Fix use of container_of macro for ISO C
Browse files Browse the repository at this point in the history
Linux 4.13 improves the type checking for the container_of macro. This
trips cases for which there is a type mismatch in ISO C but works with
GNU C. Some versions of GCC still issue a warning though.

URL: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20170529&id=daa2ac80834dc6c6752f198087aeb75fcc2afb03
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
  • Loading branch information
seragh committed Jun 10, 2017
1 parent 22d08c4 commit b37f306
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core.c
Expand Up @@ -549,8 +549,8 @@ static void mwl_chnl_switch_event(struct work_struct *work)

spin_lock_bh(&priv->vif_lock);
list_for_each_entry(mwl_vif, &priv->vif_list, list) {
vif = container_of((char *)mwl_vif, struct ieee80211_vif,
drv_priv[0]);
vif = container_of((void *)mwl_vif, struct ieee80211_vif,
drv_priv);

if (vif->csa_active)
ieee80211_csa_finish(vif);
Expand Down
16 changes: 8 additions & 8 deletions debugfs.c
Expand Up @@ -210,8 +210,8 @@ static ssize_t mwl_debugfs_vif_read(struct file *file, char __user *ubuf,
len += scnprintf(p + len, size - len, "\n");
spin_lock_bh(&priv->vif_lock);
list_for_each_entry(mwl_vif, &priv->vif_list, list) {
vif = container_of((char *)mwl_vif, struct ieee80211_vif,
drv_priv[0]);
vif = container_of((void *)mwl_vif, struct ieee80211_vif,
drv_priv);
len += scnprintf(p + len, size - len,
"macid: %d\n", mwl_vif->macid);
switch (vif->type) {
Expand Down Expand Up @@ -281,8 +281,8 @@ static ssize_t mwl_debugfs_sta_read(struct file *file, char __user *ubuf,
len += scnprintf(p + len, size - len, "\n");
spin_lock_bh(&priv->sta_lock);
list_for_each_entry(sta_info, &priv->sta_list, list) {
sta = container_of((char *)sta_info, struct ieee80211_sta,
drv_priv[0]);
sta = container_of((void *)sta_info, struct ieee80211_sta,
drv_priv);
len += scnprintf(p + len, size - len,
"mac address: %pM\n", sta->addr);
len += scnprintf(p + len, size - len, "aid: %u\n", sta->aid);
Expand Down Expand Up @@ -373,9 +373,9 @@ static ssize_t mwl_debugfs_ampdu_read(struct file *file, char __user *ubuf,
list_for_each_entry(sta_info, &priv->sta_list, list) {
for (i = 0; i < MWL_MAX_TID; i++) {
if (sta_info->check_ba_failed[i]) {
sta = container_of((char *)sta_info,
sta = container_of((void *)sta_info,
struct ieee80211_sta,
drv_priv[0]);
drv_priv);
len += scnprintf(p + len, size - len,
"%pM(%d): %d\n",
sta->addr, i,
Expand Down Expand Up @@ -793,8 +793,8 @@ static ssize_t mwl_debugfs_ratetable_read(struct file *file, char __user *ubuf,

spin_lock_bh(&priv->sta_lock);
list_for_each_entry(sta_info, &priv->sta_list, list) {
sta = container_of((char *)sta_info, struct ieee80211_sta,
drv_priv[0]);
sta = container_of((void *)sta_info, struct ieee80211_sta,
drv_priv);
if (priv->sta_aid == sta->aid) {
ether_addr_copy(addr, sta->addr);
break;
Expand Down

0 comments on commit b37f306

Please sign in to comment.