Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b436a13d authored by Samuel Ortiz's avatar Samuel Ortiz
Browse files

NFC: llcp: Only keep raw sockets alive when the LLCP local leaves



When the MAC goes down, connected and connection less sockets should be
notified, but raw sockets should be kept alive.
They will get notified only when the physical devices goes away.

Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 495af72e
Loading
Loading
Loading
Loading
+3 −23
Original line number Original line Diff line number Diff line
@@ -76,7 +76,7 @@ static void nfc_llcp_socket_purge(struct nfc_llcp_sock *sock)
	}
	}
}
}


static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,
static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool device,
				    int err)
				    int err)
{
{
	struct sock *sk;
	struct sock *sk;
@@ -116,23 +116,6 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,


				bh_unlock_sock(accept_sk);
				bh_unlock_sock(accept_sk);
			}
			}

			if (listen == true) {
				nfc_llcp_socket_remote_param_init(llcp_sock);
				bh_unlock_sock(sk);
				continue;
			}
		}

		/*
		 * If we have a connection less socket bound, we keep it alive
		 * if the device is still present.
		 */
		if (sk->sk_state == LLCP_BOUND && sk->sk_type == SOCK_DGRAM &&
		    listen == true) {
			nfc_llcp_socket_remote_param_init(llcp_sock);
			bh_unlock_sock(sk);
			continue;
		}
		}


		if (err)
		if (err)
@@ -147,11 +130,8 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,


	write_unlock(&local->sockets.lock);
	write_unlock(&local->sockets.lock);


	/*
	/* If we still have a device, we keep the RAW sockets alive */
	 * If we want to keep the listening sockets alive,
	if (device == true)
	 * we don't touch the RAW ones.
	 */
	if (listen == true)
		return;
		return;


	write_lock(&local->raw_sockets.lock);
	write_lock(&local->raw_sockets.lock);