Re: [RFC v1 14/25] genirq: Kill the first parameter 'irq' of irq_flow_handler_t
From: Julia Lawall
Date: Sat Jun 13 2015 - 17:43:09 EST
The semantic patch below considers the problem from another point of view,
to find functions that may have a handler as an argument. The results
that are different than those considered already are as follows:
arch/x86/platform/uv/uv_irq.c:106 irq_domain_set_info
has a possible handler in argument 6
arch/sparc/kernel/leon_pci_grpci2.c:815 leon_update_virq_handling
has a possible handler in argument 2
arch/sparc/kernel/leon_kernel.c:79 leon_build_device_irq
has a possible handler in argument 2
arch/arm/mach-omap2/prm_common.c:331 irq_alloc_generic_chip
has a possible handler in argument 5
arch/mips/cavium-octeon/octeon-irq.c:1231 octeon_irq_set_ciu_mapping
has a possible handler in argument 6
arch/blackfin/mach-common/ints-priority.c:805 bfin_set_irq_handler
has a possible handler in argument 2
arch/m68k/q40/q40ints.c:84 m68k_setup_irq_controller
has a possible handler in argument 2
drivers/gpio/gpio-pcf857x.c:362 gpiochip_irqchip_add
has a possible handler in argument 4
The semantic patch looks for a function that has as argument a function
that has arguments of type (unsigned int irq, struct irq_desc *desc) and a
void return type. It also looks for functions that have as argument a
bunch of known irq handlers.
julia
@initialize:ocaml@
@@
let tbl = Hashtbl.create 101
let ln = Str.regexp "linux-next/" (* update as appropriate *)
let _ =
List.iter (function x -> Hashtbl.add tbl x ())
[("__irq_set_handler",2);("irq_set_handler",2);
("irq_set_chained_handler",2);("irq_alloc_generic_chip",4);
("irq_alloc_domain_generic_chips",5);("irq_set_chip_and_handler_name",3);
("irq_set_chip_and_handler",3);("__irq_set_handler_locked",2);
("__irq_set_chip_handler_name_locked",3);("__irq_set_preflow_handler",2);
("gpiochip_set_chained_irqchip",4)]
let update g f n p =
let n = n + 1 in
let entry = (g,n) in
try let _ = Hashtbl.find tbl entry in ()
with Not_found ->
begin
Hashtbl.add tbl entry ();
let p = List.hd p in
Printf.printf "%s:%d %s\n\thas a possible handler in argument %d\n"
(List.nth (Str.split ln p.file) 1) p.line g
n
end
@possible_handler@
identifier f,irq,desc;
@@
void f(unsigned int irq, struct irq_desc *desc) { ... }
@call@
identifier g,possible_handler.f;
expression list[n] es;
position p;
@@
g(es,f@p,...)
@script:ocaml@
p << call.p;
f << possible_handler.f;
g << call.g;
n << call.n;
@@
update g f n p
@call2@
identifier g,f;
expression list[n] es;
position p;
symbol handle_level_irq,handle_simple_irq,handle_edge_irq,
handle_fasteoi_irq,handle_percpu_irq;
@@
g(es,\(handle_level_irq@f@p\|handle_simple_irq@f@p\|handle_edge_irq@f@p\|
handle_fasteoi_irq@f@p\|handle_percpu_irq@f@p\),...)
@script:ocaml@
p << call2.p;
f << call2.f;
g << call2.g;
n << call2.n;
@@
update g f n p
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/