Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp998315iob; Fri, 13 May 2022 19:06:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSvwzu0mSjAuwx6JxVv/ZFHQVvmFdHbcjsAmjCtIpwPrjoKYB0/YSujU1S+zYlh7qaTtDq X-Received: by 2002:a05:6000:184d:b0:20c:5a30:1e48 with SMTP id c13-20020a056000184d00b0020c5a301e48mr6024857wri.614.1652493983212; Fri, 13 May 2022 19:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652493983; cv=none; d=google.com; s=arc-20160816; b=Wyy7QJFS6MkgTWgi/p0iq64a6GDfM8ZguAGERzdGs3YEJDixDVa2u3PU8shBNHAEsZ liKT25/XfxQKtCx5RcJ8IP3lW4+Rdy36vKNBIrECrcXDQuiHenVnU1UdRPGu17fJYMgi 1OZXqy0ZvmP19y+qM8PDH8MWewuQPOmuMJoEt5yJw35RTq4YaI+A0gRvDJsSKsTcLtbE UBv+Dmeiu+1kq00K0qDraW9IBVIPxberudn7us0lS3yIr1sMQX0jwA5k2EV3F4D7yVew gk3Jq2UbXVugkFqykLEgwNvdVJXEQ45e9pcXksTJR64s+toxBJ5TM+ANeB/FvMR/GQi4 wAXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=v/jVhC2qOS3Bt4Wjqc2L1ovt7o3ZpJ/uT+APwBUkTnk=; b=A48xAgCrF4QloiQiV6I62gsjdNmk5Or9sCJVWK2ytK6qMMt8U1Y6WkJjzV9TGLtrTC tdguY2Qy0HzoGDVhhuw4plHDAjnjn4cqp+buN4tULACr5CCEJGdNPOcuRXFcm+itYhjR EPdYrPwv0Z9mb1XlTEJimTkUYlY3tvL/8vt1o7WBR9uJOGn+EXbUYGcg86/lfiigWvC5 zBj6WPC4bGg6ptPybQ+C8VwQiUIKo4DwtVm5TFO5JMp0SwUpH43HYJaEck5Pk+6k7tC8 Pw+x0Z8FmD4IKeRUYwVr8m7dQTVtgEavJoGzkQM8RcKIWGNH38FAjXlvK9rWmyLrCTvS cU1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Z0xXA5C3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t16-20020a5d5350000000b002060b2c217fsi3175491wrv.24.2022.05.13.19.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 19:06:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Z0xXA5C3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ED4F7488818; Fri, 13 May 2022 17:26:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357177AbiELRmD (ORCPT + 99 others); Thu, 12 May 2022 13:42:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357183AbiELRl5 (ORCPT ); Thu, 12 May 2022 13:41:57 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BD2E60BAB; Thu, 12 May 2022 10:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652377315; x=1683913315; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZJ1onh2Zr7lWF0ZhgH2Zhxb8WH3RUU0eJg8bTS9xfQg=; b=Z0xXA5C3z34Lv+yU8ibYWBBBRG0AKvZUAActEIVby6AXVjQ1fbToYRix UPNfgw3vkRHySAF/v5MEVhjz1dzEkoEvvSh3Swgrm38qoKlWRdIutnJZv NpKFzNd4KmK757U8k446xdtrGsGMiZPwKzos1FggpJbXPxUq4/58Trlws ldosR7vUB86qzD2D4FppIs3kum1fFU0P6SYkVaUVLR+6Vil8kgFi4bKw5 tTyV+ck/8cXWJibq7gLU08MWqCGRhvux8MPRUw/sfpEGi7unifcw4s/Rb FSQRi8BhUt+vbaUngbqfrfo5vSDqQwDFzWmv2vLkF/oJ/BUvS12XH4Zye w==; X-IronPort-AV: E=McAfee;i="6400,9594,10345"; a="270026663" X-IronPort-AV: E=Sophos;i="5.91,220,1647327600"; d="scan'208";a="270026663" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2022 10:39:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,220,1647327600"; d="scan'208";a="712025245" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 May 2022 10:39:34 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4609A45; Thu, 12 May 2022 20:39:33 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Marc Zyngier , Hans de Goede , linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Mika Westerberg , Andy Shevchenko Subject: [PATCH v1 2/5] Documentation: gpio: Advertise irqd_to_hwirq() helper in the examples Date: Thu, 12 May 2022 20:39:18 +0300 Message-Id: <20220512173921.8210-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220512173921.8210-1-andriy.shevchenko@linux.intel.com> References: <20220512173921.8210-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of direct dereferencing the IRQ data in order to get HW IRQ number use the irqd_to_hwirq() helper. Fixes: 5644b66a9c63 ("Documentation: Update the recommended pattern for GPIO irqchips") Signed-off-by: Andy Shevchenko --- Documentation/driver-api/gpio/driver.rst | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Documentation/driver-api/gpio/driver.rst b/Documentation/driver-api/gpio/driver.rst index 964d09118d17..70ff43ac4fcc 100644 --- a/Documentation/driver-api/gpio/driver.rst +++ b/Documentation/driver-api/gpio/driver.rst @@ -430,6 +430,7 @@ call into the core gpiolib code: static void my_gpio_mask_irq(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + irq_hw_number_t hwirq = irqd_to_hwirq(d); /* * Perform any necessary action to mask the interrupt, @@ -437,14 +438,15 @@ call into the core gpiolib code: * state. */ - gpiochip_disable_irq(gc, d->hwirq); + gpiochip_disable_irq(gc, hwirq); } static void my_gpio_unmask_irq(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + irq_hw_number_t hwirq = irqd_to_hwirq(d); - gpiochip_enable_irq(gc, d->hwirq); + gpiochip_enable_irq(gc, hwirq); /* * Perform any necessary action to unmask the interrupt, @@ -502,6 +504,7 @@ the interrupt separately and go with it: static void my_gpio_mask_irq(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + irq_hw_number_t hwirq = irqd_to_hwirq(d); /* * Perform any necessary action to mask the interrupt, @@ -509,14 +512,15 @@ the interrupt separately and go with it: * state. */ - gpiochip_disable_irq(gc, d->hwirq); + gpiochip_disable_irq(gc, hwirq); } static void my_gpio_unmask_irq(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + irq_hw_number_t hwirq = irqd_to_hwirq(d); - gpiochip_enable_irq(gc, d->hwirq); + gpiochip_enable_irq(gc, hwirq); /* * Perform any necessary action to unmask the interrupt, @@ -577,6 +581,7 @@ In this case the typical set-up will look like this: static void my_gpio_mask_irq(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + irq_hw_number_t hwirq = irqd_to_hwirq(d); /* * Perform any necessary action to mask the interrupt, @@ -584,15 +589,16 @@ In this case the typical set-up will look like this: * state. */ - gpiochip_disable_irq(gc, d->hwirq); + gpiochip_disable_irq(gc, hwirq); irq_mask_mask_parent(d); } static void my_gpio_unmask_irq(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + irq_hw_number_t hwirq = irqd_to_hwirq(d); - gpiochip_enable_irq(gc, d->hwirq); + gpiochip_enable_irq(gc, hwirq); /* * Perform any necessary action to unmask the interrupt, -- 2.35.1