@@ -2083,14 +2083,11 @@ static int s10_edac_dberr_handler(struct notifier_block *this,
&dberror);
regmap_write(edac->ecc_mgr_map, S10_SYSMGR_UE_VAL_OFST, dberror);
if (dberror & S10_DBE_IRQ_MASK) {
- struct list_head *position;
struct altr_edac_device_dev *ed;
struct arm_smccc_res result;
/* Find the matching DBE in the list of devices */
- list_for_each(position, &edac->a10_ecc_devices) {
- ed = list_entry(position, struct altr_edac_device_dev,
- next);
+ list_for_each_entry(ed, &edac->a10_ecc_devices, next) {
if (!(BIT(ed->db_irq) & dberror))
continue;
@@ -218,13 +218,10 @@ EXPORT_SYMBOL_GPL(edac_device_free_ctl_info);
static struct edac_device_ctl_info *find_edac_device_by_dev(struct device *dev)
{
struct edac_device_ctl_info *edac_dev;
- struct list_head *item;
edac_dbg(0, "\n");
- list_for_each(item, &edac_device_list) {
- edac_dev = list_entry(item, struct edac_device_ctl_info, link);
-
+ list_for_each_entry(edac_dev, &edac_device_list, link) {
if (edac_dev->dev == dev)
return edac_dev;
}
@@ -428,13 +428,10 @@ EXPORT_SYMBOL_GPL(edac_has_mcs);
static struct mem_ctl_info *__find_mci_by_dev(struct device *dev)
{
struct mem_ctl_info *mci;
- struct list_head *item;
edac_dbg(3, "\n");
- list_for_each(item, &mc_devices) {
- mci = list_entry(item, struct mem_ctl_info, link);
-
+ list_for_each_entry(mci, &mc_devices, link) {
if (mci->pdev == dev)
return mci;
}
@@ -495,21 +492,16 @@ static void edac_mc_workq_function(struct work_struct *work_req)
void edac_mc_reset_delay_period(unsigned long value)
{
struct mem_ctl_info *mci;
- struct list_head *item;
mutex_lock(&mem_ctls_mutex);
- list_for_each(item, &mc_devices) {
- mci = list_entry(item, struct mem_ctl_info, link);
-
+ list_for_each_entry(mci, &mc_devices, link) {
if (mci->op_state == OP_RUNNING_POLL)
edac_mod_work(&mci->work, value);
}
mutex_unlock(&mem_ctls_mutex);
}
-
-
/* Return 0 on success, 1 on failure.
* Before calling this function, caller must
* assign a unique value to mci->mc_idx.
@@ -573,12 +565,10 @@ static int del_mc_from_global_list(struct mem_ctl_info *mci)
struct mem_ctl_info *edac_mc_find(int idx)
{
struct mem_ctl_info *mci;
- struct list_head *item;
mutex_lock(&mem_ctls_mutex);
- list_for_each(item, &mc_devices) {
- mci = list_entry(item, struct mem_ctl_info, link);
+ list_for_each_entry(mci, &mc_devices, link) {
if (mci->mc_idx == idx)
goto unlock;
}
@@ -71,13 +71,10 @@ EXPORT_SYMBOL_GPL(edac_pci_free_ctl_info);
static struct edac_pci_ctl_info *find_edac_pci_by_dev(struct device *dev)
{
struct edac_pci_ctl_info *pci;
- struct list_head *item;
edac_dbg(1, "\n");
- list_for_each(item, &edac_pci_list) {
- pci = list_entry(item, struct edac_pci_ctl_info, link);
-
+ list_for_each_entry(pci, &edac_pci_list, link) {
if (pci->dev == dev)
return pci;
}
Convert list_for_each() to list_for_each_entry() so that the position/item list_head pointer and list_entry() call are no longer needed, which can reduce a few lines of code. No functional changed. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> --- drivers/edac/altera_edac.c | 5 +---- drivers/edac/edac_device.c | 5 +---- drivers/edac/edac_mc.c | 16 +++------------- drivers/edac/edac_pci.c | 5 +---- 4 files changed, 6 insertions(+), 25 deletions(-)