History

V4L/DVB: staging/lirc: fix non-CONFIG_MODULES build horkage

Fix when CONFIG_MODULES is not enabled: drivers/staging/lirc/lirc_parallel.c:243: error: implicit declaration of function 'module_refcount' drivers/staging/lirc/lirc_it87.c:150: error: implicit declaration of function 'module_refcount' drivers/built-in.o: In function `it87_probe': lirc_it87.c:(.text+0x4079b0): undefined reference to `init_chrdev' lirc_it87.c:(.text+0x4079cc): undefined reference to `drop_chrdev' drivers/built-in.o: In function `lirc_it87_exit': lirc_it87.c:(.exit.text+0x38a5): undefined reference to `drop_chrdev' Its a quick hack and untested beyond building, since I don't have the hardware, but it should do the trick.

Jarod Wilson committed 16 years ago

Commit 82ce67b1 parent efce8ca2 files · +8 −5Browse files

Showing the changes to drivers/staging/lirc/lirc_it87.c (1 of 2 files). Show all

Unified · Split

drivers/staging/lirc/lirc_it87.c+6−3
@@ -109,6 +109,7 @@ static DECLARE_WAIT_QUEUE_HEAD(lirc_read_queue); · 108 unmodified lines
109109
110110 static DEFINE_SPINLOCK(hardware_lock);
111111 static DEFINE_SPINLOCK(dev_lock);
112+static bool device_open;
112113
113114 static int rx_buf[RBUF_LEN];
114115 unsigned int rx_tail, rx_head;
@@ -147,10 +148,11 @@ static void drop_port(void); · 32 unmodified lines
147148 static int lirc_open(struct inode *inode, struct file *file)
148149 {
149150 spin_lock(&dev_lock);
150− if (module_refcount(THIS_MODULE)) {
151+ if (device_open) {
151152 spin_unlock(&dev_lock);
152153 return -EBUSY;
153154 }
155+ device_open = true;
154156 spin_unlock(&dev_lock);
155157 return 0;
156158 }
@@ -158,6 +160,9 @@ static int lirc_open(struct inode *inode, struct file *file) · 1 unmodified line
158160
159161 static int lirc_close(struct inode *inode, struct file *file)
160162 {
163+ spin_lock(&dev_lock);
164+ device_open = false;
165+ spin_unlock(&dev_lock);
161166 return 0;
162167 }
163168
@@ -363,7 +368,6 @@ static struct lirc_driver driver = { · 199 unmodified lines
363368 };
364369
365370
366−#ifdef MODULE
367371 static int init_chrdev(void)
368372 {
369373 driver.minor = lirc_register_driver(&driver);
@@ -380,7 +384,6 @@ static void drop_chrdev(void) · 10 unmodified lines
380384 {
381385 lirc_unregister_driver(driver.minor);
382386 }
383−#endif
384387
385388
386389 /* SECTION: Hardware */