timer-of.c (4f2c0a4acffbec01079c28f839422e64ddeff004) | timer-of.c (7eeb7189c4d4b258fc80435a98181735e710f02f) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (c) 2017, Linaro Ltd. All rights reserved. 4 * 5 * Author: Daniel Lezcano <daniel.lezcano@linaro.org> 6 */ 7#include <linux/clk.h> 8#include <linux/interrupt.h> --- 11 unchanged lines hidden (view full) --- 20 * Free the irq resource 21 */ 22static __init void timer_of_irq_exit(struct of_timer_irq *of_irq) 23{ 24 struct timer_of *to = container_of(of_irq, struct timer_of, of_irq); 25 26 struct clock_event_device *clkevt = &to->clkevt; 27 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (c) 2017, Linaro Ltd. All rights reserved. 4 * 5 * Author: Daniel Lezcano <daniel.lezcano@linaro.org> 6 */ 7#include <linux/clk.h> 8#include <linux/interrupt.h> --- 11 unchanged lines hidden (view full) --- 20 * Free the irq resource 21 */ 22static __init void timer_of_irq_exit(struct of_timer_irq *of_irq) 23{ 24 struct timer_of *to = container_of(of_irq, struct timer_of, of_irq); 25 26 struct clock_event_device *clkevt = &to->clkevt; 27 |
28 if (of_irq->percpu) 29 free_percpu_irq(of_irq->irq, clkevt); 30 else 31 free_irq(of_irq->irq, clkevt); | 28 free_irq(of_irq->irq, clkevt); |
32} 33 34/** 35 * timer_of_irq_init - Request the interrupt 36 * @np: a device tree node pointer 37 * @of_irq: an of_timer_irq structure pointer 38 * 39 * Get the interrupt number from the DT from its definition and 40 * request it. The interrupt is gotten by falling back the following way: 41 * 42 * - Get interrupt number by name 43 * - Get interrupt number by index 44 * | 29} 30 31/** 32 * timer_of_irq_init - Request the interrupt 33 * @np: a device tree node pointer 34 * @of_irq: an of_timer_irq structure pointer 35 * 36 * Get the interrupt number from the DT from its definition and 37 * request it. The interrupt is gotten by falling back the following way: 38 * 39 * - Get interrupt number by name 40 * - Get interrupt number by index 41 * |
45 * When the interrupt is per CPU, 'request_percpu_irq()' is called, 46 * otherwise 'request_irq()' is used. 47 * | |
48 * Returns 0 on success, < 0 otherwise 49 */ 50static __init int timer_of_irq_init(struct device_node *np, 51 struct of_timer_irq *of_irq) 52{ 53 int ret; 54 struct timer_of *to = container_of(of_irq, struct timer_of, of_irq); 55 struct clock_event_device *clkevt = &to->clkevt; --- 8 unchanged lines hidden (view full) --- 64 } else { 65 of_irq->irq = irq_of_parse_and_map(np, of_irq->index); 66 } 67 if (!of_irq->irq) { 68 pr_err("Failed to map interrupt for %pOF\n", np); 69 return -EINVAL; 70 } 71 | 42 * Returns 0 on success, < 0 otherwise 43 */ 44static __init int timer_of_irq_init(struct device_node *np, 45 struct of_timer_irq *of_irq) 46{ 47 int ret; 48 struct timer_of *to = container_of(of_irq, struct timer_of, of_irq); 49 struct clock_event_device *clkevt = &to->clkevt; --- 8 unchanged lines hidden (view full) --- 58 } else { 59 of_irq->irq = irq_of_parse_and_map(np, of_irq->index); 60 } 61 if (!of_irq->irq) { 62 pr_err("Failed to map interrupt for %pOF\n", np); 63 return -EINVAL; 64 } 65 |
72 ret = of_irq->percpu ? 73 request_percpu_irq(of_irq->irq, of_irq->handler, 74 np->full_name, clkevt) : 75 request_irq(of_irq->irq, of_irq->handler, 76 of_irq->flags ? of_irq->flags : IRQF_TIMER, 77 np->full_name, clkevt); | 66 ret = request_irq(of_irq->irq, of_irq->handler, 67 of_irq->flags ? of_irq->flags : IRQF_TIMER, 68 np->full_name, clkevt); |
78 if (ret) { 79 pr_err("Failed to request irq %d for %pOF\n", of_irq->irq, np); 80 return ret; 81 } 82 83 clkevt->irq = of_irq->irq; 84 85 return 0; --- 145 unchanged lines hidden --- | 69 if (ret) { 70 pr_err("Failed to request irq %d for %pOF\n", of_irq->irq, np); 71 return ret; 72 } 73 74 clkevt->irq = of_irq->irq; 75 76 return 0; --- 145 unchanged lines hidden --- |