]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
Driver core / memory: Simplify __memory_block_change_state()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 23 May 2013 08:38:55 +0000 (10:38 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 1 Jun 2013 19:37:09 +0000 (21:37 +0200)
As noted by Tang Chen, the last_online field in struct memory_block
introduced by commit 4960e05 (Driver core: Introduce offline/online
callbacks for memory blocks) is not really necessary, because
online_pages() restores the previous state if passed ONLINE_KEEP as
the last argument.  Therefore, remove that field along with the code
referring to it.

References: http://marc.info/?l=linux-kernel&m=136919777305599&w=2
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Tang Chen <tangchen@cn.fujitsu.com>
drivers/base/memory.c
include/linux/memory.h

index c8f3b63fcacd56cf4460d20dfa505066fd51d5e8..c7092bc3c01ecafa98ef8bbfe714eacb4159af72 100644 (file)
@@ -291,13 +291,7 @@ static int __memory_block_change_state(struct memory_block *mem,
                mem->state = MEM_GOING_OFFLINE;
 
        ret = memory_block_action(mem->start_section_nr, to_state, online_type);
-       if (ret) {
-               mem->state = from_state_req;
-       } else {
-               mem->state = to_state;
-               if (to_state == MEM_ONLINE)
-                       mem->last_online = online_type;
-       }
+       mem->state = ret ? from_state_req : to_state;
        return ret;
 }
 
@@ -310,7 +304,7 @@ static int memory_subsys_online(struct device *dev)
 
        ret = mem->state == MEM_ONLINE ? 0 :
                __memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE,
-                                           mem->last_online);
+                                           ONLINE_KEEP);
 
        mutex_unlock(&mem->state_mutex);
        return ret;
@@ -618,7 +612,6 @@ static int init_memory_block(struct memory_block **memory,
                        base_memory_block_id(scn_nr) * sections_per_block;
        mem->end_section_nr = mem->start_section_nr + sections_per_block - 1;
        mem->state = state;
-       mem->last_online = ONLINE_KEEP;
        mem->section_count++;
        mutex_init(&mem->state_mutex);
        start_pfn = section_nr_to_pfn(mem->start_section_nr);
index 3d53465830228405f91159864ac7b71f011d506b..85c31a8e290459c6f3d89fd517ccb2e6d748f095 100644 (file)
@@ -26,7 +26,6 @@ struct memory_block {
        unsigned long start_section_nr;
        unsigned long end_section_nr;
        unsigned long state;
-       int last_online;
        int section_count;
 
        /*