aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarod Wilson <jarod@redhat.com>2010-07-29 17:20:44 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-08 22:42:57 -0400
commit82ce67bf262b3f47ecb5a0ca31cace8ac72b7c98 (patch)
treec782cdf8db94f03dbf9d281e7b1c7dbf9c604c0f
parentefce8ca3c5d8a35018f801d687396e1911cfc868 (diff)
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. Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/staging/lirc/lirc_it87.c9
-rw-r--r--drivers/staging/lirc/lirc_parallel.c4
2 files changed, 8 insertions, 5 deletions
diff --git a/drivers/staging/lirc/lirc_it87.c b/drivers/staging/lirc/lirc_it87.c
index 09f36961c6d2..ec11c0e949a0 100644
--- a/drivers/staging/lirc/lirc_it87.c
+++ b/drivers/staging/lirc/lirc_it87.c
@@ -109,6 +109,7 @@ static DECLARE_WAIT_QUEUE_HEAD(lirc_read_queue);
109 109
110static DEFINE_SPINLOCK(hardware_lock); 110static DEFINE_SPINLOCK(hardware_lock);
111static DEFINE_SPINLOCK(dev_lock); 111static DEFINE_SPINLOCK(dev_lock);
112static bool device_open;
112 113
113static int rx_buf[RBUF_LEN]; 114static int rx_buf[RBUF_LEN];
114unsigned int rx_tail, rx_head; 115unsigned int rx_tail, rx_head;
@@ -147,10 +148,11 @@ static void drop_port(void);
147static int lirc_open(struct inode *inode, struct file *file) 148static int lirc_open(struct inode *inode, struct file *file)
148{ 149{
149 spin_lock(&dev_lock); 150 spin_lock(&dev_lock);
150 if (module_refcount(THIS_MODULE)) { 151 if (device_open) {
151 spin_unlock(&dev_lock); 152 spin_unlock(&dev_lock);
152 return -EBUSY; 153 return -EBUSY;
153 } 154 }
155 device_open = true;
154 spin_unlock(&dev_lock); 156 spin_unlock(&dev_lock);
155 return 0; 157 return 0;
156} 158}
@@ -158,6 +160,9 @@ static int lirc_open(struct inode *inode, struct file *file)
158 160
159static int lirc_close(struct inode *inode, struct file *file) 161static int lirc_close(struct inode *inode, struct file *file)
160{ 162{
163 spin_lock(&dev_lock);
164 device_open = false;
165 spin_unlock(&dev_lock);
161 return 0; 166 return 0;
162} 167}
163 168
@@ -363,7 +368,6 @@ static struct lirc_driver driver = {
363}; 368};
364 369
365 370
366#ifdef MODULE
367static int init_chrdev(void) 371static int init_chrdev(void)
368{ 372{
369 driver.minor = lirc_register_driver(&driver); 373 driver.minor = lirc_register_driver(&driver);
@@ -380,7 +384,6 @@ static void drop_chrdev(void)
380{ 384{
381 lirc_unregister_driver(driver.minor); 385 lirc_unregister_driver(driver.minor);
382} 386}
383#endif
384 387
385 388
386/* SECTION: Hardware */ 389/* SECTION: Hardware */
diff --git a/drivers/staging/lirc/lirc_parallel.c b/drivers/staging/lirc/lirc_parallel.c
index a1ebd071640f..6da4a8c6ebc3 100644
--- a/drivers/staging/lirc/lirc_parallel.c
+++ b/drivers/staging/lirc/lirc_parallel.c
@@ -240,7 +240,7 @@ static void irq_handler(void *blah)
240 unsigned int level, newlevel; 240 unsigned int level, newlevel;
241 unsigned int timeout; 241 unsigned int timeout;
242 242
243 if (!module_refcount(THIS_MODULE)) 243 if (!is_open)
244 return; 244 return;
245 245
246 if (!is_claimed) 246 if (!is_claimed)
@@ -515,7 +515,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
515 515
516static int lirc_open(struct inode *node, struct file *filep) 516static int lirc_open(struct inode *node, struct file *filep)
517{ 517{
518 if (module_refcount(THIS_MODULE) || !lirc_claim()) 518 if (is_open || !lirc_claim())
519 return -EBUSY; 519 return -EBUSY;
520 520
521 parport_enable_irq(pport); 521 parport_enable_irq(pport);