lirc_dev.c (754451342fc5954061ede74b0a8485ec4a4c6eaa) lirc_dev.c (f4364dcfc86df7c1ca47b256eaf6b6d0cdd0d936)
1/*
2 * LIRC base driver
3 *
4 * by Artur Lipowski <alipowski@interia.pl>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 6 unchanged lines hidden (view full) ---

15 *
16 */
17
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19
20#include <linux/module.h>
21#include <linux/mutex.h>
22#include <linux/device.h>
1/*
2 * LIRC base driver
3 *
4 * by Artur Lipowski <alipowski@interia.pl>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 6 unchanged lines hidden (view full) ---

15 *
16 */
17
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19
20#include <linux/module.h>
21#include <linux/mutex.h>
22#include <linux/device.h>
23#include <linux/file.h>
23#include <linux/idr.h>
24#include <linux/poll.h>
25#include <linux/sched.h>
26#include <linux/wait.h>
27
28#include "rc-core-priv.h"
29#include <uapi/linux/lirc.h>
30

--- 68 unchanged lines hidden (view full) ---

99 }
100
101 sample = ev.pulse ? LIRC_PULSE(ev.duration / 1000) :
102 LIRC_SPACE(ev.duration / 1000);
103 dev_dbg(&dev->dev, "delivering %uus %s to lirc_dev\n",
104 TO_US(ev.duration), TO_STR(ev.pulse));
105 }
106
24#include <linux/idr.h>
25#include <linux/poll.h>
26#include <linux/sched.h>
27#include <linux/wait.h>
28
29#include "rc-core-priv.h"
30#include <uapi/linux/lirc.h>
31

--- 68 unchanged lines hidden (view full) ---

100 }
101
102 sample = ev.pulse ? LIRC_PULSE(ev.duration / 1000) :
103 LIRC_SPACE(ev.duration / 1000);
104 dev_dbg(&dev->dev, "delivering %uus %s to lirc_dev\n",
105 TO_US(ev.duration), TO_STR(ev.pulse));
106 }
107
108 /*
109 * bpf does not care about the gap generated above; that exists
110 * for backwards compatibility
111 */
112 lirc_bpf_run(dev, sample);
113
107 spin_lock_irqsave(&dev->lirc_fh_lock, flags);
108 list_for_each_entry(fh, &dev->lirc_fh, list) {
109 if (LIRC_IS_TIMEOUT(sample) && !fh->send_timeout_reports)
110 continue;
111 if (kfifo_put(&fh->rawir, sample))
112 wake_up_poll(&fh->wait_poll, EPOLLIN | EPOLLRDNORM);
113 }
114 spin_unlock_irqrestore(&dev->lirc_fh_lock, flags);

--- 696 unchanged lines hidden (view full) ---

811}
812
813void __exit lirc_dev_exit(void)
814{
815 class_destroy(lirc_class);
816 unregister_chrdev_region(lirc_base_dev, RC_DEV_MAX);
817}
818
114 spin_lock_irqsave(&dev->lirc_fh_lock, flags);
115 list_for_each_entry(fh, &dev->lirc_fh, list) {
116 if (LIRC_IS_TIMEOUT(sample) && !fh->send_timeout_reports)
117 continue;
118 if (kfifo_put(&fh->rawir, sample))
119 wake_up_poll(&fh->wait_poll, EPOLLIN | EPOLLRDNORM);
120 }
121 spin_unlock_irqrestore(&dev->lirc_fh_lock, flags);

--- 696 unchanged lines hidden (view full) ---

818}
819
820void __exit lirc_dev_exit(void)
821{
822 class_destroy(lirc_class);
823 unregister_chrdev_region(lirc_base_dev, RC_DEV_MAX);
824}
825
826struct rc_dev *rc_dev_get_from_fd(int fd)
827{
828 struct fd f = fdget(fd);
829 struct lirc_fh *fh;
830 struct rc_dev *dev;
831
832 if (!f.file)
833 return ERR_PTR(-EBADF);
834
835 if (f.file->f_op != &lirc_fops) {
836 fdput(f);
837 return ERR_PTR(-EINVAL);
838 }
839
840 fh = f.file->private_data;
841 dev = fh->rc;
842
843 get_device(&dev->dev);
844 fdput(f);
845
846 return dev;
847}
848
819MODULE_ALIAS("lirc_dev");
849MODULE_ALIAS("lirc_dev");