mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: Matthew Garrett <matthew.garrett@nebula.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, linux-doc@vger.kernel.org,
	Sonal Santan <sonal.santan@gmail.com>
Subject: Re: [PATCH 1/2] platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
Date: Wed, 7 May 2014 17:29:41 +0100	[thread overview]
Message-ID: <20140507172941.66aca8fa@alan.etchedpixels.co.uk> (raw)
In-Reply-To: <1399114077-19314-2-git-send-email-pali.rohar@gmail.com>

> +static irqreturn_t smo8800_interrupt_quick(int irq, void *data)
> +{
> +	struct smo8800_device *smo8800 = data;
> +	atomic_inc(&smo8800->count);
> +	wake_up_interruptible(&smo8800->misc_wait);
> +	return IRQ_WAKE_THREAD;
> +}
> +
> +static irqreturn_t smo8800_interrupt_thread(int irq, void *data)
> +{
> +	struct smo8800_device *smo8800 = data;
> +	dev_info(smo8800->dev, "detected free fall\n");

printk should be fast enough not to justify a thread, in fact the
threaded IRQ overhead is going to be higher than the printk IMHO.

I'm not entirely sure a printk is the useful response here either ?


> +static ssize_t smo8800_misc_read(struct file *file, char __user *buf,
> +				 size_t count, loff_t *pos)
> +{
> +	struct smo8800_device *smo8800 = container_of(file->private_data,
> +					 struct smo8800_device, miscdev);
> +
> +	DECLARE_WAITQUEUE(wait, current);
> +	u32 data;
> +	unsigned char byte_data;
> +	ssize_t retval = 1;
> +
> +	if (count < 1)
> +		return -EINVAL;

How can this occur ??

> +
> +	add_wait_queue(&smo8800->misc_wait, &wait);
> +	while (true) {
> +		set_current_state(TASK_INTERRUPTIBLE);
> +		data = atomic_xchg(&smo8800->count, 0);
> +		if (data)
> +			break;
> +
> +		if (file->f_flags & O_NONBLOCK) {
> +			retval = -EAGAIN;
> +			goto out;
> +		}
> +
> +		if (signal_pending(current)) {
> +			retval = -ERESTARTSYS;
> +			goto out;
> +		}
> +
> +		schedule();
> +	}

wait_event_interruptible ?

> +	if (copy_to_user(buf, &byte_data, sizeof(byte_data)))
> +		retval = -EFAULT;

put_user


> +static int smo8800_add(struct acpi_device *device)
> +{
> +	int err;
> +	struct smo8800_device *smo8800;
> +
> +	if (!device)
> +		return -EINVAL;

How can this occur ??

> +	atomic_set(&smo8800->count, 0);

Not needed - you can't see a count until it is open

> +	dev_info(&device->dev, "device /dev/freefall registered with IRQ %d\n",
> +		 smo8800->irq);

dev_dbg would be more appropriate. If every driver reported its
registration we'd drown in logs

> +	dev_info(&device->dev, "device /dev/freefall unregistered\n");

Ditto


Alan

  reply	other threads:[~2014-05-07 16:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-03 10:47 [PATCH 0/2] " Pali Rohár
2014-05-03 10:47 ` [PATCH 1/2] platform: x86: dell-smo8800: " Pali Rohár
2014-05-07 16:29   ` One Thousand Gnomes [this message]
2014-05-20  7:00   ` Valdis.Kletnieks
2014-05-20  8:56     ` Pali Rohár
2014-05-20 18:02       ` Valdis.Kletnieks
2014-05-20 18:10         ` Pali Rohár
2014-05-20 18:36           ` Valdis.Kletnieks
2014-05-22 11:15   ` [PATCH v2] " Pali Rohár
2014-05-28 13:31     ` Pali Rohár
2014-06-06 10:24       ` Pali Rohár
2014-05-03 10:47 ` [PATCH 2/2] Documentation: Rename hpfall.c => freefall.c, fixes for Dell Pali Rohár
2014-06-11  8:02   ` [PATCH v2] " Pali Rohár
2014-06-14  8:53     ` Pavel Machek
2014-06-16 11:55       ` Pali Rohár
2014-06-27 19:08         ` Pali Rohár
2014-06-27 20:25           ` Randy Dunlap
2014-06-29  2:12     ` Randy Dunlap
2014-07-07 18:15       ` Pali Rohár
2014-07-08 22:49         ` 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=20140507172941.66aca8fa@alan.etchedpixels.co.uk \
    --to=gnomes@lxorguk.ukuu.org.uk \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.garrett@nebula.com \
    --cc=pali.rohar@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=sonal.santan@gmail.com \
    /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

all inboxes | Powered by JetHome®