From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751534AbdJWXGt (ORCPT ); Mon, 23 Oct 2017 19:06:49 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:53160 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751290AbdJWXGo (ORCPT ); Mon, 23 Oct 2017 19:06:44 -0400 X-Google-Smtp-Source: ABhQp+SNCHqOCdZwD09AFZzLJ2024AkhHOoi9dT0g/2Pd5sSE9qsbrOI9P363WPnwOSu9F+qoR8wrQ== Subject: Re: [PATCH 7/7] gpio: brcmstb: implement suspend/resume/shutdown To: Gregory Fong Cc: Linus Walleij , Brian Norris , Florian Fainelli , bcm-kernel-feedback-list , linux-gpio@vger.kernel.org, "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" References: <20170930034057.15166-1-opendmb@gmail.com> <20170930034057.15166-8-opendmb@gmail.com> <20171019090359.GB31645@kessel> From: Doug Berger Message-ID: Date: Mon, 23 Oct 2017 16:06:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/20/2017 05:54 PM, Gregory Fong wrote: > On Thu, Oct 19, 2017 at 11:39 AM, Doug Berger wrote: >>>> +static int brcmstb_gpio_resume(struct device *dev) >>>> +{ >>>> + struct brcmstb_gpio_priv *priv = dev_get_drvdata(dev); >>>> + struct brcmstb_gpio_bank *bank; >>>> + u32 wake_mask = 0; >>> >>> This isn't really being used as a mask, contrary to appearances. It's >>> just tracking whether any active IRQs were seen. Please change to use a >>> bool instead and adjust the name accordingly. >>> >> >> I see your point, but I believe it is cleaner to use this to consolidate >> the bit masks returned by each __brcmstb_gpio_get_active_irqs() call. >> This allows a single test rather than a test per bank. > > What about something like this? > > bool need_wakeup_event = false; > > list_for_each_entry(bank, &priv->bank_list, node) { > need_wakeup_event |= !!__brcmstb_gpio_get_active_irqs(bank); > brcmstb_gpio_bank_restore(priv, bank); > } > > if (priv->parent_wake_irq && need_wakeup_event) > pm_wakeup_event(dev, 0); > It's less efficient, but it is not performance sensitive so if you feel this is more understandable I'll make the change. Thanks, Doug