From patchwork Tue Nov 18 07:31:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 41004 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5DF87241C9 for ; Tue, 18 Nov 2014 07:33:57 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id y19sf2027755wgg.7 for ; Mon, 17 Nov 2014 23:33:56 -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: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=HlbKP49NlpQpQhxhpkY/jm7BqpL3rlFiBPqSgL6TTJw=; b=fLpVAMv8TOC9WacyTXwEj2Y49BZF5g7I0AVYJVuZ2EDj0hTW23DB2MLU/IFjV6x8+e 3FmgaW5Bwiu7ZtlrIWkBdEYeFORbL0aOCxH30HB4uUuwR6o8TLOV79WXRDUS7tEvUvkq ur3BQyIi3FYyuJ2Zu67ipcLY5yiAVQZbxDXIAVqEDnj1vE2CngdpSbKIoPsnjKW0Qp6Z 1l5HmYFyqnGoVyZ3GyBTIbwNJ6EZ7owdWPhCoHjywh+EtOQ9KSMqx/aSbDm0M5JaPPRM 577lNkxpHMQc/yuVcALQUrVaJaZcj3w1YCimq7+iYZjlpXLCv1N9JttWZGHWDKgX5gZL TtAA== X-Gm-Message-State: ALoCoQnDDy4zhkbROIlHCbgjJPwwS8Um/6PDJI0mUrfp3b+0XCD03Py1SRHkk52zUg1C/r2lHaS8 X-Received: by 10.180.82.34 with SMTP id f2mr4335813wiy.1.1416296036607; Mon, 17 Nov 2014 23:33:56 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.72 with SMTP id b8ls1023724laf.2.gmail; Mon, 17 Nov 2014 23:33:56 -0800 (PST) X-Received: by 10.112.157.194 with SMTP id wo2mr33716002lbb.55.1416296036297; Mon, 17 Nov 2014 23:33:56 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id cz5si42764674lac.123.2014.11.17.23.33.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Nov 2014 23:33:56 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id mc6so2420260lab.10 for ; Mon, 17 Nov 2014 23:33:56 -0800 (PST) X-Received: by 10.152.42.226 with SMTP id r2mr33762786lal.29.1416296036192; Mon, 17 Nov 2014 23:33:56 -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.184.201 with SMTP id ew9csp1287259lbc; Mon, 17 Nov 2014 23:33:55 -0800 (PST) X-Received: by 10.68.201.201 with SMTP id kc9mr8876995pbc.149.1416296034508; Mon, 17 Nov 2014 23:33:54 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bi2si37289961pbb.68.2014.11.17.23.33.53 for ; Mon, 17 Nov 2014 23:33:54 -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 S1753764AbaKRHdw (ORCPT + 26 others); Tue, 18 Nov 2014 02:33:52 -0500 Received: from mail-ie0-f173.google.com ([209.85.223.173]:54131 "EHLO mail-ie0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753370AbaKRHdD (ORCPT ); Tue, 18 Nov 2014 02:33:03 -0500 Received: by mail-ie0-f173.google.com with SMTP id y20so6637494ier.4 for ; Mon, 17 Nov 2014 23:33:03 -0800 (PST) X-Received: by 10.43.89.8 with SMTP id bc8mr32249217icc.35.1416295983009; Mon, 17 Nov 2014 23:33:03 -0800 (PST) Received: from localhost.localdomain (c-24-8-37-141.hsd1.co.comcast.net. [24.8.37.141]) by mx.google.com with ESMTPSA id w197sm20175215iod.24.2014.11.17.23.33.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Nov 2014 23:33:02 -0800 (PST) From: Lina Iyer To: khilman@linaro.org, ulf.hansson@linaro.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rjw@rjwysocki.net, daniel.lezcano@linaro.org Cc: Lina Iyer Subject: [PATCH v4/RFC 3/4] irq: Add irq_get_affinity() api Date: Tue, 18 Nov 2014 00:31:49 -0700 Message-Id: <1416295910-40433-4-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1416295910-40433-1-git-send-email-lina.iyer@linaro.org> References: <1416295910-40433-1-git-send-email-lina.iyer@linaro.org> 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: lina.iyer@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.51 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: , Export irq_get_affinity API for drivers to read the smp affinity of an IRQ safely. Signed-off-by: Lina Iyer --- include/linux/interrupt.h | 8 ++++++++ kernel/irq/manage.c | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 69517a2..fff619c 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -260,6 +260,8 @@ extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); extern int irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); +extern int irq_get_affinity(unsigned int irq, struct cpumask *mask); + #else /* CONFIG_SMP */ static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) @@ -290,6 +292,12 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify) { return 0; } + +static inline int irq_get_affinity(unsigned int irq, struct cpumask *mask) +{ + return -EINVAL; +} + #endif /* CONFIG_SMP */ /* diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 0a9104b..2d17098 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -246,6 +246,24 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) } EXPORT_SYMBOL_GPL(irq_set_affinity_hint); +int irq_get_affinity(unsigned int irq, struct cpumask *mask) +{ + struct irq_desc *desc = irq_to_desc(irq); + unsigned long flags; + + if (!mask) + return -EINVAL; + + raw_spin_lock_irqsave(&desc->lock, flags); + if (!irqd_irq_disabled(&desc->irq_data)) + cpumask_copy(mask, desc->irq_data.affinity); + else + cpumask_clear(mask); + raw_spin_unlock_irqrestore(&desc->lock, flags); + + return 0; +} + static void irq_affinity_notify(struct work_struct *work) { struct irq_affinity_notify *notify =