Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20211210221814.228706214@linutronix.de

+30 -24
+21 -15
drivers/base/platform-msi.c
··· 313 313 * a platform-msi domain 314 314 * @domain: The platform-msi domain 315 315 * 316 - * Returns the private data provided when calling 317 - * platform_msi_create_device_domain. 316 + * Return: The private data provided when calling 317 + * platform_msi_create_device_domain(). 318 318 */ 319 319 void *platform_msi_get_host_data(struct irq_domain *domain) 320 320 { 321 321 struct platform_msi_priv_data *data = domain->host_data; 322 + 322 323 return data->host_data; 323 324 } 324 325 325 326 /** 326 - * __platform_msi_create_device_domain - Create a platform-msi domain 327 + * __platform_msi_create_device_domain - Create a platform-msi device domain 327 328 * 328 329 * @dev: The device generating the MSIs 329 330 * @nvec: The number of MSIs that need to be allocated ··· 333 332 * @ops: The hierarchy domain operations to use 334 333 * @host_data: Private data associated to this domain 335 334 * 336 - * Returns an irqdomain for @nvec interrupts 335 + * Return: An irqdomain for @nvec interrupts on success, NULL in case of error. 336 + * 337 + * This is for interrupt domains which stack on a platform-msi domain 338 + * created by platform_msi_create_irq_domain(). @dev->msi.domain points to 339 + * that platform-msi domain which is the parent for the new domain. 337 340 */ 338 341 struct irq_domain * 339 342 __platform_msi_create_device_domain(struct device *dev, ··· 377 372 } 378 373 379 374 /** 380 - * platform_msi_domain_free - Free interrupts associated with a platform-msi 381 - * domain 375 + * platform_msi_device_domain_free - Free interrupts associated with a platform-msi 376 + * device domain 382 377 * 383 - * @domain: The platform-msi domain 378 + * @domain: The platform-msi device domain 384 379 * @virq: The base irq from which to perform the free operation 385 380 * @nvec: How many interrupts to free from @virq 386 381 */ 387 - void platform_msi_domain_free(struct irq_domain *domain, unsigned int virq, 388 - unsigned int nvec) 382 + void platform_msi_device_domain_free(struct irq_domain *domain, unsigned int virq, 383 + unsigned int nvec) 389 384 { 390 385 struct platform_msi_priv_data *data = domain->host_data; 391 386 struct msi_desc *desc, *tmp; 387 + 392 388 for_each_msi_entry_safe(desc, tmp, data->dev) { 393 389 if (WARN_ON(!desc->irq || desc->nvec_used != 1)) 394 390 return; ··· 403 397 } 404 398 405 399 /** 406 - * platform_msi_domain_alloc - Allocate interrupts associated with 407 - * a platform-msi domain 400 + * platform_msi_device_domain_alloc - Allocate interrupts associated with 401 + * a platform-msi device domain 408 402 * 409 - * @domain: The platform-msi domain 403 + * @domain: The platform-msi device domain 410 404 * @virq: The base irq from which to perform the allocate operation 411 405 * @nr_irqs: How many interrupts to free from @virq 412 406 * ··· 414 408 * with irq_domain_mutex held (which can only be done as part of a 415 409 * top-level interrupt allocation). 416 410 */ 417 - int platform_msi_domain_alloc(struct irq_domain *domain, unsigned int virq, 418 - unsigned int nr_irqs) 411 + int platform_msi_device_domain_alloc(struct irq_domain *domain, unsigned int virq, 412 + unsigned int nr_irqs) 419 413 { 420 414 struct platform_msi_priv_data *data = domain->host_data; 421 415 int err; ··· 427 421 err = msi_domain_populate_irqs(domain->parent, data->dev, 428 422 virq, nr_irqs, &data->arg); 429 423 if (err) 430 - platform_msi_domain_free(domain, virq, nr_irqs); 424 + platform_msi_device_domain_free(domain, virq, nr_irqs); 431 425 432 426 return err; 433 427 }
+2 -2
drivers/irqchip/irq-mbigen.c
··· 207 207 if (err) 208 208 return err; 209 209 210 - err = platform_msi_domain_alloc(domain, virq, nr_irqs); 210 + err = platform_msi_device_domain_alloc(domain, virq, nr_irqs); 211 211 if (err) 212 212 return err; 213 213 ··· 223 223 static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq, 224 224 unsigned int nr_irqs) 225 225 { 226 - platform_msi_domain_free(domain, virq, nr_irqs); 226 + platform_msi_device_domain_free(domain, virq, nr_irqs); 227 227 } 228 228 229 229 static const struct irq_domain_ops mbigen_domain_ops = {
+3 -3
drivers/irqchip/irq-mvebu-icu.c
··· 221 221 icu_irqd->icu_group = msi_data->subset_data->icu_group; 222 222 icu_irqd->icu = icu; 223 223 224 - err = platform_msi_domain_alloc(domain, virq, nr_irqs); 224 + err = platform_msi_device_domain_alloc(domain, virq, nr_irqs); 225 225 if (err) { 226 226 dev_err(icu->dev, "failed to allocate ICU interrupt in parent domain\n"); 227 227 goto free_irqd; ··· 245 245 return 0; 246 246 247 247 free_msi: 248 - platform_msi_domain_free(domain, virq, nr_irqs); 248 + platform_msi_device_domain_free(domain, virq, nr_irqs); 249 249 free_irqd: 250 250 kfree(icu_irqd); 251 251 return err; ··· 260 260 261 261 kfree(icu_irqd); 262 262 263 - platform_msi_domain_free(domain, virq, nr_irqs); 263 + platform_msi_device_domain_free(domain, virq, nr_irqs); 264 264 } 265 265 266 266 static const struct irq_domain_ops mvebu_icu_domain_ops = {
+4 -4
include/linux/msi.h
··· 435 435 #define platform_msi_create_device_tree_domain(dev, nvec, write, ops, data) \ 436 436 __platform_msi_create_device_domain(dev, nvec, true, write, ops, data) 437 437 438 - int platform_msi_domain_alloc(struct irq_domain *domain, unsigned int virq, 439 - unsigned int nr_irqs); 440 - void platform_msi_domain_free(struct irq_domain *domain, unsigned int virq, 441 - unsigned int nvec); 438 + int platform_msi_device_domain_alloc(struct irq_domain *domain, unsigned int virq, 439 + unsigned int nr_irqs); 440 + void platform_msi_device_domain_free(struct irq_domain *domain, unsigned int virq, 441 + unsigned int nvec); 442 442 void *platform_msi_get_host_data(struct irq_domain *domain); 443 443 #endif /* CONFIG_GENERIC_MSI_IRQ_DOMAIN */ 444 444