public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Cc: linux-i2c@vger.kernel.org, sameo@linux.intel.com,
	linux-kernel@vger.kernel.org, hthebaud@insidefr.com,
	matti.j.aaltonen@nokia.com, Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip
Date: Fri, 18 Mar 2011 13:19:53 +0100	[thread overview]
Message-ID: <201103181319.54191.arnd@arndb.de> (raw)
In-Reply-To: <1300444824-13713-2-git-send-email-waldemar.rymarkiewicz@tieto.com>

On Friday 18 March 2011, Waldemar Rymarkiewicz wrote:
> Add new driver for MicroRead NFC chip connected to i2c bus.
> 
> See Documentation/nfc/nfc-microread.txt.

As I said in my first review and Alan also pointed out now, the
most important change will be to add a common NFC core layer,
before adding more hardware drivers.

Also, regarding the user interface, we need to be really sure
that this is the best way of talking to NFC devices. The interface
you have today is a simple character device read/write kind,
which may be the best thing if the protocol stack on top is
really simple and there is never the need to have multiple
applications talking to different endpoints on the wireless
interface, and if there are no protocol headers being
send over the character device interface.

Otherwise, a better interface is probably to add a new network
socket family and abstract the protocol layers in the kernel.
Can you explain in more depth what the kind of data is on
this interface?

A few more things I noticed when reading through the driver
again:

> +const struct file_operations microread_fops = {
> +	.owner		= THIS_MODULE,
> +	.open		= microread_open,
> +	.release	= microread_release,
> +	.read		= microread_read,
> +	.write		= microread_write,
> +	.poll		= microread_poll,
> +	.unlocked_ioctl	= microread_ioctl,
> +};

As I said, all the file operations need to move to the core module.
Also, this is missing a compat_ioctl function.

> +static irqreturn_t microread_irq(int irq, void *dev)
> +{
> +	struct microread_info *info = dev;
> +	struct i2c_client *client = info->i2c_dev;
> +
> +	dev_dbg(&client->dev, "irq: info %p client %p ", info,	client);
> +
> +	if (irq != client->irq)
> +		return IRQ_NONE;
> +
> +	mutex_lock(&info->rx_mutex);
> +	info->irq_state = 1;
> +	mutex_unlock(&info->rx_mutex);
> +
> +	wake_up_interruptible(&info->rx_waitq);
> +
> +	return IRQ_HANDLED;
> +}

You cannot take a mutex from interrupt context, that may
cause deadlocks.


> diff --git a/include/linux/nfc/microread.h b/include/linux/nfc/microread.h
> new file mode 100644
> index 0000000..a0ad68e
> --- /dev/null
> +++ b/include/linux/nfc/microread.h

Please split this header file into an include/linux/nfc.h file
and the file with the platform data in include/linux/platform_data/microread.h

Do not define any ioctls that are not used.

	Arnd

  parent reply	other threads:[~2011-03-18 12:20 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-18 10:40 [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip Waldemar Rymarkiewicz
2011-03-18 10:40 ` Waldemar Rymarkiewicz
2011-03-18 11:03   ` Alan Cox
2011-03-18 15:00     ` Waldemar.Rymarkiewicz
2011-03-18 15:05       ` Arnd Bergmann
2011-03-18 15:12       ` Alan Cox
2011-03-18 15:15         ` Waldemar.Rymarkiewicz
2011-03-18 11:49   ` Wolfram Sang
2011-03-18 15:08     ` Waldemar.Rymarkiewicz
2011-03-18 15:31       ` Mark Brown
2011-03-18 16:43     ` Waldemar.Rymarkiewicz
2011-03-18 12:19   ` Arnd Bergmann [this message]
2011-03-18 12:51     ` Mark Brown
2011-03-18 14:20       ` Arnd Bergmann
2011-03-25 14:26     ` Samuel Ortiz
2011-03-29  8:00       ` Waldemar.Rymarkiewicz
2011-03-29 11:05         ` Arnd Bergmann
2011-03-29 11:59           ` Alan Cox
2011-03-29 12:04             ` Arnd Bergmann
2011-03-29 12:23               ` Alan Cox
2011-03-29 13:22                 ` Arnd Bergmann
2011-03-31 14:16           ` Samuel Ortiz
2011-03-31 14:42             ` Waldemar.Rymarkiewicz
2011-03-31 14:49               ` Arnd Bergmann
2011-03-31 15:09               ` Samuel Ortiz
2011-03-31 15:24                 ` Waldemar.Rymarkiewicz
2011-03-31 15:30                   ` Samuel Ortiz
2011-04-01 18:19                     ` Aloisio Almeida
2011-04-01 19:43                       ` Arnd Bergmann
2011-06-06 20:22                     ` Pavan Savoy
2011-06-06 20:30                       ` Pavan Savoy
2011-06-06 20:46                         ` Aloisio Almeida
2011-06-06 20:50                       ` Samuel Ortiz
2011-03-18 15:50   ` Randy Dunlap
2011-03-18 15:57     ` Waldemar.Rymarkiewicz
  -- strict thread matches above, loose matches on Subject: below --
2011-03-10 14:20 Waldemar Rymarkiewicz
2011-03-10 13:52 ` Arnd Bergmann
2011-03-10 14:45   ` Waldemar.Rymarkiewicz
2011-03-10 16:20     ` Arnd Bergmann
2011-03-14 14:59       ` Waldemar.Rymarkiewicz
2011-03-14 15:34         ` Arnd Bergmann
2011-03-14 15:45           ` Waldemar.Rymarkiewicz
2011-03-14 16:00             ` Arnd Bergmann
2011-03-14 16:15               ` Waldemar.Rymarkiewicz
2011-03-14 17:01                 ` Arnd Bergmann
2011-03-15  8:37                   ` Waldemar.Rymarkiewicz
2011-03-15  9:06                     ` Arnd Bergmann
2011-03-17 12:58       ` Waldemar.Rymarkiewicz
2011-03-17 13:07         ` Arnd Bergmann
2011-03-17 13:38           ` Waldemar.Rymarkiewicz
2011-03-17 13:54             ` Arnd Bergmann
2011-03-17 13:58               ` Waldemar.Rymarkiewicz

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=201103181319.54191.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=hthebaud@insidefr.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.j.aaltonen@nokia.com \
    --cc=sameo@linux.intel.com \
    --cc=waldemar.rymarkiewicz@tieto.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