Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4130480ybe; Mon, 9 Sep 2019 04:50:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCQ0an4mqT6RO4y0ZoxS1jXicambBRwCrk9hUX+72i4PRunPfPfzVOART5afEYyJ500Qbv X-Received: by 2002:a50:e005:: with SMTP id e5mr23636660edl.279.1568029858657; Mon, 09 Sep 2019 04:50:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568029858; cv=none; d=google.com; s=arc-20160816; b=lmBJwRnxpRQxVXiyN4kgY/sR4CMbZFyueIk1eJfO27kQuTutTxmfud7ICY3MrG9ZG6 Ect5m5LQJ295nzFDCHNNK/nyx8XNsmIvCFAQInJPPgHhNKsay+TYdao7AXmfh9Rwci0j Q8l99kDIRbdAkAD3p0/+k7xuNbY1bxe4PGKqVzYU1iNe/f679uktt0ShCR15lgHvbmex ZETLYZMzS0U6Rbdu6PuQv3kzrzYMd5f8a80Wt8hNZMYPgFcd1rDceIMzGM97idlzfCB7 fq+bjxHTFuBCZ8EcHB4N45dtCQiHW/Wnfi1h36PmaKmJ889AuUbttlT0ucWdNDH4RUqB hj5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DckadAFoTD7J0vfJAeoSpa3FUAE91lZFY1+DJ54RKCU=; b=dmDO8mqnQe0c7DvO4y2rq+U2lMuMEPFAmGA43dfxY4PrJg4/XM2LpUXml+sbHXdObg 8UIMeXXKtJf90K9GOOKJwBne7QpbujretfjgV1DdFFDBoGrAX4JA2ZnbJjedQkADXsJw 2XOBYcy0hp+hVN31Ud49CcF9tezdDhJOPQQzbhsgdmuHtSpbDpiC0/aijuDbFe0aLJDi fbABwz2fEgmsOT0iT+8NnytJKN+RRq4IBjjxnaBE+reapp0PFUQhKcUH8KXTHGmfBVSU SeNWaVpTN3MsuBrL6/B7om+qNZ8XOqKe0tnViC+rK0UVcG05EZJtu1908tz+qlqysSNS VMsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AOC367zI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7si7195838ejs.4.2019.09.09.04.50.34; Mon, 09 Sep 2019 04:50:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AOC367zI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732301AbfIHMus (ORCPT + 99 others); Sun, 8 Sep 2019 08:50:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:41742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732231AbfIHMun (ORCPT ); Sun, 8 Sep 2019 08:50:43 -0400 Received: from localhost (unknown [62.28.240.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 84C50218AC; Sun, 8 Sep 2019 12:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567947043; bh=BDvf22p4KU00IGDfpcqeWyUuwRPJWPNJhTSf+CQatsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AOC367zIpjMKNU3eNJch4iK+TroVHLJxtQvdsiCKYoZiqKj6gACqI7oC9jEK92KoI i4VKXa/zXIhmMWR0knZId+yUSQTi4p4lcwlnNc6HTQyGj9WXQgzguBhFa+JsPvzsPC sz4WcV+YIO/qMw0LhylXxcIfhRvPnRo48gz+Or64= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabian Henneke , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.2 38/94] Bluetooth: hidp: Let hidp_send_message return number of queued bytes Date: Sun, 8 Sep 2019 13:41:34 +0100 Message-Id: <20190908121151.529315142@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190908121150.420989666@linuxfoundation.org> References: <20190908121150.420989666@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 48d9cc9d85dde37c87abb7ac9bbec6598ba44b56 ] Let hidp_send_message return the number of successfully queued bytes instead of an unconditional 0. With the return value fixed to 0, other drivers relying on hidp, such as hidraw, can not return meaningful values from their respective implementations of write(). In particular, with the current behavior, a hidraw device's write() will have different return values depending on whether the device is connected via USB or Bluetooth, which makes it harder to abstract away the transport layer. Signed-off-by: Fabian Henneke Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/hidp/core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 5abd423b55fa9..8d889969ae7ed 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -101,6 +101,7 @@ static int hidp_send_message(struct hidp_session *session, struct socket *sock, { struct sk_buff *skb; struct sock *sk = sock->sk; + int ret; BT_DBG("session %p data %p size %d", session, data, size); @@ -114,13 +115,17 @@ static int hidp_send_message(struct hidp_session *session, struct socket *sock, } skb_put_u8(skb, hdr); - if (data && size > 0) + if (data && size > 0) { skb_put_data(skb, data, size); + ret = size; + } else { + ret = 0; + } skb_queue_tail(transmit, skb); wake_up_interruptible(sk_sleep(sk)); - return 0; + return ret; } static int hidp_send_ctrl_message(struct hidp_session *session, -- 2.20.1