From patchwork Sat Dec 14 00:09:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 3343721 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 971FF9F375 for ; Fri, 13 Dec 2013 23:09:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD4A420705 for ; Fri, 13 Dec 2013 23:09:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA3D520703 for ; Fri, 13 Dec 2013 23:09:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752796Ab3LMXJa (ORCPT ); Fri, 13 Dec 2013 18:09:30 -0500 Received: from mail-lb0-f178.google.com ([209.85.217.178]:41828 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752607Ab3LMXJ3 (ORCPT ); Fri, 13 Dec 2013 18:09:29 -0500 Received: by mail-lb0-f178.google.com with SMTP id c11so54182lbj.9 for ; Fri, 13 Dec 2013 15:09:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:subject:cc:from:organization:date :mime-version:content-type:content-transfer-encoding:message-id; bh=OqoDdi+8dIatYQbwQ1ke1kL08PlH4a2dezG7b5OW5zo=; b=iTFhxMi7MeFjiK2Acjx6z7H2itBG8Fu1GkdSH8IeLHhAF/b8Av2vVY9K70vBvelJsk ou7Xe70R/noDalwzpd0eCEDJeEED6xhpxwyU+4a8Ln3x5LpHnfdoY3Oon78r8M1PeWfl U7UhG7Y2jC9zliIShgqF1UG33G3Gmmddvn/dnRS0/E8X/ue+wd85My0Osev0UzTAqX1h SgCbWZ0q8HBPGWy172deOrOUi7o8Ei56Z4SqP3xM5yQTv9eqd2jLQnAUfs7Qb/jn14dK AirPHy8yGc1p6s7OKehy+ryRKgKAOBnT6p3YAbW91eLnyMW7SC29NDtxu3mSlB2yCvVE PoEA== X-Gm-Message-State: ALoCoQluUq4rzPQ1enWba6HPwerNTJAJkCec7hmXHu9d1o3iMDqDvv6CjNgovmQ4eUqs8rN9iLgn X-Received: by 10.152.219.133 with SMTP id po5mr2877513lac.34.1386976167267; Fri, 13 Dec 2013 15:09:27 -0800 (PST) Received: from wasted.dev.rtsoft.ru (ppp91-76-87-85.pppoe.mtu-net.ru. [91.76.87.85]) by mx.google.com with ESMTPSA id ld10sm8072392lab.8.2013.12.13.15.09.26 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 13 Dec 2013 15:09:26 -0800 (PST) To: tglx@linutronix.de, linux-sh@vger.kernel.org Subject: [PATCH] irq-renesas-irqc: simplify irq_set_type() method Cc: linux-kernel@vger.kernel.org, magnus.damm@gmail.com From: Sergei Shtylyov Organization: Cogent Embedded Date: Sat, 14 Dec 2013 03:09:31 +0300 MIME-Version: 1.0 Message-Id: <201312140309.31407.sergei.shtylyov@cogentembedded.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Value 0 of the sense selection field of CONFIG_n register means "disable event detection" and serves in irqc_sense[] for marking the invalid values of the IRQ type (by just omitting initializers). There is no need for INTC_IRQ_SENSE_VALID and hence INTC_IRQ_SENSE() as all field values matching to the valid IRQ types are non-zero anyway. Signed-off-by: Sergei Shtylyov Acked-by: Magnus Damm --- The patch is against the 'irq/core' branch of the 'tip.git' repo. drivers/irqchip/irq-renesas-irqc.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: renesas/drivers/irqchip/irq-renesas-irqc.c =================================================================== --- renesas.orig/drivers/irqchip/irq-renesas-irqc.c +++ renesas/drivers/irqchip/irq-renesas-irqc.c @@ -81,15 +81,12 @@ static void irqc_irq_disable(struct irq_ iowrite32(BIT(hw_irq), p->cpu_int_base + IRQC_EN_STS); } -#define INTC_IRQ_SENSE_VALID 0x10 -#define INTC_IRQ_SENSE(x) (x + INTC_IRQ_SENSE_VALID) - static unsigned char irqc_sense[IRQ_TYPE_SENSE_MASK + 1] = { - [IRQ_TYPE_LEVEL_LOW] = INTC_IRQ_SENSE(0x01), - [IRQ_TYPE_LEVEL_HIGH] = INTC_IRQ_SENSE(0x02), - [IRQ_TYPE_EDGE_FALLING] = INTC_IRQ_SENSE(0x04), /* Synchronous */ - [IRQ_TYPE_EDGE_RISING] = INTC_IRQ_SENSE(0x08), /* Synchronous */ - [IRQ_TYPE_EDGE_BOTH] = INTC_IRQ_SENSE(0x0c), /* Synchronous */ + [IRQ_TYPE_LEVEL_LOW] = 0x01, + [IRQ_TYPE_LEVEL_HIGH] = 0x02, + [IRQ_TYPE_EDGE_FALLING] = 0x04, /* Synchronous */ + [IRQ_TYPE_EDGE_RISING] = 0x08, /* Synchronous */ + [IRQ_TYPE_EDGE_BOTH] = 0x0c, /* Synchronous */ }; static int irqc_irq_set_type(struct irq_data *d, unsigned int type) @@ -101,12 +98,12 @@ static int irqc_irq_set_type(struct irq_ irqc_dbg(&p->irq[hw_irq], "sense"); - if (!(value & INTC_IRQ_SENSE_VALID)) + if (!value) return -EINVAL; tmp = ioread32(p->iomem + IRQC_CONFIG(hw_irq)); tmp &= ~0x3f; - tmp |= value ^ INTC_IRQ_SENSE_VALID; + tmp |= value; iowrite32(tmp, p->iomem + IRQC_CONFIG(hw_irq)); return 0; }