EDAC: Get rid of edac_handlers
authorBorislav Petkov <bp@suse.de>
Thu, 26 Jan 2017 15:49:59 +0000 (16:49 +0100)
committerBorislav Petkov <bp@suse.de>
Mon, 10 Apr 2017 15:14:17 +0000 (17:14 +0200)
Use mc_devices list instead to check whether we have EDAC driver
instances successfully registered with EDAC core.

Signed-off-by: Borislav Petkov <bp@suse.de>
drivers/edac/edac_mc.c
drivers/edac/edac_stub.c
include/linux/edac.h

index e5573c56b15e092df0eb0edf5d0d27490910f287..824d31193b694af2cb298f7b8961e3ed885b1bec 100644 (file)
@@ -601,7 +601,6 @@ static int add_mc_to_global_list(struct mem_ctl_info *mci)
        }
 
        list_add_tail_rcu(&mci->link, insert_before);
-       atomic_inc(&edac_handlers);
        return 0;
 
 fail0:
@@ -619,7 +618,6 @@ fail1:
 
 static int del_mc_from_global_list(struct mem_ctl_info *mci)
 {
-       int handlers = atomic_dec_return(&edac_handlers);
        list_del_rcu(&mci->link);
 
        /* these are for safe removal of devices from global list while
@@ -628,7 +626,7 @@ static int del_mc_from_global_list(struct mem_ctl_info *mci)
        synchronize_rcu();
        INIT_LIST_HEAD(&mci->link);
 
-       return handlers;
+       return list_empty(&mc_devices);
 }
 
 struct mem_ctl_info *edac_mc_find(int idx)
@@ -763,7 +761,7 @@ struct mem_ctl_info *edac_mc_del_mc(struct device *dev)
        /* mark MCI offline: */
        mci->op_state = OP_OFFLINE;
 
-       if (!del_mc_from_global_list(mci))
+       if (del_mc_from_global_list(mci))
                edac_mc_owner = NULL;
 
        mutex_unlock(&mem_ctls_mutex);
index d1389e4b7989d9b6ba570f9b92ed0ac22d6b4c69..cfb250fa38ce99a32f0fbe2b4aa0e3c9ebbe8576 100644 (file)
@@ -20,9 +20,6 @@
 int edac_op_state = EDAC_OPSTATE_INVAL;
 EXPORT_SYMBOL_GPL(edac_op_state);
 
-atomic_t edac_handlers = ATOMIC_INIT(0);
-EXPORT_SYMBOL_GPL(edac_handlers);
-
 int edac_err_assert = 0;
 EXPORT_SYMBOL_GPL(edac_err_assert);
 
index bf8daabf3d51fbd88a8260ed2b1247a4ddbaa925..9fd6fe53ab2a5f4c28438175e590c1a431c3ffcd 100644 (file)
@@ -29,7 +29,6 @@ struct device;
 
 extern int edac_op_state;
 extern int edac_err_assert;
-extern atomic_t edac_handlers;
 
 extern struct bus_type *edac_get_sysfs_subsys(void);