From patchwork Sun May 17 01:05:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 48625 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4606121411 for ; Sun, 17 May 2015 01:15:33 +0000 (UTC) Received: by lagr1 with SMTP id r1sf25777440lag.3 for ; Sat, 16 May 2015 18:15:32 -0700 (PDT) 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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=yuPbqnjjgj66dnV4KCcsShSe1syKY3dlFzNSf4HOinI=; b=mA1ft92fDX522zTpqotH7vdo3OYOZlR0irv5r8P8uVjyYpD/feuWizIh7JNnMIqRdM UwNQ6FL45GKBIqZ4wvLEBoAOEkC3PnuEQREEOIAnSbd8XyR9BBvXUUT73aUuRkUPrZ2z kQZrQljOjLHkzK+w4n25KJ4pDBZdgq5/s0Vfaku88spSFAy0PQNFsUKXqwE4LTsBVcIE aWJwsVnjWjaiSKnaQuh4x1exIQ95doHS7RYMlRLZWsZ0cVCaVkLt8Y/e+QOvBflOyHg9 93Ht8LGBKm/P9kuO7VTMJVMBAewE+9N5Vy1yGW+yTc2ZC2FwbY3FToQ6IDkrv86YtbPJ +agQ== X-Gm-Message-State: ALoCoQkEpnV1nlxqfhk9TGRpJiPevP7Zv0dOsaBldF39HWeSfCiBGVLbk7jvUckTAfqjRVHYncij X-Received: by 10.112.160.197 with SMTP id xm5mr12505706lbb.15.1431825332303; Sat, 16 May 2015 18:15:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.104 with SMTP id j8ls535200laj.106.gmail; Sat, 16 May 2015 18:15:32 -0700 (PDT) X-Received: by 10.152.27.74 with SMTP id r10mr12611668lag.31.1431825332117; Sat, 16 May 2015 18:15:32 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id an10si3896956lac.169.2015.05.16.18.15.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 May 2015 18:15:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lagv1 with SMTP id v1so172783389lag.3 for ; Sat, 16 May 2015 18:15:32 -0700 (PDT) X-Received: by 10.152.2.227 with SMTP id 3mr12367190lax.73.1431825332010; Sat, 16 May 2015 18:15:32 -0700 (PDT) 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.108.230 with SMTP id hn6csp3025280lbb; Sat, 16 May 2015 18:15:31 -0700 (PDT) X-Received: by 10.70.63.1 with SMTP id c1mr31726213pds.90.1431824956152; Sat, 16 May 2015 18:09:16 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h13si9275368pdm.194.2015.05.16.18.09.14; Sat, 16 May 2015 18:09:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752375AbbEQBJI (ORCPT + 2 others); Sat, 16 May 2015 21:09:08 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:26462 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752344AbbEQBJG (ORCPT ); Sat, 16 May 2015 21:09:06 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t4H195NB030287 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 17 May 2015 01:09:06 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t4H1957g006639 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sun, 17 May 2015 01:09:05 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t4H194oA008544; Sun, 17 May 2015 01:09:05 GMT Received: from lappy.hsd1.nh.comcast.net (/10.159.157.103) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 16 May 2015 18:09:04 -0700 From: Sasha Levin To: stable@vger.kernel.org, stable-commits@vger.kernel.org Cc: sasha.levin@oracle.com Subject: [PATCH 3.18 169/222] drivers: platform: parse IRQ flags from resources Date: Sat, 16 May 2015 21:05:10 -0400 Message-Id: <1431824764-20044-170-git-send-email-sasha.levin@oracle.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1431824764-20044-1-git-send-email-sasha.levin@oracle.com> References: <1431824764-20044-1-git-send-email-sasha.levin@oracle.com> X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@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.215.44 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: , From: Linus Walleij [ Upstream commit 7085a7401ba54e92bbb5aa24d6f428071e18e509 ] 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/base/platform.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index b2afc29..360272c 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