From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFB10606A33C for ; Mon, 30 Nov 2026 14:38:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=gSmsZVQs; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OyL6f7nB DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:From: Cc:Subject:To:Message-Id:Date:Content-Type:Mime-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=+IkUXVOTlOTK8P3WWCyrN5S8JwWLMnTFxn9BXBFXsto=; b=gSmsZVQs76v/SDFqfzgBRxudxj LIBkIs+S+YQ6ny1STkupOqG7AjrRVvayj7Xw+ovXeDu7KYwYdy4dP73442Wfzn4qumsxTu8AkDL3M Kf/Y0ogy4tkpebsBkUAeEgEXKE+R8Z12Gp6ExTTs14fIdJnZj+mwxUkzV5crbgREk74XELpCeAYlJ hjKqiacQKL9S28SpG9BsN1iARG91L3JXE2wUMo5Gv59shInS1USoZy6LN/YFcj9qZNSToY1uzi7kp DDo+USyn+nBP8CVLo/4miSoOb+JAcaUUUZ1acgCJwemM861DY9m0MWYmPU0wcHraEOiEpGHcHQqec 77sXit+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xY2Vd-00000004v5G-0Xyc; Mon, 30 Nov 2026 14:37:37 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xY2VO-00000004uyj-1QzR for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2026 14:37:22 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with UTF8SMTP id 6386361F97; Mon, 30 Nov 2026 14:37:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id A89D21F008A0; Mon, 30 Nov 2026 14:37:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796049441; bh=+IkUXVOTlOTK8P3WWCyrN5S8JwWLMnTFxn9BXBFXsto=; h=Date:To:Subject:Cc:From:References:In-Reply-To; b=OyL6f7nB5Bmslvrr9Iwcd26/AL7kPv4r8mDlES6NMhmAbxpDdlUhE3GSPt+cSwMp6 pt2oU6bUssEbGeqkwMLoOVOXGM6FafGcI6fcX5YXbURwmPAMRw9Y1Dag7g+O0a6dKW r30IYTUq8VnCSpUXE0LEg4BZUn9iLeEzWRt9zMDbXb8zr8bzxpCSFfk2RB5Q2ZFZz+ dro97pc5O6XzWGpRPilwmwNpGzT0lPT/T8Qd1YsFbbRGadKI8gL65xyJD2GoyckGcZ Yqf8AKQERmUqxYB+DA3xHY7Y5wN2+KYXh/tmV488ClGcxfQIAzKD/ndIaBMeD5djhU bQ1W7XkIPqu9A== X-Archived-By: Mime-Version: 1.0 Content-Type: multipart/signed; boundary=aa8b0377918ea9b8b1966762bfc063f1d2e4ac536766a5e13b0e48b69d7d; micalg=pgp-sha384; protocol="application/pgp-signature" Date: Mon, 30 Nov 2026 15:37:17 +0100 Message-Id: To: "Andy Shevchenko" Subject: Re: [RFT PATCH v2 04/14] gpio: rtd1625: create the IRQ domain from the gpio-regmap callback Cc: "William Breathitt Gray" , "Linus Walleij" , "Bartosz Golaszewski" , "Petar Stepanovic" , "SriNavmani A" , "Prasad Bolisetty" , "Tzu-Hao Wei" , "Karthikeyan Mitran" , "Mathieu Dubois-Briand" , "Lee Jones" , "Long Zhao" , "Joseph Telaak" , , From: "Michael Walle" X-Mailer: aerc 0.20.0 References: <20261127145232.814492-1-mwalle@kernel.org> <20261127145232.814492-5-mwalle@kernel.org> In-Reply-To: X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 --aa8b0377918ea9b8b1966762bfc063f1d2e4ac536766a5e13b0e48b69d7d Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Hi, >> +static struct irq_domain *rtd1625_gpio_create_irq_domain(struct gpio_re= gmap *gpio_reg) >> +{ >> + struct rtd1625_gpio *data =3D gpio_regmap_get_drvdata(gpio_reg); >> + struct device *dev =3D regmap_get_device(data->regmap); >> + struct irq_domain_info d_info =3D {}; >> + >> + d_info.fwnode =3D dev_fwnode(dev); >> + d_info.size =3D data->info->num_gpios; >> + d_info.hwirq_max =3D data->info->num_gpios; >> + d_info.ops =3D &rtd1625_gpio_irq_domain_ops; >> + d_info.host_data =3D gpio_reg; >> + >> + data->domain =3D irq_domain_instantiate(&d_info); >> + if (IS_ERR(data->domain)) >> + return data->domain; > > This is open coded irq_domain_create_linear(). The only difference is tha= t we > propagate the underneath error code instead of decoding NULL as ENOMEM or > EINVAL or something like that. If this is the case, add a comment explain= ing > why, otherwise somebody will change that in the future w/o much thinking. Yes! I'm going to use irq_domain_create_linear(). > > Note, it was open coded since there is no devm_*() helper for that. > >> + for (unsigned int i =3D 0; i < RTD1625_MAX_IRQS; i++) { >> + if (data->irqs[i]) >> + irq_set_chained_handler_and_data(data->irqs[i], >> + rtd1625_gpio_irq_handle, >> + data); >> + } >> + >> + return data->domain; >> +} > > ... > >> +static void rtd1625_gpio_remove_irq_domain(struct gpio_regmap *gpio_reg= ) >> +{ >> + struct rtd1625_gpio *data =3D gpio_regmap_get_drvdata(gpio_reg); >> + >> + for (unsigned int i =3D 0; i < RTD1625_MAX_IRQS; i++) { > >> + if (data->irqs[i]) > > Do you need this? It seems to me that irq_to_desc() returns NULL > and scoped_irqdesc_get_and_buslock() does nothing. Yes, I know > it's a tricky code. Maybe, but I couldn't find any code already relying on that. So do we really want to do that here? Alternatively, we could add num_irqs to struct rtd1625_gpio and just end the for loop at that boundary. But I'm not sure that's worth it. I don't care too much. I'm fine either way, but I haven't looked too closely if passing 0 as irq is fine. -michael > >> + irq_set_chained_handler_and_data(data->irqs[i], NULL, NULL); >> + } >> + >> + for (irq_hw_number_t hwirq =3D 0; hwirq < data->info->num_gpios; hwirq= ++) >> + irq_dispose_mapping(irq_find_mapping(data->domain, hwirq)); >> + >> + irq_domain_remove(data->domain); >> +} --aa8b0377918ea9b8b1966762bfc063f1d2e4ac536766a5e13b0e48b69d7d Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iKgEABMJADAWIQTIVZIcOo5wfU/AngkSJzzuPgIf+AUCaw2KHRIcbXdhbGxlQGtl cm5lbC5vcmcACgkQEic87j4CH/g8FgF/QzLPRw1QNsHPvZAN/fnnf6ijRoGKKvrk D9KrNn+5B8qI/Q7JDDrNd/UsCsT54LiqAX0cOjVN3MHMpHInVcSDqaZcFMj5eU1j dEhXT0wdynTwNIqS5a6x9R8jdgtxvdgKcJ8= =qZL/ -----END PGP SIGNATURE----- --aa8b0377918ea9b8b1966762bfc063f1d2e4ac536766a5e13b0e48b69d7d--