From patchwork Thu Aug 18 16:28:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 598632 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 F2FF8C28B2B for ; Thu, 18 Aug 2022 23:12:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344225AbiHRXMA (ORCPT ); Thu, 18 Aug 2022 19:12:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343761AbiHRXL7 (ORCPT ); Thu, 18 Aug 2022 19:11:59 -0400 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2D49D0208 for ; Thu, 18 Aug 2022 16:11:58 -0700 (PDT) Received: by mail-qt1-x829.google.com with SMTP id w28so2276223qtc.7 for ; Thu, 18 Aug 2022 16:11:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=NYDLKo9VjEVmmw3ciPy+owZbBQznl3Q/RXFdBzD0ta4=; b=Mn2nHlHwebOuqtqWJpQEM0eLdRx1X5n0Oj6DELJoBbyP6zCV6jKp5+xhe5BeBfcfSJ xlu+pzmIJ4Kq+qQkRowXqd5ynABdoSWPUxGwnetgqiFAI0VT8oY8G00/5NS+a/ULSt66 s61bLaxXJ8nxFv7VJhNN0mumElJ34b72q4/7ZY4r3wh0+8BUR+bb2tjsLUXRR12UE3DJ gcQe4ExCtVr33Bzkxkwwxc0Q3/2LdOMsd/dcE3qDi7czaZMvhz4kXTk2vfhvSXVTs9IF 2rLzNkE8UkUnpK8Z9oLPAcuuq3xlY4FYweDbQ0tA4XDkfVGYFK77df8GpE0eXLn07lWd YZXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=NYDLKo9VjEVmmw3ciPy+owZbBQznl3Q/RXFdBzD0ta4=; b=qCVY6NwtUvKfftaZMqEQHNmgD8AD2EUOqAVguWQL+hQ4CTGgkN0HkKWvjIHyykxxU6 wW1UBAff2hyM1NzV1Upz15IPi7wgc/wmemmxCwtFF+jdqp3IkrdMR/OyY33w3B4HUNtZ ytVs48YxmmEIx0txztIIQrqPAj7PLK27dQJlbJubtQRvQePMHeqJh2p6J7P9e5HwJcaf Y41Mu08O6r0WGeb+ty02L7cFowmCwcRrgvaPFVfQJXIZB4cV3DtwI4CKajHQRqL8QNMn UunbFhd82vTZySQb8M9JmwJ9Ph2Xv/+MHxBiCBKhmVIDFQKDvVqlWb2MC9APpGwoRC1P ja8A== X-Gm-Message-State: ACgBeo2UnZVJgSINnMpw0KQop34Ebznsef9BX0G3rRHACLrqHEnpbv88 WZRXhi6x15ypTG8DcrOCjYgSJw== X-Google-Smtp-Source: AA6agR7IwQrFD/YiqELu65gG3fpqxSghUbpo4vjRtdaGEPnTe5chpuWAXj/MLPNSDLl+mj7UZVXqEw== X-Received: by 2002:ac8:5f10:0:b0:343:7a81:e89b with SMTP id x16-20020ac85f10000000b003437a81e89bmr4511261qta.527.1660864317820; Thu, 18 Aug 2022 16:11:57 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id h16-20020a05620a245000b006b5f06186aesm2864801qkn.65.2022.08.18.16.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 16:11:57 -0700 (PDT) From: William Breathitt Gray To: linux-iio@vger.kernel.or, linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linus.walleij@linaro.org, brgl@bgdev.pl, William Breathitt Gray Subject: [PATCH 1/6] isa: Introduce the module_isa_driver_with_irq helper macro Date: Thu, 18 Aug 2022 12:28:10 -0400 Message-Id: <016c8d87cef87a1375e53f1c97c41d8b969f8d79.1660839809.git.william.gray@linaro.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Several ISA drivers feature IRQ support that can configured via an "irq" array module parameter. This array typically matches directly with the respective "base" array module parameter. To reduce code repetition, a module_isa_driver_with_irq helper macro is introduced to provide a check ensuring that the number of "irq" passed to the module matches with the respective number of "base". Signed-off-by: William Breathitt Gray Acked-by: William Breathitt Gray --- include/linux/isa.h | 52 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/include/linux/isa.h b/include/linux/isa.h index e30963190968..4fbbf5e36e08 100644 --- a/include/linux/isa.h +++ b/include/linux/isa.h @@ -38,6 +38,32 @@ static inline void isa_unregister_driver(struct isa_driver *d) } #endif +#define module_isa_driver_init(__isa_driver, __num_isa_dev) \ +static int __init __isa_driver##_init(void) \ +{ \ + return isa_register_driver(&(__isa_driver), __num_isa_dev); \ +} \ +module_init(__isa_driver##_init) + +#define module_isa_driver_with_irq_init(__isa_driver, __num_isa_dev, __num_irq) \ +static int __init __isa_driver##_init(void) \ +{ \ + if (__num_irq != __num_isa_dev) { \ + pr_err("%s: Number of irq (%u) does not match number of base (%u)\n", \ + __isa_driver.driver.name, __num_irq, __num_isa_dev); \ + return -EINVAL; \ + } \ + return isa_register_driver(&(__isa_driver), __num_isa_dev); \ +} \ +module_init(__isa_driver##_init) + +#define module_isa_driver_exit(__isa_driver) \ +static void __exit __isa_driver##_exit(void) \ +{ \ + isa_unregister_driver(&(__isa_driver)); \ +} \ +module_exit(__isa_driver##_exit) + /** * module_isa_driver() - Helper macro for registering a ISA driver * @__isa_driver: isa_driver struct @@ -48,16 +74,22 @@ static inline void isa_unregister_driver(struct isa_driver *d) * use this macro once, and calling it replaces module_init and module_exit. */ #define module_isa_driver(__isa_driver, __num_isa_dev) \ -static int __init __isa_driver##_init(void) \ -{ \ - return isa_register_driver(&(__isa_driver), __num_isa_dev); \ -} \ -module_init(__isa_driver##_init); \ -static void __exit __isa_driver##_exit(void) \ -{ \ - isa_unregister_driver(&(__isa_driver)); \ -} \ -module_exit(__isa_driver##_exit); +module_isa_driver_init(__isa_driver, __num_isa_dev); \ +module_isa_driver_exit(__isa_driver) + +/** + * module_isa_driver_with_irq() - Helper macro for registering an ISA driver with irq + * @__isa_driver: isa_driver struct + * @__num_isa_dev: number of devices to register + * @__num_irq: number of IRQ to register + * + * Helper macro for ISA drivers with irq that do not do anything special in + * module init/exit. Each module may only use this macro once, and calling it + * replaces module_init and module_exit. + */ +#define module_isa_driver_with_irq(__isa_driver, __num_isa_dev, __num_irq) \ +module_isa_driver_with_irq_init(__isa_driver, __num_isa_dev, __num_irq); \ +module_isa_driver_exit(__isa_driver) /** * max_num_isa_dev() - Maximum possible number registered of an ISA device From patchwork Thu Aug 18 16:28:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 598298 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 47F40C25B0E for ; Thu, 18 Aug 2022 23:12:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343761AbiHRXMA (ORCPT ); Thu, 18 Aug 2022 19:12:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344032AbiHRXL7 (ORCPT ); Thu, 18 Aug 2022 19:11:59 -0400 Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2255CE4B1 for ; Thu, 18 Aug 2022 16:11:58 -0700 (PDT) Received: by mail-qv1-xf36.google.com with SMTP id p5so734585qvz.6 for ; Thu, 18 Aug 2022 16:11:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=qGjpQWlBEsnLX6GHKgz+4eStCbKQ3L8yDM6zs4RFMHg=; b=Bk4vjTP8uhWl7oL5ebI1LwMJMihXqKivXuNoITMw/0VYMMIbZOCZyqnZixlN8JAN7I 9jpUf1PrHCjAW+ImYiZYS1tP5g7s0UzMXIdkAGq4SBZkikERPJhKuiGBxmXV81ab7BtJ 6BT0LaSG1VylHc3K0aOWPhSSsCkSsoJDVHkPtDuZzjObso7Af5yyk6Gxrn2N9UOPaFnI 7Jl4GvdNVg25DKaSknRaaillyIFdu6Rw25kck3ARY0zHLNzIRiZX12woqQgM2/i5GuzO p3INah8xtH3oKtH+T73Aa5qLdwxfJcJHxeNTwG7qaK53lDe3Sm7rbwJguH1W5nUb91Ep 4RPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=qGjpQWlBEsnLX6GHKgz+4eStCbKQ3L8yDM6zs4RFMHg=; b=iZlTjkBVq6+0s9NoQOLc6IQgkb7xvmelmEK52OPGMEflPiWFRdnGxpVn90ejHK8KCU KjSjOeQfXIH/WX+xk0tclHs7RnAw2Oc4/3lI0ohKcTuqbzNCET0wFSiAyi0jCvF5jmNY Wyj65n6ixvE5Eyl1sGbgu0EsjmVS8d/vH4rP0t55HRDyrB7cW1bJS1UEiZWm995WfPtf kzr8V+d4hU8WnIFUIiEFe+aticgJqO47csG50SxxxS4bXJfPQAyKHbGfSiAOPlVWW0dg D3TZVGebm1lU+BAwxhG4sa7naNxGR3wX19GgVuUh2RkWam6cgxFFfr9wWGLRMR7pjNrt BFyw== X-Gm-Message-State: ACgBeo0mqqf6BO2ZwR5H8bS9kLNGWaXRqZ8DzpfIOqrt0KpTJ4MtKOkH 2vwJG1GDH0iqNDZF4rjFqsa+aQ== X-Google-Smtp-Source: AA6agR4ix7mMLjT/ZIULKRyjTt3rncj/41VSGEAN7cdfBJaZdaGATl63I5/zMoAZ8KysxHmUjDRPGw== X-Received: by 2002:a05:6214:1d0f:b0:496:b99f:3b3c with SMTP id e15-20020a0562141d0f00b00496b99f3b3cmr4193088qvd.113.1660864318612; Thu, 18 Aug 2022 16:11:58 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id h16-20020a05620a245000b006b5f06186aesm2864801qkn.65.2022.08.18.16.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 16:11:58 -0700 (PDT) From: William Breathitt Gray To: linux-iio@vger.kernel.or, linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linus.walleij@linaro.org, brgl@bgdev.pl, William Breathitt Gray Subject: [PATCH 2/6] counter: 104-quad-8: Ensure number of irq matches number of base Date: Thu, 18 Aug 2022 12:28:11 -0400 Message-Id: <9c386d163f765d00c1277c5c5c7436d1c9f6d342.1660839809.git.william.gray@linaro.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The 104-quad-8 module calls devm_request_irq() for each device. If the number of irq passed to the module does not match the number of base, a default value of 0 is passed to devm_request_irq(). IRQ 0 is probably not what the user wants, so utilize the module_isa_driver_with_irq macro to ensure the number of irq matches the number of base. Signed-off-by: William Breathitt Gray Acked-by: William Breathitt Gray --- drivers/counter/104-quad-8.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c index 62c2b7ac4339..3f8d1910a9bb 100644 --- a/drivers/counter/104-quad-8.c +++ b/drivers/counter/104-quad-8.c @@ -28,7 +28,8 @@ module_param_hw_array(base, uint, ioport, &num_quad8, 0); MODULE_PARM_DESC(base, "ACCES 104-QUAD-8 base addresses"); static unsigned int irq[max_num_isa_dev(QUAD8_EXTENT)]; -module_param_hw_array(irq, uint, irq, NULL, 0); +static unsigned int num_irq; +module_param_hw_array(irq, uint, irq, &num_irq, 0); MODULE_PARM_DESC(irq, "ACCES 104-QUAD-8 interrupt line numbers"); #define QUAD8_NUM_COUNTERS 8 @@ -1236,7 +1237,7 @@ static struct isa_driver quad8_driver = { } }; -module_isa_driver(quad8_driver, num_quad8); +module_isa_driver_with_irq(quad8_driver, num_quad8, num_irq); MODULE_AUTHOR("William Breathitt Gray "); MODULE_DESCRIPTION("ACCES 104-QUAD-8 driver"); From patchwork Thu Aug 18 16:28:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 598631 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 DD331C00140 for ; Thu, 18 Aug 2022 23:12:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239690AbiHRXMC (ORCPT ); Thu, 18 Aug 2022 19:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241453AbiHRXMB (ORCPT ); Thu, 18 Aug 2022 19:12:01 -0400 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95586CE4B1 for ; Thu, 18 Aug 2022 16:12:00 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id h22so2282468qtu.2 for ; Thu, 18 Aug 2022 16:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=eBJoaksl+YDmVk0O/pMB/ZWpuni/68BYE7uK17qPOPI=; b=xakoErxZSUn3M3G50lV9eRRWIJxMOyIHxInZiI8/UfKU1bPMLtT/WMbnve4dhDBixc 8Gi1EgJ1nhXbf48+YoeIB7br6/fSYtwBLzCMhxV5neXzi1fPkolFL6sWU0gLKCKPqeSY rtn+xQLKZ8S3iEpjNEjEx+GK9gdRKo9LMieshT5oH5c72+FBaAwRANE1U1Q8JSDzoKP5 kh4o2K8YhcZr/lj/kGHgIT6cgp+Xv2AxUuN0DgfsDsccvliqvNjnSTriEReAsav0/fHv nELgnV5kbOkiOEv47yx4vJ9umtypcD25uBBNL593DFatqGwVA4UB8+T4GgKOJAXXTnoL Q9Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=eBJoaksl+YDmVk0O/pMB/ZWpuni/68BYE7uK17qPOPI=; b=WzqrjKilKL/UIyM+R3Tgw5u3OQYndv/d/wvMqbxqGgtDdqhPj1MUdLNx8BTiqzmuBE i4KX39e/OEKMFt3Ui4z5ALUR4ay3VaJwODXqMxTj3S0PGYw2G7dnms65ecT2AyQgTYze ugnFlmUEkZ5mpPBDWeSlo5oiEhZnx0tNv7wBcH6wFthZlP892F1uVCWlP5GjOxVAALTB Rt7i+sOCSR/rp5Bk+RTWG/kJ9sMf3DTEnhqQeTFImZVSQxk5w0jtsiuH/a8dnDFSp9tF 8cLyGsQ3pesHpie1giHW0QflN3AlicoR2X0dcsXa7PCJtgfk9boX60Y4PBJJDgHOiDfK O0hw== X-Gm-Message-State: ACgBeo2fYwxjKzyUxFx+E7+L7Ni1znkNw++vQHpd9SEyGAiVHQZnbt4M fwAlwrdjVjgxZqhSiJbkQu0/jHXziPDGgw== X-Google-Smtp-Source: AA6agR5LbLxbEJDZOylBaSii5Kmhjzv03KBdIUZUGm6q9y86rSRISNpUWYGBW4Um5Wu+oN87fbGLcg== X-Received: by 2002:ac8:5bcc:0:b0:344:57f7:a065 with SMTP id b12-20020ac85bcc000000b0034457f7a065mr4596776qtb.444.1660864319785; Thu, 18 Aug 2022 16:11:59 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id h16-20020a05620a245000b006b5f06186aesm2864801qkn.65.2022.08.18.16.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 16:11:59 -0700 (PDT) From: William Breathitt Gray To: linux-iio@vger.kernel.or, linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linus.walleij@linaro.org, brgl@bgdev.pl, William Breathitt Gray Subject: [PATCH 3/6] gpio: 104-dio-48e: Ensure number of irq matches number of base Date: Thu, 18 Aug 2022 12:28:12 -0400 Message-Id: <8a7db52e7ba040ad3523a15c6f9369e3d1f46a02.1660839809.git.william.gray@linaro.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The 104-dio-48e module calls devm_request_irq() for each device. If the number of irq passed to the module does not match the number of base, a default value of 0 is passed to devm_request_irq(). IRQ 0 is probably not what the user wants, so utilize the module_isa_driver_with_irq macro to ensure the number of irq matches the number of base. Signed-off-by: William Breathitt Gray --- drivers/gpio/gpio-104-dio-48e.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c index a41551870759..8b5172802188 100644 --- a/drivers/gpio/gpio-104-dio-48e.c +++ b/drivers/gpio/gpio-104-dio-48e.c @@ -34,7 +34,8 @@ module_param_hw_array(base, uint, ioport, &num_dio48e, 0); MODULE_PARM_DESC(base, "ACCES 104-DIO-48E base addresses"); static unsigned int irq[MAX_NUM_DIO48E]; -module_param_hw_array(irq, uint, irq, NULL, 0); +static unsigned int num_irq; +module_param_hw_array(irq, uint, irq, &num_irq, 0); MODULE_PARM_DESC(irq, "ACCES 104-DIO-48E interrupt line numbers"); #define DIO48E_NUM_PPI 2 @@ -358,7 +359,7 @@ static struct isa_driver dio48e_driver = { .name = "104-dio-48e" }, }; -module_isa_driver(dio48e_driver, num_dio48e); +module_isa_driver_with_irq(dio48e_driver, num_dio48e, num_irq); MODULE_AUTHOR("William Breathitt Gray "); MODULE_DESCRIPTION("ACCES 104-DIO-48E GPIO driver"); From patchwork Thu Aug 18 16:28:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 598297 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 549E6C32774 for ; Thu, 18 Aug 2022 23:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234827AbiHRXMC (ORCPT ); Thu, 18 Aug 2022 19:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243789AbiHRXMB (ORCPT ); Thu, 18 Aug 2022 19:12:01 -0400 Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1F5CD0208 for ; Thu, 18 Aug 2022 16:12:00 -0700 (PDT) Received: by mail-qv1-xf32.google.com with SMTP id m17so2272226qvv.7 for ; Thu, 18 Aug 2022 16:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=MsO4YVqRB/LxYJYvW/oS7wwQWO4uPdmi9GWambEMbVo=; b=naQCv8X64zCQp8iIgBZaU+rAQz2523+/kBGlVj5Q/er2cqxiqXtVK/rttKDQlgSFAp 5zY081jcutGekPFCjJC3mdWkjxpiYXKUyc0ZYDvkrtW+Vg+x/WANRZ0hlIU6uwWpNwuz RrrDt1N/XTjrTkqZTIFrNZ7/cjjNUeUOeGz8DCfUVgoBhV+fZPEpWJsOXQzTQCahcqkO o8r0Z16LHk7vzB65br/pItrm+Z4Es9BBXZOEl93h9SmX+nhTME44hKQv+JAoC5FEd6b5 vTd3ZR0MaEr8ViEVZpbwiWlIWXWdIHCGboGIeRVbI0NZAuXqo3360OGeyu4UFe1QrV7G x0ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=MsO4YVqRB/LxYJYvW/oS7wwQWO4uPdmi9GWambEMbVo=; b=qr+k6X8O+ZTeSMROpP1viCLHF76lITfl6d979UH4QtgZ0OkQP4sDY7WlmqxT3ztp9H gwlEU28WbPAjbeImQo0MWqqLM5C7E9YcIiF2kzeVip0MF+Av03Y+utf6CBt1AWm1sruN S9XbvUSqXrfXEgnHXXY/ujWTx7Z2C65dKKjWYkcy7inTpSo+9Cls3IOeQMyi42gqKrS9 YLGbmEB+OPr6yFaJ4+TsjRtKWrhgve/bvuo7vglWyf9uIipgwubsET59YYnuMJKjvLYR GMZ57E1uH504G1NRs4HnP+vLMVopJLj8k1Iamyosxa2qqmu8q9tJcY+wjnQ9HVFishnr zLWQ== X-Gm-Message-State: ACgBeo3SW6l3xQ8S6hJlm5qFOuCCUpyor9YflOWW61sQ6xm9XMQFY+yV GLFH4R64zpv/t0jezVewlhQswQ== X-Google-Smtp-Source: AA6agR572EmSRg7psOMyjjr8QtyJyPm/wTr5K+kDpOFNrf0Qm4gJUF3+oWRroS8wmfmyQzV3J++Qkg== X-Received: by 2002:a05:6214:5287:b0:476:7938:5b76 with SMTP id kj7-20020a056214528700b0047679385b76mr4454411qvb.131.1660864320495; Thu, 18 Aug 2022 16:12:00 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id h16-20020a05620a245000b006b5f06186aesm2864801qkn.65.2022.08.18.16.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 16:12:00 -0700 (PDT) From: William Breathitt Gray To: linux-iio@vger.kernel.or, linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linus.walleij@linaro.org, brgl@bgdev.pl, William Breathitt Gray Subject: [PATCH 4/6] gpio: 104-idi-48: Ensure number of irq matches number of base Date: Thu, 18 Aug 2022 12:28:13 -0400 Message-Id: <0b7dbb8b35bc2b685fae5ce66ccee5b7c4a1fdc6.1660839809.git.william.gray@linaro.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The 104-idi-48 module calls devm_request_irq() for each device. If the number of irq passed to the module does not match the number of base, a default value of 0 is passed to devm_request_irq(). IRQ 0 is probably not what the user wants, so utilize the module_isa_driver_with_irq macro to ensure the number of irq matches the number of base. Signed-off-by: William Breathitt Gray --- drivers/gpio/gpio-104-idi-48.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c index 40be76efeed7..2b0256eefb70 100644 --- a/drivers/gpio/gpio-104-idi-48.c +++ b/drivers/gpio/gpio-104-idi-48.c @@ -34,7 +34,8 @@ module_param_hw_array(base, uint, ioport, &num_idi_48, 0); MODULE_PARM_DESC(base, "ACCES 104-IDI-48 base addresses"); static unsigned int irq[MAX_NUM_IDI_48]; -module_param_hw_array(irq, uint, irq, NULL, 0); +static unsigned int num_irq; +module_param_hw_array(irq, uint, irq, &num_irq, 0); MODULE_PARM_DESC(irq, "ACCES 104-IDI-48 interrupt line numbers"); /** @@ -300,7 +301,7 @@ static struct isa_driver idi_48_driver = { .name = "104-idi-48" }, }; -module_isa_driver(idi_48_driver, num_idi_48); +module_isa_driver_with_irq(idi_48_driver, num_idi_48, num_irq); MODULE_AUTHOR("William Breathitt Gray "); MODULE_DESCRIPTION("ACCES 104-IDI-48 GPIO driver"); From patchwork Thu Aug 18 16:28:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 598630 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 F36CCC00140 for ; Thu, 18 Aug 2022 23:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344977AbiHRXMJ (ORCPT ); Thu, 18 Aug 2022 19:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344959AbiHRXMD (ORCPT ); Thu, 18 Aug 2022 19:12:03 -0400 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B9AAD0208 for ; Thu, 18 Aug 2022 16:12:02 -0700 (PDT) Received: by mail-qv1-xf31.google.com with SMTP id q8so2266877qvr.9 for ; Thu, 18 Aug 2022 16:12:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=qjb4UgDhX3ydD5kec1iqNaG0SI9GdLWkjzQByMg9NrQ=; b=g8/ws7q79GlxKc5ucYMbw++jeXfp2K0Zi95QP/YtmX6Yfo1D77X9pgZaA364BqaTb0 tVbbfNI29WLDLiND5lK2Pd01q/I4AOvpmhmwjeNrzZNE2RMwF9py4MGc8rpP4XA1PO5x y+4f5NwFlti42304Z37C0BiqrocI2QmE9PCxKjEGirzad6jfdow9Xg6UdJwev86mqXjl CqFmaHeAYSOO+Amv2C+q4uTsN+QA5j4jeOz+feIoApm9MlAKnssj2B4EcH5jfWGQlyom +xw9eCaxrGNFgtU5NHwGacbTLUUPgVSnW7lq4iTeKvc51EWdanartn3UFWU5QNpEoLbh b5gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=qjb4UgDhX3ydD5kec1iqNaG0SI9GdLWkjzQByMg9NrQ=; b=C7Lga1Zp0DGuS+Wm/Sxl8S4jyk1Orr1ViT+LDGUOaglFx37iCXXBYyrX74NCOPr6yJ r2gUeBv/Wn2qggf2t31/f4H/lbM3VoBFeRRDc+WeVCnWoklLN2Ig10ZZhAKDDTRnk4Ok O1A5Ab89CST6nMWY1o1jCRHmBZ8tni4r065Tjz9KwXkL2rOD6HwarmOK6wP6gpV2xwfP hxwXCjmYcf68xqz+CEkutKOO8FAo3seI07pCxNXFU5b+LHYBYNP+ISvqrp3vi1v8GrGG YoEkRO55RIO2hVnXXgNFU8LRjrsr9ouS7l2BjqxS6aPcIWnkgIG2/FfUUVp1JfsPDAp2 3r3A== X-Gm-Message-State: ACgBeo3qzDYtVcS8iBGj2xlYVNC0IEJUu5ZhAuxA7xPO9GSiBRAMtQ3w lA9+bsQ40POBUsW5GbUnKulWyg== X-Google-Smtp-Source: AA6agR4KKxeQ/P/SWs4vqAaffTyu7nBhtltEhYQjOe1EDTSgsdFR1vBA8rIaTBjskNnuT46vtIX3mg== X-Received: by 2002:a0c:e246:0:b0:491:d36e:e3c9 with SMTP id x6-20020a0ce246000000b00491d36ee3c9mr4445052qvl.68.1660864321248; Thu, 18 Aug 2022 16:12:01 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id h16-20020a05620a245000b006b5f06186aesm2864801qkn.65.2022.08.18.16.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 16:12:01 -0700 (PDT) From: William Breathitt Gray To: linux-iio@vger.kernel.or, linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linus.walleij@linaro.org, brgl@bgdev.pl, William Breathitt Gray Subject: [PATCH 5/6] gpio: 104-idio-16: Ensure number of irq matches number of base Date: Thu, 18 Aug 2022 12:28:14 -0400 Message-Id: X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The 104-idio-16 module calls devm_request_irq() for each device. If the number of irq passed to the module does not match the number of base, a default value of 0 is passed to devm_request_irq(). IRQ 0 is probably not what the user wants, so utilize the module_isa_driver_with_irq macro to ensure the number of irq matches the number of base. Signed-off-by: William Breathitt Gray --- drivers/gpio/gpio-104-idio-16.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-104-idio-16.c b/drivers/gpio/gpio-104-idio-16.c index 65a5f581d981..73d95b55a8c5 100644 --- a/drivers/gpio/gpio-104-idio-16.c +++ b/drivers/gpio/gpio-104-idio-16.c @@ -30,7 +30,8 @@ module_param_hw_array(base, uint, ioport, &num_idio_16, 0); MODULE_PARM_DESC(base, "ACCES 104-IDIO-16 base addresses"); static unsigned int irq[MAX_NUM_IDIO_16]; -module_param_hw_array(irq, uint, irq, NULL, 0); +static unsigned int num_irq; +module_param_hw_array(irq, uint, irq, &num_irq, 0); MODULE_PARM_DESC(irq, "ACCES 104-IDIO-16 interrupt line numbers"); /** @@ -333,7 +334,7 @@ static struct isa_driver idio_16_driver = { }, }; -module_isa_driver(idio_16_driver, num_idio_16); +module_isa_driver_with_irq(idio_16_driver, num_idio_16, num_irq); MODULE_AUTHOR("William Breathitt Gray "); MODULE_DESCRIPTION("ACCES 104-IDIO-16 GPIO driver"); From patchwork Thu Aug 18 16:28:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 598296 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 A29C0C00140 for ; Thu, 18 Aug 2022 23:12:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345606AbiHRXML (ORCPT ); Thu, 18 Aug 2022 19:12:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243789AbiHRXMD (ORCPT ); Thu, 18 Aug 2022 19:12:03 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BB78D075E for ; Thu, 18 Aug 2022 16:12:03 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id j1so2268296qvv.8 for ; Thu, 18 Aug 2022 16:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Qu2TGN9CjzD6yBI864XHlOsKzcqX8LEumSWv7yTr8E4=; b=cTlnrtwCj7fKbVCMWOP/7ScYWUlMmukWmTTFb2XdY90Tz/AP4dF+ykyJzJ7/idgkd2 4aHh/bEcy4TIOIJYoXzJO/J3vkU9qH06467V+eRGumgqLs5YkNHeKz/o5kIWJVp+EgCk 0UaKfzjbcg7GV8YsKuJalVI1rUyrc1+Wef47/9RWH6jEJ00yaR6G1XJ4vR5leuYaeaTk sPPqNb3pICpAzSW4xsrlb86cTligYLSUwhAwZZj6z3+X6/aXNTACOJis4R7mrLVBgbUx 26h8nVjIBsLhpfX28dw5LCewnIFXpj0FMlSmibtJUbHL0yKk0RUkComkY+oPSGVjpwBy i+rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Qu2TGN9CjzD6yBI864XHlOsKzcqX8LEumSWv7yTr8E4=; b=TozgGWMVvodw3Ki39IvHKy3qfWNOs5kxN9TQDobw48iz0TQVpXwDc88UXyvVpPcNY3 +IP3+PTRvoTc+ztN6jy7MmJKD2bDxN+tkDOhbNqRlFf127sLN/3avQQfAEwfHt9UKV/V PRk6e73NsKS5zlw8nrs2dVzvbGx2FOD287ZbbgTGCBPjo/+5h5xWVuBvJYiukXPHWuky EMFX6OF/X4PVHsTEcrXDxzYWRIqxEM2fnbFZBT8vWyiPoQJ3iMsA/mnJWkdlkdQIRek7 tgIN13N/vDTp8yxomkFAPpaPUVRMO/PKccEXMptPZUsWwmr1V3WGAHMPtA0LBB1gd6qC YpVQ== X-Gm-Message-State: ACgBeo1+0QHX+DtbvaxWuopKfVMRNLjml0OjoxyFfPhFp/X+FXX95oQ2 PZ/vT+1BgMDNkcU9el1rEU2zIg== X-Google-Smtp-Source: AA6agR5h9prYuf/tQ2t5gzKdwitmkasVnnvFulc/++B9Z/rQtTvdgQnhTj9W8wGOHlcPPeACKF/J9A== X-Received: by 2002:a05:6214:19e1:b0:476:95b7:1dc9 with SMTP id q1-20020a05621419e100b0047695b71dc9mr4442306qvc.124.1660864322045; Thu, 18 Aug 2022 16:12:02 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id h16-20020a05620a245000b006b5f06186aesm2864801qkn.65.2022.08.18.16.12.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 16:12:01 -0700 (PDT) From: William Breathitt Gray To: linux-iio@vger.kernel.or, linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linus.walleij@linaro.org, brgl@bgdev.pl, William Breathitt Gray Subject: [PATCH 6/6] gpio: ws16c48: Ensure number of irq matches number of base Date: Thu, 18 Aug 2022 12:28:15 -0400 Message-Id: X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The ws16c48 module calls devm_request_irq() for each device. If the number of irq passed to the module does not match the number of base, a default value of 0 is passed to devm_request_irq(). IRQ 0 is probably not what the user wants, so utilize the module_isa_driver_with_irq macro to ensure the number of irq matches the number of base. Signed-off-by: William Breathitt Gray --- drivers/gpio/gpio-ws16c48.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-ws16c48.c b/drivers/gpio/gpio-ws16c48.c index b098f2dc196b..88410da91aaf 100644 --- a/drivers/gpio/gpio-ws16c48.c +++ b/drivers/gpio/gpio-ws16c48.c @@ -27,7 +27,8 @@ module_param_hw_array(base, uint, ioport, &num_ws16c48, 0); MODULE_PARM_DESC(base, "WinSystems WS16C48 base addresses"); static unsigned int irq[MAX_NUM_WS16C48]; -module_param_hw_array(irq, uint, irq, NULL, 0); +static unsigned int num_irq; +module_param_hw_array(irq, uint, irq, &num_irq, 0); MODULE_PARM_DESC(irq, "WinSystems WS16C48 interrupt line numbers"); /** @@ -497,7 +498,7 @@ static struct isa_driver ws16c48_driver = { }, }; -module_isa_driver(ws16c48_driver, num_ws16c48); +module_isa_driver_with_irq(ws16c48_driver, num_ws16c48, num_irq); MODULE_AUTHOR("William Breathitt Gray "); MODULE_DESCRIPTION("WinSystems WS16C48 GPIO driver");