From: Corentin LABBE <clabbe.montjoie@gmail.com>
To: lftan@altera.com
Cc: linux-kernel@vger.kernel.org,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH v8 4/6] pci: altera: Add Altera PCIe MSI driver
Date: Thu, 8 Oct 2015 22:05:09 +0200 [thread overview]
Message-ID: <5616CC75.5030700@gmail.com> (raw)
In-Reply-To: <E1ZkHFw-0007bx-3v@feisty.vs19.net>
> This patch adds Altera PCIe MSI driver. This soft IP supports configurable
> number of vectors, which is a dts parameter.
>
> Signed-off-by: Ley Foon Tan <lftan@altera.com>
> Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
> +
> +static inline void msi_writel(struct altera_msi *msi, u32 value, u32 reg)
> +{
> + writel_relaxed(value, msi->csr_base + reg);
> +}
> +
> +static inline u32 msi_readl(struct altera_msi *msi, u32 reg)
> +{
> + return readl_relaxed(msi->csr_base + reg);
> +}
> +
You could set value and reg parameter as const
> +
> +static int altera_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
> + unsigned int nr_irqs, void *args)
> +{
> + struct altera_msi *msi = domain->host_data;
> + unsigned long bit;
> + u32 mask;
> +
> + WARN_ON(nr_irqs != 1);
> + mutex_lock(&msi->lock);
> +
> + bit = find_first_zero_bit(msi->used, msi->num_of_vectors);
> + if (bit >= msi->num_of_vectors)
> + return -ENOSPC;
> +
> + set_bit(bit, msi->used);
> +
> + mutex_unlock(&msi->lock);
> +
> + irq_domain_set_info(domain, virq, bit, &altera_msi_bottom_irq_chip,
> + domain->host_data, handle_simple_irq,
> + NULL, NULL);
> +
> + mask = msi_readl(msi, MSI_INTMASK);
> + mask |= 1 << bit;
> + msi_writel(msi, mask, MSI_INTMASK);
> +
> + return 0;
> +}
You do not unlock the mutex when returning -ENOSPC
And again some parameter could be set as const
next parent reply other threads:[~2015-10-08 20:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1ZkHFw-0007bx-3v@feisty.vs19.net>
2015-10-08 20:05 ` Corentin LABBE [this message]
2015-10-12 1:55 ` [PATCH v8 4/6] pci: altera: Add Altera PCIe MSI driver Ley Foon Tan
2015-10-08 9:43 [PATCH v8 0/6] Altera PCIe host controller driver with MSI support Ley Foon Tan
2015-10-08 9:43 ` [PATCH v8 4/6] pci: altera: Add Altera PCIe MSI driver Ley Foon Tan
2015-10-08 14:38 ` kbuild test robot
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=5616CC75.5030700@gmail.com \
--to=clabbe.montjoie@gmail.com \
--cc=lftan@altera.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).