Return-path: Received: from mga03.intel.com ([143.182.124.21]:5781 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753014Ab2CWKpa (ORCPT ); Fri, 23 Mar 2012 06:45:30 -0400 Message-ID: <4F6C547F.50402@linux.intel.com> (sfid-20120323_114545_902272_B14081ED) Date: Fri, 23 Mar 2012 11:46:23 +0100 From: Eric Lapuyade MIME-Version: 1.0 To: linux-wireless@vger.kernel.org CC: Lauro Ramos Venancio , Aloisio Almeida Jr , Samuel Ortiz Subject: [PATCH] NFC: Fix next target_idx type and rename for clarity Content-Type: text/plain; charset=UTF-8 Sender: linux-wireless-owner@vger.kernel.org List-ID: There are many idx in this code, so make it clearer that this one is the base for the next target that will be discoved. Signed-off-by: Eric Lapuyade Signed-off-by: Samuel Ortiz --- include/net/nfc/nfc.h | 2 +- net/nfc/core.c | 2 +- net/nfc/rawsock.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 45f0563..f4f6950 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h @@ -89,7 +89,7 @@ struct nfc_genl_data { struct nfc_dev { unsigned idx; - unsigned target_idx; + u32 target_next_idx; struct nfc_target *targets; int n_targets; int targets_generation; diff --git a/net/nfc/core.c b/net/nfc/core.c index 2818582..d3a2cfb 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c @@ -435,7 +435,7 @@ int nfc_targets_found(struct nfc_dev *dev, dev->polling = false; for (i = 0; i < n_targets; i++) - targets[i].idx = dev->target_idx++; + targets[i].idx = dev->target_next_idx++; spin_lock_bh(&dev->targets_lock); diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c index b2825aa..ec1134c 100644 --- a/net/nfc/rawsock.c +++ b/net/nfc/rawsock.c @@ -92,8 +92,8 @@ static int rawsock_connect(struct socket *sock, struct sockaddr *_addr, goto error; } - if (addr->target_idx > dev->target_idx - 1 || - addr->target_idx < dev->target_idx - dev->n_targets) { + if (addr->target_idx > dev->target_next_idx - 1 || + addr->target_idx < dev->target_next_idx - dev->n_targets) { rc = -EINVAL; goto error; } -- 1.7.6.5