From: Thomas Gleixner <tglx@linutronix.de>
To: Jinjie Ruan <ruanjinjie@huawei.com>, linux-kernel@vger.kernel.org
Cc: ruanjinjie@huawei.com
Subject: Re: [PATCH] genirq/irqdomain: Clean code for __irq_domain_create()
Date: Mon, 06 May 2024 20:01:26 +0200 [thread overview]
Message-ID: <87pltyrf9l.ffs@tglx> (raw)
In-Reply-To: <20240430093353.1919862-1-ruanjinjie@huawei.com>
On Tue, Apr 30 2024 at 17:33, Jinjie Ruan wrote:
> Introduce irq_domain_alloc_name() function to handle name allocation for
> the irq domain, add "out_free_domain" label to free the irq domain, and
> when "is_fwnode_irqchip(fwnode)" is true, "domain->fwnode = fwnode" is
> the common action, so do it outside the switch, which can make the code
> more clearer.
First of all changelogs should describe the reason for the change and
not enumerate a list of things which the patch does. The latter can be
seen from the patch itself.
> +static int irq_domain_alloc_name(struct fwnode_handle *fwnode,
> + struct irq_domain *domain,
> + int unknown_domains, char *in_name)
> +{
> + char *name;
> +
> + if (fwnode == NULL) {
> + if (unknown_domains)
> + domain->name = kasprintf(GFP_KERNEL, "unknown-%d",
> + unknown_domains);
> + else
> + domain->name = kstrdup(in_name, GFP_KERNEL);
> + if (!domain->name)
> + return -ENOMEM;
> + goto out;
> + }
> +
> + /*
> + * fwnode paths contain '/', which debugfs is legitimately
> + * unhappy about. Replace them with ':', which does
> + * the trick and is not as offensive as '\'...
> + */
> + name = kasprintf(GFP_KERNEL, "%pfw", fwnode);
> + if (!name)
> + return -ENOMEM;
> +
> + domain->name = strreplace(name, '/', ':');
> +
> +out:
> + domain->flags |= IRQ_DOMAIN_NAME_ALLOCATED;
> + return 0;
This function is horrible. The only shared thing here is the
domain->flags manipulation. I'm not seeing how this is an improvement.
Thanks,
tglx
next prev parent reply other threads:[~2024-05-06 18:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 9:33 [PATCH] genirq/irqdomain: Clean code for __irq_domain_create() Jinjie Ruan
2024-05-06 18:01 ` Thomas Gleixner [this message]
2024-05-07 1:22 ` Jinjie Ruan
2024-05-07 10:22 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pltyrf9l.ffs@tglx \
--to=tglx@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=ruanjinjie@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox