Linux Audio

Check our new training course

Loading...
v3.1
 
 1/*
 2 * Copyright IBM Corp. 2001,2008
 3 *
 4 * This file contains the IRQ specific code for hvc_console
 5 *
 6 */
 7
 8#include <linux/interrupt.h>
 9
10#include "hvc_console.h"
11
12static irqreturn_t hvc_handle_interrupt(int irq, void *dev_instance)
13{
14	/* if hvc_poll request a repoll, then kick the hvcd thread */
15	if (hvc_poll(dev_instance))
16		hvc_kick();
 
 
 
 
 
17	return IRQ_HANDLED;
18}
19
20/*
21 * For IRQ based systems these callbacks can be used
22 */
23int notifier_add_irq(struct hvc_struct *hp, int irq)
24{
25	int rc;
26
27	if (!irq) {
28		hp->irq_requested = 0;
29		return 0;
30	}
31	rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED,
32			   "hvc_console", hp);
33	if (!rc)
34		hp->irq_requested = 1;
35	return rc;
36}
37
38void notifier_del_irq(struct hvc_struct *hp, int irq)
39{
40	if (!hp->irq_requested)
41		return;
42	free_irq(irq, hp);
43	hp->irq_requested = 0;
44}
45
46void notifier_hangup_irq(struct hvc_struct *hp, int irq)
47{
48	notifier_del_irq(hp, irq);
49}
v4.17
 1// SPDX-License-Identifier: GPL-2.0
 2/*
 3 * Copyright IBM Corp. 2001,2008
 4 *
 5 * This file contains the IRQ specific code for hvc_console
 6 *
 7 */
 8
 9#include <linux/interrupt.h>
10
11#include "hvc_console.h"
12
13static irqreturn_t hvc_handle_interrupt(int irq, void *dev_instance)
14{
15	/* if hvc_poll request a repoll, then kick the hvcd thread */
16	if (hvc_poll(dev_instance))
17		hvc_kick();
18
19	/*
20	 * We're safe to always return IRQ_HANDLED as the hvcd thread will
21	 * iterate through each hvc_struct.
22	 */
23	return IRQ_HANDLED;
24}
25
26/*
27 * For IRQ based systems these callbacks can be used
28 */
29int notifier_add_irq(struct hvc_struct *hp, int irq)
30{
31	int rc;
32
33	if (!irq) {
34		hp->irq_requested = 0;
35		return 0;
36	}
37	rc = request_irq(irq, hvc_handle_interrupt, hp->flags,
38			"hvc_console", hp);
39	if (!rc)
40		hp->irq_requested = 1;
41	return rc;
42}
43
44void notifier_del_irq(struct hvc_struct *hp, int irq)
45{
46	if (!hp->irq_requested)
47		return;
48	free_irq(irq, hp);
49	hp->irq_requested = 0;
50}
51
52void notifier_hangup_irq(struct hvc_struct *hp, int irq)
53{
54	notifier_del_irq(hp, irq);
55}