arch/tile: fix hardwall for tilegx and generalize for idn and ipi
[firefly-linux-kernel-4.4.55.git] / arch / tile / kernel / process.c
index 54e6c64b85cc5ee398be55e110b30d98114eb6cb..03448eb189a72222288112cc47609e84af93be6d 100644 (file)
@@ -145,10 +145,10 @@ void free_thread_info(struct thread_info *info)
         * Calling deactivate here just frees up the data structures.
         * If the task we're freeing held the last reference to a
         * hardwall fd, it would have been released prior to this point
-        * anyway via exit_files(), and "hardwall" would be NULL by now.
+        * anyway via exit_files(), and the hardwall_task.info pointers
+        * would be NULL by now.
         */
-       if (info->task->thread.hardwall)
-               hardwall_deactivate(info->task);
+       hardwall_deactivate_all(info->task);
 #endif
 
        if (step_state) {
@@ -264,7 +264,8 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
 
 #ifdef CONFIG_HARDWALL
        /* New thread does not own any networks. */
-       p->thread.hardwall = NULL;
+       memset(&p->thread.hardwall[0], 0,
+              sizeof(struct hardwall_task) * HARDWALL_TYPES);
 #endif
 
 
@@ -534,12 +535,7 @@ struct task_struct *__sched _switch_to(struct task_struct *prev,
 
 #ifdef CONFIG_HARDWALL
        /* Enable or disable access to the network registers appropriately. */
-       if (prev->thread.hardwall != NULL) {
-               if (next->thread.hardwall == NULL)
-                       restrict_network_mpls();
-       } else if (next->thread.hardwall != NULL) {
-               grant_network_mpls();
-       }
+       hardwall_switch_tasks(prev, next);
 #endif
 
        /*