From patchwork Thu Jan 14 09:54:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 59713 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp3896617lbb; Thu, 14 Jan 2016 01:54:29 -0800 (PST) X-Received: by 10.66.55.99 with SMTP id r3mr4564139pap.100.1452765269839; Thu, 14 Jan 2016 01:54:29 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si8405122pas.170.2016.01.14.01.54.29; Thu, 14 Jan 2016 01:54:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753129AbcANJy1 (ORCPT + 29 others); Thu, 14 Jan 2016 04:54:27 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:37193 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753083AbcANJyV (ORCPT ); Thu, 14 Jan 2016 04:54:21 -0500 Received: by mail-wm0-f53.google.com with SMTP id f206so419696680wmf.0 for ; Thu, 14 Jan 2016 01:54:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=QegeNBK+L+Whevmzh/Et4B6YMJFkf/OwoCPPT0jp+l4=; b=U+Gdf/JYnkfavCK4Yu0SQpOB02aaJ2aOEj8JLAiL0tVubXNQZxrrPodCdi/qOMYme9 VSi05Sg7yVGA9NlF73SaUHrIGwCeQ52hkdmar6KOriLKW207C6ow1IIvEDM4UF9kgzuJ xvf6ox4WlLJB5VvW4sXLM4+kk9QO/yuaBYPL0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QegeNBK+L+Whevmzh/Et4B6YMJFkf/OwoCPPT0jp+l4=; b=HeIBuWtgmAcvO0d7QbD+fYMO6fBH/byewYGd8rHn0KWFpXraH77XrG0b3JMftizWZE yzqJwW2nf71B+mN3sybJjWNXF8n0s5Ft7fDE0mYspFCbBfxCHqsmDzzjlKudJnmcrd38 keGg6B8gXzNR8xkdgbhypeFgKgGIqH+yUaHuSy02fmGmG2ayMV+p/AIQy+07lrKMmS9n 6KPIza3SwAkjGE98cHxibh+QfpgC4QSPSufU20U+6XYctwst+tl3N0xZbbaGunjzjG48 c8Wrx8B0KwVbRnm9IWQggKj21WHkihtyRBdMnEoPCtggI5021XHaYmT4mca2/FmqLHhg 27FQ== X-Gm-Message-State: ALoCoQlXbrqL8vB+pyP0YdpM4P11LuW0gkjuc8QSJHBcpUWTSJaE4DFxsKnEdwPJLoDTfNzknnEWlClKOSqepZPDB2KIavfNbA== X-Received: by 10.28.68.214 with SMTP id r205mr32266113wma.23.1452765258191; Thu, 14 Jan 2016 01:54:18 -0800 (PST) Received: from localhost.localdomain (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.gmail.com with ESMTPSA id w80sm26152702wme.17.2016.01.14.01.54.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Jan 2016 01:54:17 -0800 (PST) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org Subject: [PATCH] irq: Use a common macro to go through the actions list Date: Thu, 14 Jan 2016 10:54:13 +0100 Message-Id: <1452765253-31148-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The irq code browses the list of actions differently to inspect the element one by one. Even if it is not a problem, for the sake of lisibility and to unification of the code, provide a macro similar to for_each_irq_desc in order to have the same loop to go through the actions list and use it in the code. Signed-off-by: Daniel Lezcano --- kernel/irq/handle.c | 7 +++---- kernel/irq/internals.h | 3 +++ kernel/irq/manage.c | 8 +++----- kernel/irq/proc.c | 2 +- kernel/irq/spurious.c | 4 +--- 5 files changed, 11 insertions(+), 13 deletions(-) -- 1.9.1 diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index a302cf9..d881858 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c @@ -136,9 +136,9 @@ irqreturn_t handle_irq_event_percpu(struct irq_desc *desc) { irqreturn_t retval = IRQ_NONE; unsigned int flags = 0, irq = desc->irq_data.irq; - struct irqaction *action = desc->action; + struct irqaction *action; - do { + for_each_desc_action(desc, action) { irqreturn_t res; trace_irq_handler_entry(irq, action); @@ -172,8 +172,7 @@ irqreturn_t handle_irq_event_percpu(struct irq_desc *desc) } retval |= res; - action = action->next; - } while (action); + } add_interrupt_randomness(irq, flags); diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index fcab63c..5ea67df 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h @@ -131,6 +131,9 @@ static inline void chip_bus_sync_unlock(struct irq_desc *desc) #define IRQ_GET_DESC_CHECK_GLOBAL (_IRQ_DESC_CHECK) #define IRQ_GET_DESC_CHECK_PERCPU (_IRQ_DESC_CHECK | _IRQ_DESC_PERCPU) +#define for_each_desc_action(desc, act) \ + for (act = desc->act; act; act = act->next) + struct irq_desc * __irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus, unsigned int check); diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index c84670c..db54a87 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -144,13 +144,11 @@ int irq_can_set_affinity(unsigned int irq) */ void irq_set_thread_affinity(struct irq_desc *desc) { - struct irqaction *action = desc->action; + struct irqaction *action; - while (action) { + for_each_desc_action(desc, action) if (action->thread) set_bit(IRQTF_AFFINITY, &action->thread_flags); - action = action->next; - } } #ifdef CONFIG_GENERIC_PENDING_IRQ @@ -994,7 +992,7 @@ void irq_wake_thread(unsigned int irq, void *dev_id) return; raw_spin_lock_irqsave(&desc->lock, flags); - for (action = desc->action; action; action = action->next) { + for_each_desc_action(desc, action) { if (action->dev_id == dev_id) { if (action->thread) __irq_wake_thread(desc, action); diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index a2c02fd..24ec6ad 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c @@ -291,7 +291,7 @@ static int name_unique(unsigned int irq, struct irqaction *new_action) int ret = 1; raw_spin_lock_irqsave(&desc->lock, flags); - for (action = desc->action ; action; action = action->next) { + for_each_desc_action(desc, action) { if ((action != new_action) && action->name && !strcmp(new_action->name, action->name)) { ret = 0; diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index 3214417..3910b0a 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c @@ -211,14 +211,12 @@ static void __report_bad_irq(struct irq_desc *desc, irqreturn_t action_ret) * desc->lock here. See synchronize_irq(). */ raw_spin_lock_irqsave(&desc->lock, flags); - action = desc->action; - while (action) { + for_each_desc_action(desc, action) { printk(KERN_ERR "[<%p>] %pf", action->handler, action->handler); if (action->thread_fn) printk(KERN_CONT " threaded [<%p>] %pf", action->thread_fn, action->thread_fn); printk(KERN_CONT "\n"); - action = action->next; } raw_spin_unlock_irqrestore(&desc->lock, flags); }