Merge tag 'pinctrl-v4.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-2.6-block.git] / drivers / net / wireless / intel / iwlwifi / iwl-trans.c
index 6069a9ff53fa8c751f68c338e9374f402810a89b..d42cab2910257d816c2281fdeb1aae1ae3dda0fc 100644 (file)
@@ -65,6 +65,7 @@
 
 #include "iwl-trans.h"
 #include "iwl-drv.h"
+#include "iwl-fh.h"
 
 struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
                                  struct device *dev,
@@ -77,7 +78,7 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
        static struct lock_class_key __key;
 #endif
 
-       trans = kzalloc(sizeof(*trans) + priv_size, GFP_KERNEL);
+       trans = devm_kzalloc(dev, sizeof(*trans) + priv_size, GFP_KERNEL);
        if (!trans)
                return NULL;
 
@@ -102,18 +103,14 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
                                  SLAB_HWCACHE_ALIGN,
                                  NULL);
        if (!trans->dev_cmd_pool)
-               goto free;
+               return NULL;
 
        return trans;
- free:
-       kfree(trans);
-       return NULL;
 }
 
 void iwl_trans_free(struct iwl_trans *trans)
 {
        kmem_cache_destroy(trans->dev_cmd_pool);
-       kfree(trans);
 }
 
 int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
@@ -139,6 +136,9 @@ int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
        if (!(cmd->flags & CMD_ASYNC))
                lock_map_acquire_read(&trans->sync_cmd_lockdep_map);
 
+       if (trans->wide_cmd_header && !iwl_cmd_groupid(cmd->id))
+               cmd->id = DEF_ID(cmd->id);
+
        ret = trans->ops->send_cmd(trans, cmd);
 
        if (!(cmd->flags & CMD_ASYNC))