From patchwork Thu Mar 9 16:21:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Cartwright X-Patchwork-Id: 737090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3vfJKV160Bz9s03 for ; Fri, 10 Mar 2017 05:08:14 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932366AbdCISIN (ORCPT ); Thu, 9 Mar 2017 13:08:13 -0500 Received: from mx0a-00010702.pphosted.com ([148.163.156.75]:42261 "EHLO mx0b-00010702.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754526AbdCISIM (ORCPT ); Thu, 9 Mar 2017 13:08:12 -0500 Received: from pps.filterd (m0098780.ppops.net [127.0.0.1]) by mx0a-00010702.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v29GKxxc022544; Thu, 9 Mar 2017 10:22:11 -0600 Received: from ni.com (skprod3.natinst.com [130.164.80.24]) by mx0a-00010702.pphosted.com with ESMTP id 2933r6sp8p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Mar 2017 10:22:11 -0600 Received: from us-aus-exch1.ni.corp.natinst.com (us-aus-exch1.ni.corp.natinst.com [130.164.68.11]) by us-aus-skprod3.natinst.com (8.16.0.17/8.16.0.17) with ESMTPS id v29GMAgd008847 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 9 Mar 2017 10:22:10 -0600 Received: from us-aus-exch3.ni.corp.natinst.com (130.164.68.13) by us-aus-exch1.ni.corp.natinst.com (130.164.68.11) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Thu, 9 Mar 2017 10:22:10 -0600 Received: from us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) by us-aus-exch3.ni.corp.natinst.com (130.164.68.13) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Thu, 9 Mar 2017 10:22:10 -0600 Received: from jcartwri.amer.corp.natinst.com (130.164.49.7) by us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) with Microsoft SMTP Server id 15.0.1156.6 via Frontend Transport; Thu, 9 Mar 2017 10:22:10 -0600 Received: by jcartwri.amer.corp.natinst.com (Postfix, from userid 1000) id 04FCD30111D; Thu, 9 Mar 2017 10:22:10 -0600 (CST) From: Julia Cartwright To: Linus Walleij , Alexandre Courbot CC: , Thomas Gleixner , Subject: [PATCH 08/19] gpio: etraxfs: make use of raw_spinlock variants Date: Thu, 9 Mar 2017 10:21:55 -0600 Message-ID: X-Mailer: git-send-email 2.11.1 In-Reply-To: References: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-09_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703090122 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-09_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=30 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=30 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703090122 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The etraxfs gpio driver currently implements an irq_chip for handling interrupts; due to how irq_chip handling is done, it's necessary for the irq_chip methods to be invoked from hardirq context, even on a a real-time kernel. Because the spinlock_t type becomes a "sleeping" spinlock w/ RT kernels, it is not suitable to be used with irq_chips. A quick audit of the operations under the lock reveal that they do only minimal, bounded work, and are therefore safe to do under a raw spinlock. Signed-off-by: Julia Cartwright --- drivers/gpio/gpio-etraxfs.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gpio/gpio-etraxfs.c b/drivers/gpio/gpio-etraxfs.c index a254d5b07b94..14c6aac26780 100644 --- a/drivers/gpio/gpio-etraxfs.c +++ b/drivers/gpio/gpio-etraxfs.c @@ -54,7 +54,7 @@ struct etraxfs_gpio_info; struct etraxfs_gpio_block { - spinlock_t lock; + raw_spinlock_t lock; u32 mask; u32 cfg; u32 pins; @@ -233,10 +233,10 @@ static void etraxfs_gpio_irq_mask(struct irq_data *d) struct etraxfs_gpio_block *block = chip->block; unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq); - spin_lock(&block->lock); + raw_spin_lock(&block->lock); block->mask &= ~BIT(grpirq); writel(block->mask, block->regs + block->info->rw_intr_mask); - spin_unlock(&block->lock); + raw_spin_unlock(&block->lock); } static void etraxfs_gpio_irq_unmask(struct irq_data *d) @@ -246,10 +246,10 @@ static void etraxfs_gpio_irq_unmask(struct irq_data *d) struct etraxfs_gpio_block *block = chip->block; unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq); - spin_lock(&block->lock); + raw_spin_lock(&block->lock); block->mask |= BIT(grpirq); writel(block->mask, block->regs + block->info->rw_intr_mask); - spin_unlock(&block->lock); + raw_spin_unlock(&block->lock); } static int etraxfs_gpio_irq_set_type(struct irq_data *d, u32 type) @@ -280,11 +280,11 @@ static int etraxfs_gpio_irq_set_type(struct irq_data *d, u32 type) return -EINVAL; } - spin_lock(&block->lock); + raw_spin_lock(&block->lock); block->cfg &= ~(0x7 << (grpirq * 3)); block->cfg |= (cfg << (grpirq * 3)); writel(block->cfg, block->regs + block->info->rw_intr_cfg); - spin_unlock(&block->lock); + raw_spin_unlock(&block->lock); return 0; } @@ -297,7 +297,7 @@ static int etraxfs_gpio_irq_request_resources(struct irq_data *d) unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq); int ret = -EBUSY; - spin_lock(&block->lock); + raw_spin_lock(&block->lock); if (block->group[grpirq]) goto out; @@ -316,7 +316,7 @@ static int etraxfs_gpio_irq_request_resources(struct irq_data *d) } out: - spin_unlock(&block->lock); + raw_spin_unlock(&block->lock); return ret; } @@ -327,10 +327,10 @@ static void etraxfs_gpio_irq_release_resources(struct irq_data *d) struct etraxfs_gpio_block *block = chip->block; unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq); - spin_lock(&block->lock); + raw_spin_lock(&block->lock); block->group[grpirq] = 0; gpiochip_unlock_as_irq(&chip->gc, d->hwirq); - spin_unlock(&block->lock); + raw_spin_unlock(&block->lock); } static struct irq_chip etraxfs_gpio_irq_chip = { @@ -391,7 +391,7 @@ static int etraxfs_gpio_probe(struct platform_device *pdev) if (!block) return -ENOMEM; - spin_lock_init(&block->lock); + raw_spin_lock_init(&block->lock); block->regs = regs; block->info = info;