NFC: Fix next target_idx type and rename for clarity
authorEric Lapuyade <eric.lapuyade@intel.com>
Tue, 10 Apr 2012 17:43:10 +0000 (19:43 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 12 Apr 2012 19:10:37 +0000 (15:10 -0400)
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/net/nfc/nfc.h
net/nfc/core.c
net/nfc/rawsock.c

index 45f05634315bfbfcdf3ecf5412869602dc01f4ef..f4f6950a8b05f2ef0adb8b5a0431582cf5410008 100644 (file)
@@ -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;
index d92400087b61ac48feffd5f7af8be163d9b1dcda..db88429cfc1adaa292dbec4461382fc7e6e92885 100644 (file)
@@ -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);
 
index b2825aa85f64cec7fc3c0c52ae4f7bc796beca28..ec1134c9e07fcd34fc5d6116e1a4aef9dedf6f23 100644 (file)
@@ -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;
        }