Commit 9835cec6 authored by Thomas Gleixner's avatar Thomas Gleixner

platform-msi: Rename functions and clarify comments

It's hard to distinguish what platform_msi_domain_alloc() and
platform_msi_domain_alloc_irqs() are about. Make the distinction more
explicit and add comments which explain the use cases properly.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarNishanth Menon <nm@ti.com>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20211210221814.228706214@linutronix.de
parent 24cff375
...@@ -313,17 +313,18 @@ EXPORT_SYMBOL_GPL(platform_msi_domain_free_irqs); ...@@ -313,17 +313,18 @@ EXPORT_SYMBOL_GPL(platform_msi_domain_free_irqs);
* a platform-msi domain * a platform-msi domain
* @domain: The platform-msi domain * @domain: The platform-msi domain
* *
* Returns the private data provided when calling * Return: The private data provided when calling
* platform_msi_create_device_domain. * platform_msi_create_device_domain().
*/ */
void *platform_msi_get_host_data(struct irq_domain *domain) void *platform_msi_get_host_data(struct irq_domain *domain)
{ {
struct platform_msi_priv_data *data = domain->host_data; struct platform_msi_priv_data *data = domain->host_data;
return data->host_data; return data->host_data;
} }
/** /**
* __platform_msi_create_device_domain - Create a platform-msi domain * __platform_msi_create_device_domain - Create a platform-msi device domain
* *
* @dev: The device generating the MSIs * @dev: The device generating the MSIs
* @nvec: The number of MSIs that need to be allocated * @nvec: The number of MSIs that need to be allocated
...@@ -332,7 +333,11 @@ void *platform_msi_get_host_data(struct irq_domain *domain) ...@@ -332,7 +333,11 @@ void *platform_msi_get_host_data(struct irq_domain *domain)
* @ops: The hierarchy domain operations to use * @ops: The hierarchy domain operations to use
* @host_data: Private data associated to this domain * @host_data: Private data associated to this domain
* *
* Returns an irqdomain for @nvec interrupts * Return: An irqdomain for @nvec interrupts on success, NULL in case of error.
*
* This is for interrupt domains which stack on a platform-msi domain
* created by platform_msi_create_irq_domain(). @dev->msi.domain points to
* that platform-msi domain which is the parent for the new domain.
*/ */
struct irq_domain * struct irq_domain *
__platform_msi_create_device_domain(struct device *dev, __platform_msi_create_device_domain(struct device *dev,
...@@ -372,18 +377,19 @@ __platform_msi_create_device_domain(struct device *dev, ...@@ -372,18 +377,19 @@ __platform_msi_create_device_domain(struct device *dev,
} }
/** /**
* platform_msi_domain_free - Free interrupts associated with a platform-msi * platform_msi_device_domain_free - Free interrupts associated with a platform-msi
* domain * device domain
* *
* @domain: The platform-msi domain * @domain: The platform-msi device domain
* @virq: The base irq from which to perform the free operation * @virq: The base irq from which to perform the free operation
* @nvec: How many interrupts to free from @virq * @nvec: How many interrupts to free from @virq
*/ */
void platform_msi_domain_free(struct irq_domain *domain, unsigned int virq, void platform_msi_device_domain_free(struct irq_domain *domain, unsigned int virq,
unsigned int nvec) unsigned int nvec)
{ {
struct platform_msi_priv_data *data = domain->host_data; struct platform_msi_priv_data *data = domain->host_data;
struct msi_desc *desc, *tmp; struct msi_desc *desc, *tmp;
for_each_msi_entry_safe(desc, tmp, data->dev) { for_each_msi_entry_safe(desc, tmp, data->dev) {
if (WARN_ON(!desc->irq || desc->nvec_used != 1)) if (WARN_ON(!desc->irq || desc->nvec_used != 1))
return; return;
...@@ -397,10 +403,10 @@ void platform_msi_domain_free(struct irq_domain *domain, unsigned int virq, ...@@ -397,10 +403,10 @@ void platform_msi_domain_free(struct irq_domain *domain, unsigned int virq,
} }
/** /**
* platform_msi_domain_alloc - Allocate interrupts associated with * platform_msi_device_domain_alloc - Allocate interrupts associated with
* a platform-msi domain * a platform-msi device domain
* *
* @domain: The platform-msi domain * @domain: The platform-msi device domain
* @virq: The base irq from which to perform the allocate operation * @virq: The base irq from which to perform the allocate operation
* @nr_irqs: How many interrupts to free from @virq * @nr_irqs: How many interrupts to free from @virq
* *
...@@ -408,8 +414,8 @@ void platform_msi_domain_free(struct irq_domain *domain, unsigned int virq, ...@@ -408,8 +414,8 @@ void platform_msi_domain_free(struct irq_domain *domain, unsigned int virq,
* with irq_domain_mutex held (which can only be done as part of a * with irq_domain_mutex held (which can only be done as part of a
* top-level interrupt allocation). * top-level interrupt allocation).
*/ */
int platform_msi_domain_alloc(struct irq_domain *domain, unsigned int virq, int platform_msi_device_domain_alloc(struct irq_domain *domain, unsigned int virq,
unsigned int nr_irqs) unsigned int nr_irqs)
{ {
struct platform_msi_priv_data *data = domain->host_data; struct platform_msi_priv_data *data = domain->host_data;
int err; int err;
...@@ -421,7 +427,7 @@ int platform_msi_domain_alloc(struct irq_domain *domain, unsigned int virq, ...@@ -421,7 +427,7 @@ int platform_msi_domain_alloc(struct irq_domain *domain, unsigned int virq,
err = msi_domain_populate_irqs(domain->parent, data->dev, err = msi_domain_populate_irqs(domain->parent, data->dev,
virq, nr_irqs, &data->arg); virq, nr_irqs, &data->arg);
if (err) if (err)
platform_msi_domain_free(domain, virq, nr_irqs); platform_msi_device_domain_free(domain, virq, nr_irqs);
return err; return err;
} }
...@@ -207,7 +207,7 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain, ...@@ -207,7 +207,7 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain,
if (err) if (err)
return err; return err;
err = platform_msi_domain_alloc(domain, virq, nr_irqs); err = platform_msi_device_domain_alloc(domain, virq, nr_irqs);
if (err) if (err)
return err; return err;
...@@ -223,7 +223,7 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain, ...@@ -223,7 +223,7 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain,
static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq, static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq,
unsigned int nr_irqs) unsigned int nr_irqs)
{ {
platform_msi_domain_free(domain, virq, nr_irqs); platform_msi_device_domain_free(domain, virq, nr_irqs);
} }
static const struct irq_domain_ops mbigen_domain_ops = { static const struct irq_domain_ops mbigen_domain_ops = {
......
...@@ -221,7 +221,7 @@ mvebu_icu_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, ...@@ -221,7 +221,7 @@ mvebu_icu_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
icu_irqd->icu_group = msi_data->subset_data->icu_group; icu_irqd->icu_group = msi_data->subset_data->icu_group;
icu_irqd->icu = icu; icu_irqd->icu = icu;
err = platform_msi_domain_alloc(domain, virq, nr_irqs); err = platform_msi_device_domain_alloc(domain, virq, nr_irqs);
if (err) { if (err) {
dev_err(icu->dev, "failed to allocate ICU interrupt in parent domain\n"); dev_err(icu->dev, "failed to allocate ICU interrupt in parent domain\n");
goto free_irqd; goto free_irqd;
...@@ -245,7 +245,7 @@ mvebu_icu_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, ...@@ -245,7 +245,7 @@ mvebu_icu_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
return 0; return 0;
free_msi: free_msi:
platform_msi_domain_free(domain, virq, nr_irqs); platform_msi_device_domain_free(domain, virq, nr_irqs);
free_irqd: free_irqd:
kfree(icu_irqd); kfree(icu_irqd);
return err; return err;
...@@ -260,7 +260,7 @@ mvebu_icu_irq_domain_free(struct irq_domain *domain, unsigned int virq, ...@@ -260,7 +260,7 @@ mvebu_icu_irq_domain_free(struct irq_domain *domain, unsigned int virq,
kfree(icu_irqd); kfree(icu_irqd);
platform_msi_domain_free(domain, virq, nr_irqs); platform_msi_device_domain_free(domain, virq, nr_irqs);
} }
static const struct irq_domain_ops mvebu_icu_domain_ops = { static const struct irq_domain_ops mvebu_icu_domain_ops = {
......
...@@ -435,10 +435,10 @@ __platform_msi_create_device_domain(struct device *dev, ...@@ -435,10 +435,10 @@ __platform_msi_create_device_domain(struct device *dev,
#define platform_msi_create_device_tree_domain(dev, nvec, write, ops, data) \ #define platform_msi_create_device_tree_domain(dev, nvec, write, ops, data) \
__platform_msi_create_device_domain(dev, nvec, true, write, ops, data) __platform_msi_create_device_domain(dev, nvec, true, write, ops, data)
int platform_msi_domain_alloc(struct irq_domain *domain, unsigned int virq, int platform_msi_device_domain_alloc(struct irq_domain *domain, unsigned int virq,
unsigned int nr_irqs); unsigned int nr_irqs);
void platform_msi_domain_free(struct irq_domain *domain, unsigned int virq, void platform_msi_device_domain_free(struct irq_domain *domain, unsigned int virq,
unsigned int nvec); unsigned int nvec);
void *platform_msi_get_host_data(struct irq_domain *domain); void *platform_msi_get_host_data(struct irq_domain *domain);
#endif /* CONFIG_GENERIC_MSI_IRQ_DOMAIN */ #endif /* CONFIG_GENERIC_MSI_IRQ_DOMAIN */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment