| 1 |
The semantic patch that does transformation first checks that |
| 2 |
linux/interrupt.h is included. This header file specifies the type of |
| 3 |
request_irq. There are multiple definitions of request_irq and the |
| 4 |
ones in the following two files still expect a parameter with a |
| 5 |
pt_regs-typed parameter. Nevertheless, these files also include |
| 6 |
linux/interrupt.h, and so it seems that the definitions should be changed |
| 7 |
accordingly. |
| 8 |
|
| 9 |
arch/h8300/platform/h8s/ints.c |
| 10 |
arch/arm26/kernel/irq.c |
| 11 |
|
| 12 |
The semantic patch then identifies an interrupt handler function as |
| 13 |
one that is passed to request_irq, checks that the definition of this |
| 14 |
function is static (so we don't have to worry about calls to it from other |
| 15 |
files), updates its parameter list if there are no references to its regs |
| 16 |
parameter, updates any calls to it where the last argument is NULL, and |
| 17 |
inserts a warning message in any calls that have a non-NULL argument. The |
| 18 |
purpose of the warning, rather than just dropping the argument, is that |
| 19 |
dropping the argument may cause some variables to no longer be used, and |
| 20 |
thus other changes might be useful. However, in the files that trigger the |
| 21 |
collateral evolution there is never a direct call to the interrupt handling |
| 22 |
function, either with NULL or some other value as the final argument. |
| 23 |
|
| 24 |
|
| 25 |
The sgrep semantic patch detects the negation of the above: cases where |
| 26 |
either linux/interrupt.h is not included, or the interrupt handling |
| 27 |
function is not static, or the interrupt handling function uses its |
| 28 |
pt_regs-typed parameter. |
| 29 |
|
| 30 |
|
| 31 |
Files that are transformed: |
| 32 |
--- /home/julia/linux-2.6/arch/cris/arch-v10/drivers/gpio.c |
| 33 |
--- /home/julia/linux-2.6/arch/cris/arch-v10/kernel/fasttimer.c |
| 34 |
--- /home/julia/linux-2.6/arch/cris/arch-v32/drivers/cryptocop.c |
| 35 |
--- /home/julia/linux-2.6/arch/cris/arch-v32/drivers/gpio.c |
| 36 |
--- /home/julia/linux-2.6/arch/cris/arch-v32/drivers/sync_serial.c |
| 37 |
--- /home/julia/linux-2.6/arch/cris/arch-v32/kernel/fasttimer.c |
| 38 |
In all of the above, the transformation applies straightforwardly. The |
| 39 |
interrupt handling function is static and it does not use its |
| 40 |
pt_regs-typed parameter. |
| 41 |
|
| 42 |
--- /home/julia/linux-2.6/arch/cris/kernel/irq.c |
| 43 |
In this file the change is to remove the pt_regs-typed argument from |
| 44 |
__do_IRQ. The enclosing function now has no need for the pt_regs-typed |
| 45 |
parameter, but we have not constructed the semantic patch to transform |
| 46 |
it and its callers. Indeed, its callers appear never to be called |
| 47 |
themselves. |
| 48 |
|
| 49 |
--- /home/julia/linux-2.6/arch/v850/kernel/gbus_int.c |
| 50 |
In this file the interrupt handling function calls handle_irq with its |
| 51 |
pt_regs-typed argument. But handle_irq doesn't need this argument, as |
| 52 |
noted below. |
| 53 |
|
| 54 |
--- /home/julia/linux-2.6/arch/v850/kernel/irq.c |
| 55 |
This file contains the definition of handle_irq. It passes its |
| 56 |
pt_regs-typed argument to the function __do_IRQ. But __do_IRQ no |
| 57 |
longer wants a pt_regs-typed argument either. And so we can remove it |
| 58 |
from both the call and the parameter list, enabling the transformation |
| 59 |
in gbus_int.c and rte_me2_cb.c. |
| 60 |
PROBLEM: The .h file should have been updated as well, but this does |
| 61 |
not seem to have been done. |
| 62 |
|
| 63 |
--- /home/julia/linux-2.6/arch/v850/kernel/rte_me2_cb.c |
| 64 |
In this file the interrupt handling function calls handle_irq with its |
| 65 |
pt_regs-typed argument. But handle_irq doesn't need this argument, as |
| 66 |
noted above. |
| 67 |
|
| 68 |
--- /home/julia/linux-2.6/drivers/spi/au1550_spi.c |
| 69 |
This file was added to the Linux kernel source tree quite recently: |
| 70 |
commit 63bd23591e6c3891d34e4c6dba7c6aa41b05caad |
| 71 |
Author: Jan Nikitenko <[email protected]> |
| 72 |
Date: Tue May 8 00:32:25 2007 -0700 |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
Other cases, noted by sgrep: |
| 77 |
--- /home/julia/linux-2.6/arch/cris/arch-v32/kernel/arbiter.c |
| 78 |
In this case, the transformation should apply, but the pt_regs-typed |
| 79 |
parameter is used in what appears to be debugging code, which has to be |
| 80 |
changed by hand. |
| 81 |
|
| 82 |
--- /home/julia/linux-2.6/arch/m68knommu/kernel/comempci.c |
| 83 |
In this case, the interrupt handler has the wrong signature, as it |
| 84 |
returns void rather than irqreturn_t. Perhaps this file is dead code. |
| 85 |
|
| 86 |
--- /home/julia/linux-2.6/arch/blackfin/oprofile/timer_int.c |
| 87 |
In this case, the file doesn't (directly) include linux/interrupt.h. |
| 88 |
It is not clear what definition of request_irq is being used and thus |
| 89 |
what type is expected for the interrupt handling function |