From patchwork Wed Feb 18 16:12:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 44784 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3C56321573 for ; Wed, 18 Feb 2015 16:12:43 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id b15sf1927326eek.0 for ; Wed, 18 Feb 2015 08:12:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=eOBxPw2LGv5FAOiWhlbHh9JBEnQ00mPPFQjKfbA3bxQ=; b=bj4vMxW1hFVcnMviglzAl/xJP6u7xVPUap2Fc3ojP0KLMRFvwwY5CAlipCPIGmxbXb LLVv4EOZsxFm6lJ4wXD7HbzpWt+osGiJ3dY9XmO0r1QMnWh1uDKga8Tqn0PQdx7G+UEi ptddq+cTHAUY/qJZr2SDTJRN70SXcoTOuP/FOmoI/hlVT1rHm94tCnOCNQnDh/0O4oHs 8ZZU6aWA9lVqfJYzSUx5/xrIlN0sOiUSthqcp35Zbj8zR/L749I9RH4ProFo36uRdPgU TE1vm34tei02H/6UdFNiXTZq4nEjasdnD4fgPkI8x7jd9Tjb14nMD0szKuvNHEOFGfB9 ufKw== X-Gm-Message-State: ALoCoQkkd3gvAk6t6Pjj8WfVOOYkKun7FPoo3w0j3b0B6HpHZvSfKLDe5gJli211m8nQ7knJVlOn X-Received: by 10.181.13.236 with SMTP id fb12mr138321wid.1.1424275962370; Wed, 18 Feb 2015 08:12:42 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.135 with SMTP id t7ls40644lag.45.gmail; Wed, 18 Feb 2015 08:12:42 -0800 (PST) X-Received: by 10.112.12.134 with SMTP id y6mr121279lbb.34.1424275961726; Wed, 18 Feb 2015 08:12:41 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id qa1si13018379lbc.73.2015.02.18.08.12.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Feb 2015 08:12:41 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbvp9 with SMTP id p9so2100453lbv.3 for ; Wed, 18 Feb 2015 08:12:41 -0800 (PST) X-Received: by 10.112.14.196 with SMTP id r4mr44056lbc.86.1424275961016; Wed, 18 Feb 2015 08:12:41 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp2946241lbj; Wed, 18 Feb 2015 08:12:39 -0800 (PST) X-Received: by 10.70.96.69 with SMTP id dq5mr59942414pdb.1.1424275958234; Wed, 18 Feb 2015 08:12:38 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xm1si1088365pbb.149.2015.02.18.08.12.36; Wed, 18 Feb 2015 08:12:38 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752760AbbBRQMd (ORCPT + 28 others); Wed, 18 Feb 2015 11:12:33 -0500 Received: from mail-la0-f50.google.com ([209.85.215.50]:46480 "EHLO mail-la0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751571AbbBRQMc (ORCPT ); Wed, 18 Feb 2015 11:12:32 -0500 Received: by lams18 with SMTP id s18so2067731lam.13 for ; Wed, 18 Feb 2015 08:12:30 -0800 (PST) X-Received: by 10.152.44.225 with SMTP id h1mr5059151lam.99.1424275950351; Wed, 18 Feb 2015 08:12:30 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id j9sm4281620lbp.7.2015.02.18.08.12.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Feb 2015 08:12:29 -0800 (PST) From: Linus Walleij To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Grant Likely Cc: Thomas Gleixner , Robert Jarzmik , "David S. Miller" , Linus Walleij Subject: [PATCH] drivers: platform: parse IRQ flags from resources Date: Wed, 18 Feb 2015 17:12:18 +0100 Message-Id: <1424275938-3337-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This fixes a regression from the net subsystem: After commit d52fdbb735c36a209f36a628d40ca9185b349ba7 "smc91x: retrieve IRQ and trigger flags in a modern way" a regression would appear on some legacy platforms such as the ARM PXA Zylonite that specify IRQ resources like this: static struct resource r = { .start = X, .end = X, .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, }; The previous code would retrieve the resource and parse the high edge setting in the SMC91x driver, a use pattern that means every driver specifying an IRQ flag from a static resource need to parse resource flags and apply them at runtime. As we switched the code to use IRQ descriptors to retrieve the the trigger type like this: irqd_get_trigger_type(irq_get_irq_data(...)); the code would work for new platforms using e.g. device tree as the backing irq descriptor would have its flags properly set, whereas this kind of oldstyle static resources at no point assign the trigger flags to the corresponding IRQ descriptor. To make the behaviour identical on modern device tree and legacy static platform data platforms, modify platform_get_irq() to assign the trigger flags to the irq descriptor when a client looks up an IRQ from static resources. Fixes: d52fdbb735c3 ("smc91x: retrieve IRQ and trigger flags in a modern way") Tested-by: Robert Jarzmik Signed-off-by: Linus Walleij --- Greg/Grant: I'm a bit uncertain here. It's kind of unintuitive that the platform_get_irq() function go around setting trigger flags on IRQ descriptors, but it is *also* unintuitive that the descriptor has all the right flags from a device tree but not from an identical static resource. And it is bloated to have resource parsing in each and every driver. The alternative is to revert the offending patch and live with some resource parsing all over the place. (Such a patch is posted.) --- drivers/base/platform.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 9421fed40905..e68ab79df28b 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -101,6 +101,15 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) } r = platform_get_resource(dev, IORESOURCE_IRQ, num); + /* + * The resources may pass trigger flags to the irqs that need + * to be set up. It so happens that the trigger flags for + * IORESOURCE_BITS correspond 1-to-1 to the IRQF_TRIGGER* + * settings. + */ + if (r && r->flags & IORESOURCE_BITS) + irqd_set_trigger_type(irq_get_irq_data(r->start), + r->flags & IORESOURCE_BITS); return r ? r->start : -ENXIO; #endif