linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Jarod Wilson <jarod@redhat.com>
Cc: sfr@canb.auug.org.au, lirc-list@lists.sourceforge.net,
	linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, mchehab@redhat.com
Subject: Re: [PATCH] staging/lirc: fix non-CONFIG_MODULES build horkage
Date: Thu, 29 Jul 2010 09:24:48 -0700	[thread overview]
Message-ID: <4C51AB50.9040701@oracle.com> (raw)
In-Reply-To: <20100729153535.GB7507@redhat.com>

On 07/29/10 08:35, Jarod Wilson wrote:
> 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.
> 
> Signed-off-by: Jarod Wilson <jarod@redhat.com>

Acked-by: Randy Dunlap <randy.dunlap@oracle.com>

Thanks.

> ---
>  drivers/staging/lirc/lirc_it87.c     |    9 ++++++---
>  drivers/staging/lirc/lirc_parallel.c |    4 ++--
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/lirc/lirc_it87.c b/drivers/staging/lirc/lirc_it87.c
> index 781abc3..72f07f1 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);
>  
>  static DEFINE_SPINLOCK(hardware_lock);
>  static DEFINE_SPINLOCK(dev_lock);
> +static bool device_open;
>  
>  static int rx_buf[RBUF_LEN];
>  unsigned int rx_tail, rx_head;
> @@ -147,10 +148,11 @@ static void drop_port(void);
>  static int lirc_open(struct inode *inode, struct file *file)
>  {
>  	spin_lock(&dev_lock);
> -	if (module_refcount(THIS_MODULE)) {
> +	if (device_open) {
>  		spin_unlock(&dev_lock);
>  		return -EBUSY;
>  	}
> +	device_open = true;
>  	spin_unlock(&dev_lock);
>  	return 0;
>  }
> @@ -158,6 +160,9 @@ static int lirc_open(struct inode *inode, struct file *file)
>  
>  static int lirc_close(struct inode *inode, struct file *file)
>  {
> +	spin_lock(&dev_lock);
> +	device_open = false;
> +	spin_unlock(&dev_lock);
>  	return 0;
>  }
>  
> @@ -363,7 +368,6 @@ static struct lirc_driver driver = {
>  };
>  
>  
> -#ifdef MODULE
>  static int init_chrdev(void)
>  {
>  	driver.minor = lirc_register_driver(&driver);
> @@ -380,7 +384,6 @@ static void drop_chrdev(void)
>  {
>  	lirc_unregister_driver(driver.minor);
>  }
> -#endif
>  
>  
>  /* SECTION: Hardware */
> diff --git a/drivers/staging/lirc/lirc_parallel.c b/drivers/staging/lirc/lirc_parallel.c
> index df12e7b..04ce97713 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)
>  	unsigned int level, newlevel;
>  	unsigned int timeout;
>  
> -	if (!module_refcount(THIS_MODULE))
> +	if (!is_open)
>  		return;
>  
>  	if (!is_claimed)
> @@ -515,7 +515,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
>  
>  static int lirc_open(struct inode *node, struct file *filep)
>  {
> -	if (module_refcount(THIS_MODULE) || !lirc_claim())
> +	if (is_open || !lirc_claim())
>  		return -EBUSY;
>  
>  	parport_enable_irq(pport);
> 
> 


-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

  reply	other threads:[~2010-07-29 16:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-28  6:28 linux-next: Tree for July 28 Stephen Rothwell
2010-07-28 17:13 ` linux-next: Tree for July 28 (lirc) Randy Dunlap
2010-07-29 15:35   ` [PATCH] staging/lirc: fix non-CONFIG_MODULES build horkage Jarod Wilson
2010-07-29 16:24     ` Randy Dunlap [this message]
2010-07-28 17:16 ` [PATCH -next] staging/quickstart: depends on INPUT Randy Dunlap
2010-07-28 17:24 ` linux-next: Tree for July 28 (lirc #2) Randy Dunlap
2010-07-28 22:04   ` Janne Grunau
2010-07-28 22:16     ` Randy Dunlap
2010-07-28 22:27       ` Jarod Wilson
2010-07-29  4:27         ` Jarod Wilson
2010-07-29 12:39           ` Janne Grunau
2010-07-29 15:11             ` Jarod Wilson
2010-07-29 16:25             ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C51AB50.9040701@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=jarod@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=lirc-list@lists.sourceforge.net \
    --cc=mchehab@redhat.com \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).