Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4587059pxu; Wed, 9 Dec 2020 23:40:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxg95J1Jt9QPaxKX3Y3gxI+TQI0yXeAoHA7gfkwpwnr1HY7iuAJjG8eYLMiYUqtvR7/C47A X-Received: by 2002:a05:6402:202e:: with SMTP id ay14mr5715489edb.102.1607586015972; Wed, 09 Dec 2020 23:40:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607586015; cv=none; d=google.com; s=arc-20160816; b=EJwgKQILGbvVfHSGMnlDirGiHltScXnANztVOkEq84y8P8kclO8qe6a4HCbSzVjAoe Eg4gU5SgJ+PKqAlXz8NxCV3xgnfIElP5QuyGmSVWdjfCNLD0Q9koMm0DsmBPxg7CrDmO rTz4hyqB+SPV1f2uyI+z7N1Z5X1K6kWr51gzcZUSuJLNN5E7x/0S3rPSO4qerIyFPWqr RTsXFBk80/WYpYyOOdkPi+Z4gkh3m04V9GP5GZXc3ok2gH4IvODUvNufdX6uE74e8LJb ljqrgBm2CVkZIub4s4bLVtR+bznpha/9NS0b5Uih3xWq8cybrYsQBErPJl6nrigmPFZ2 KVZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=Z3dG2KIyjU1f9iKIadNhTewGPN82jUMqb/cgH621Dzw=; b=hTX6N2uAcbtKydVvq5uimt4eLyjnFu8zmqpD8nZwfYdStaWwHCxWvCcYfA9EDkuBjf 8NlHBYq1BvByjJz7Y4A2SY9z7hNkd1pdCnrEhji2hTAkGWK1ZEM5VvEJiXdInztcGOw1 eVBCe2oNVFMYhKeY5Zk7zxJSHsJwQfcbaER/qvjHkKW8J7OLUhN+Ud/9hEvu4e4inq/9 4xxGFvZPAVkAArvD/TfC/NqoyGGG2HS4p+FJOc2MGQORk/mnG5c80CcCQR4xT1eIfVrw rdfDNF/vywoOtRG+8RiuOA/O1Hya7pMQE32IWXePmQmjkuiwvMDMD7OzBOt9MCzdOAPu XXnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lt15si2038960ejb.499.2020.12.09.23.39.53; Wed, 09 Dec 2020 23:40:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387639AbgLJGwc (ORCPT + 99 others); Thu, 10 Dec 2020 01:52:32 -0500 Received: from twspam01.aspeedtech.com ([211.20.114.71]:41498 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729009AbgLJGwc (ORCPT ); Thu, 10 Dec 2020 01:52:32 -0500 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 0BA6lCla046149; Thu, 10 Dec 2020 14:47:12 +0800 (GMT-8) (envelope-from troy_lee@aspeedtech.com) Received: from TroyLee-PC.localdomain (192.168.100.253) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 10 Dec 2020 14:50:07 +0800 From: Troy Lee To: , Linus Walleij , Bartosz Golaszewski , Joel Stanley , Andrew Jeffery , "open list:GPIO SUBSYSTEM" , "moderated list:ARM/ASPEED MACHINE SUPPORT" , "moderated list:ARM/ASPEED MACHINE SUPPORT" , open list CC: , , , Subject: [PATCH] gpio: aspeed: Lock GPIO pin used as IRQ Date: Thu, 10 Dec 2020 14:50:13 +0800 Message-ID: <20201210065013.29348-1-troy_lee@aspeedtech.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.100.253] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 0BA6lCla046149 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org GPIO pins can be used as IRQ indicators. When they do, those pins should be flaged with locks to avoid kernel warning message. Signed-off-by: Chia-Wei, Wang Signed-off-by: Troy Lee --- drivers/gpio/gpio-aspeed.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index b966f5e28ebf..f5b3e1d89fbf 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c @@ -651,6 +651,13 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type) aspeed_gpio_copro_release(gpio, offset); spin_unlock_irqrestore(&gpio->lock, flags); + rc = gpiochip_lock_as_irq(&gpio->chip, d->hwirq); + if (rc) { + dev_err(gpio->chip.parent, "unable to lock GPIO %lu as IRQ\n", + d->hwirq); + return rc; + } + irq_set_handler_locked(d, handler); return 0; -- 2.17.1