From 7757dc8a3e7658abb6e5fc7d825a38b27961d0c8 Mon Sep 17 00:00:00 2001
From: Samuel Ortiz <sameo@linux.intel.com>
Date: Wed, 10 Apr 2013 12:25:30 +0200
Subject: NFC: Prevent polling when device is down

Some devices turn radio on whenever they're asked to start a poll.
To prevent that from happening, we just don't call into the driver
start_poll hook when the NFC device is down.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
---
 net/nfc/core.c | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'net/nfc')

diff --git a/net/nfc/core.c b/net/nfc/core.c
index 6ceee8e181c..c571ca9a960 100644
--- a/net/nfc/core.c
+++ b/net/nfc/core.c
@@ -143,6 +143,11 @@ int nfc_start_poll(struct nfc_dev *dev, u32 im_protocols, u32 tm_protocols)
 		goto error;
 	}
 
+	if (!dev->dev_up) {
+		rc = -ENODEV;
+		goto error;
+	}
+
 	if (dev->polling) {
 		rc = -EBUSY;
 		goto error;
-- 
cgit v1.2.3-70-g09d2