From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34701C6FA89 for ; Mon, 5 Sep 2022 11:55:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237309AbiIELzH (ORCPT ); Mon, 5 Sep 2022 07:55:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237882AbiIELzG (ORCPT ); Mon, 5 Sep 2022 07:55:06 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F0211A81C for ; Mon, 5 Sep 2022 04:55:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=tMfQDlYvzFyFrUvYU5MebTEg/joFiQu8bqTpr1XujAw=; b=04vYN5g0hl4+pGbqsYuRhl/Mp4 HBpYa+AHyQSSe+1ZoHG7g33gNm33rMi/lJcLzNdLmz7Q6nmgP9kaTOSoGBQWvKZ0tAluvSRGskeAE 6D5+NbBkqEj9tEqNQlocq8J7lzNuY7lLv3dRVfCqOhAaJyor2i72wEvnkFrLC5NWKYHgiX9GUKKpD F6cGUeg7+Zg7g2WDqu9rq8KDo2Dgu4PjeW1fhnFCVa4fmTQg8fLixzXknMTUNEmh2Xr5mun2Jswws PGjLGDYjXAyo3Hqa4a+ebXPgL+7OhCu24UhdCbhHmfKKdc1fIHl4FFBjVJkn0vHvsCp8hYKZ4VQja 35sY2EGQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34104) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oVAgn-0002IC-5O; Mon, 05 Sep 2022 12:54:53 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1oVAgk-0007Fm-IG; Mon, 05 Sep 2022 12:54:50 +0100 Date: Mon, 5 Sep 2022 12:54:50 +0100 From: "Russell King (Oracle)" To: Andy Shevchenko Cc: Arnd Bergmann , Lee Jones , Linus Walleij , Alyssa Rosenzweig , asahi@lists.linux.dev, Bartosz Golaszewski , Hector Martin , linux-arm Mailing List , "open list:GPIO SUBSYSTEM" , Sven Peter Subject: Re: [PATCH 6/6] gpio: macsmc: Add IRQ support Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Thu, Sep 01, 2022 at 09:03:49PM +0300, Andy Shevchenko wrote: > On Thu, Sep 1, 2022 at 5:18 PM Russell King wrote: > > From: Hector Martin > > > > Add IRQ support to the macsmc driver. This patch has updates from Joey > > Gouly and Russell King. > > ... > > > + u16 type = event >> 16; > > + u8 offset = (event >> 8) & 0xff; > > The ' & 0xff' part is redundant. It's probably also more logical to call this "hwirq". > > +static int macsmc_gpio_irq_set_type(struct irq_data *d, unsigned int type) > > +{ > > + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); > > + struct macsmc_gpio *smcgp = gpiochip_get_data(gc); ... > > + if (!test_bit(offset, smcgp->irq_supported)) > > + return -EINVAL; > > We have a valid mask for IRQs. Can it be used here instead? Looks like we can, thanks for the suggestion. > > + smcgp->irq_mode_shadow[offset] = mode; > > Usually we want to have handle_bad_irq() handler by default and in > ->set_type() we lock a handler depending on the flags. Why is this not > the case in this driver? "lock a handler" ? I guess you mean select a handler. I don't see a reason why we couldn't switch between handle_bad_irq() and handle_simple_irq(). I would guess (I don't know the implementation details of the Apple platform) that the SMC forwards a message when the IRQ happens, but I'm guessing that this is well tested on the platform with the simple flow handler. Changing it to something else would need discussion with the Asahi Linux folk. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!