Skip to content

Commit 899b5fb

Browse files
hkallweitKAGA-KOKO
authored andcommitted
genirq/devres: Use dev_name(dev) as default for devname
Allow the devname parameter to be NULL and use dev_name(dev) in this case. This should be an appropriate default for most use cases. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: http://lkml.kernel.org/r/05c63d67-30b4-7026-02d5-ce7fb7bc185f@gmail.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent f435da4 commit 899b5fb

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎kernel/irq/devres.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static int devm_irq_match(struct device *dev, void *res, void *data)
3434
* @thread_fn: function to be called in a threaded interrupt context. NULL
3535
* for devices which handle everything in @handler
3636
* @irqflags: Interrupt type flags
37-
* @devname: An ascii name for the claiming device
37+
* @devname: An ascii name for the claiming device, dev_name(dev) if NULL
3838
* @dev_id: A cookie passed back to the handler function
3939
*
4040
* Except for the extra @dev argument, this function takes the
@@ -58,6 +58,9 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
5858
if (!dr)
5959
return -ENOMEM;
6060

61+
if (!devname)
62+
devname = dev_name(dev);
63+
6164
rc = request_threaded_irq(irq, handler, thread_fn, irqflags, devname,
6265
dev_id);
6366
if (rc) {
@@ -81,7 +84,7 @@ EXPORT_SYMBOL(devm_request_threaded_irq);
8184
* @thread_fn: function to be called in a threaded interrupt context. NULL
8285
* for devices which handle everything in @handler
8386
* @irqflags: Interrupt type flags
84-
* @devname: An ascii name for the claiming device
87+
* @devname: An ascii name for the claiming device, dev_name(dev) if NULL
8588
* @dev_id: A cookie passed back to the handler function
8689
*
8790
* Except for the extra @dev argument, this function takes the
@@ -104,6 +107,9 @@ int devm_request_any_context_irq(struct device *dev, unsigned int irq,
104107
if (!dr)
105108
return -ENOMEM;
106109

110+
if (!devname)
111+
devname = dev_name(dev);
112+
107113
rc = request_any_context_irq(irq, handler, irqflags, devname, dev_id);
108114
if (rc < 0) {
109115
devres_free(dr);

0 commit comments

Comments
 (0)