From patchwork Fri Sep 1 20:41:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 111494 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp1538901qge; Fri, 1 Sep 2017 13:42:08 -0700 (PDT) X-Received: by 10.98.52.67 with SMTP id b64mr3651636pfa.231.1504298528500; Fri, 01 Sep 2017 13:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504298528; cv=none; d=google.com; s=arc-20160816; b=s9mME7hPBN7cLl8fEnE54sbmKL3SjvUOFxDyfM4Ubmh0YWdSjzsfS7yNPsfsKRkhHW 2cNvaFczDxr+KsrfyM8rIKY4ffOsPzN65F6ELoDzp+bi/zIy51PoCkyCRIY5aFNXzCYw OzBil1DyqOgnBIQ8NohipUwgNwJsbpXtBNkCPJ3klWp/2pux3RD4OsN/TYudPlbLyEKR 3ccEd+CQxxY0cB1OSxF4bODgCrbX389nLC+HBWzvQcLVsxwTfNnAujQ+r2yaLhbqwlGm ctShNH4/60V8NuJ+EBjA7RCFs4/CTI90vWzepsEzxXru8MDShPfywtXudz5qK9Pt8ffn +k1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=JM3Ni2MUBfVHJA3WNtDUv5p+FE9wMoR9i/udzgy/B38=; b=C912iZFJ5M/t8D4TD9TEuH0vs7iynUZJDe8lbGWrmJhjFrhaKCTm+ALrissD9Qvk8/ nmepTshZevqpqeLkEVRmqAR9fpKhdRe09kD51Dni6tGTIw9Q3LvpTMN6zIKhsKWTNu0+ xNvcYX88g60IJSYBF9DTOe1+o6F37699J1bjWwUvVj8GPxBYmNUHio9+HFdDTVJMB+al L2uCj3my1T+s6PWXxj2gzBy6P+seyA0Gak9FS80+14HOUwvR6YjUhrw8goZVPlm8Ak1y zBloEOX0mTNwq+vZ8rF1Z6E9S5f6x/1NH0XJA7ome3Sfi94dU30gf3dhEzm4+vMO4oMc y7GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dDz18+z/; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1si712238plk.562.2017.09.01.13.42.08; Fri, 01 Sep 2017 13:42:08 -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=@linaro.org header.s=google header.b=dDz18+z/; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752618AbdIAUmG (ORCPT + 26 others); Fri, 1 Sep 2017 16:42:06 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:35844 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752504AbdIAUlZ (ORCPT ); Fri, 1 Sep 2017 16:41:25 -0400 Received: by mail-pf0-f172.google.com with SMTP id r187so3450516pfr.3 for ; Fri, 01 Sep 2017 13:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JM3Ni2MUBfVHJA3WNtDUv5p+FE9wMoR9i/udzgy/B38=; b=dDz18+z/r4YvctAOG+Voy2Canogre41YdRjdCKYb7XGCzAhFqkmT4aEIvWXRsrmZWO ToHvKFwwJ1UMfnYj0R0RAuxw5mu+Le2XsgD2X/WOAHHVPBgI2Vam+zQdAoOYR4reqqLr u3IUn/OtRR/OkmJTJFGN1FcqXQQ/tgFIp57KM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JM3Ni2MUBfVHJA3WNtDUv5p+FE9wMoR9i/udzgy/B38=; b=HoQO4TIE4P3TbQ7vxAwYWqO26Is/aWEUr1F3TcKx8MHzLJXi0dYfCdBXSO3muJwpwL zuHfR+Glq0Dk0gHgZT/2lCIeZCzbktZ8cpEr6ciSls4qtiYAex8XhgVQo9n8p9hy4PXD 97gjTWpHOZmuO16qy8n6o6AAivQJGtKIgb2lqoBKjwg2V3Ex+Z8B+xG0Tm1Kd0OPwan7 UxePDIU+FHQDJMI/uPNaCk5IE1Bc4eD7A2xArbGmKZjY56jC/rvM7fSmGCWzvDlwPoQ8 DVeCk+qMWFjgu4yYAnhek+Jo3jxNwCxGWijEzdMBafLncow8uhgjpREZV7df3Gkv+htI tc4g== X-Gm-Message-State: AHPjjUiusmGEH6Dv4gKlufXvvE8pNc76aocL5CfDXErUGzZr18+4KI+A Qct5q6Xuze4+3ie9 X-Google-Smtp-Source: ADKCNb6J3i+7pyUUuM1ricPbHth6YS7muh7tH3koarH4e3wGd7gi0/4NPtorLD7zf/zOgohn+3OOQQ== X-Received: by 10.84.133.15 with SMTP id 15mr3908099plf.74.1504298485297; Fri, 01 Sep 2017 13:41:25 -0700 (PDT) Received: from localhost.localdomain (ip68-111-217-79.sd.sd.cox.net. [68.111.217.79]) by smtp.gmail.com with ESMTPSA id e5sm1279660pgn.57.2017.09.01.13.41.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 13:41:24 -0700 (PDT) From: Bjorn Andersson To: Marcel Holtmann , Gustavo Padovan , Johan Hedberg , "David S. Miller" Cc: linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Loic Poulain Subject: [PATCH 1/2] Bluetooth: make baswap src const Date: Fri, 1 Sep 2017 13:41:17 -0700 Message-Id: <20170901204118.17123-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170901204118.17123-1-bjorn.andersson@linaro.org> References: <20170901204118.17123-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Loic Poulain Signed-off-by: Loic Poulain Signed-off-by: Bjorn Andersson --- include/net/bluetooth/bluetooth.h | 2 +- net/bluetooth/lib.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.12.0 diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 01487192f628..020142bb9735 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -233,7 +233,7 @@ static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src) memcpy(dst, src, sizeof(bdaddr_t)); } -void baswap(bdaddr_t *dst, bdaddr_t *src); +void baswap(bdaddr_t *dst, const bdaddr_t *src); /* Common socket structures and functions */ diff --git a/net/bluetooth/lib.c b/net/bluetooth/lib.c index aa4cf64e32a6..6048cc07568b 100644 --- a/net/bluetooth/lib.c +++ b/net/bluetooth/lib.c @@ -30,10 +30,10 @@ #include -void baswap(bdaddr_t *dst, bdaddr_t *src) +void baswap(bdaddr_t *dst, const bdaddr_t *src) { + const unsigned char *s = (const unsigned char *)src; unsigned char *d = (unsigned char *) dst; - unsigned char *s = (unsigned char *) src; unsigned int i; for (i = 0; i < 6; i++) From patchwork Fri Sep 1 20:41:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 111493 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp1538352qge; Fri, 1 Sep 2017 13:41:33 -0700 (PDT) X-Received: by 10.84.217.20 with SMTP id o20mr2386560pli.269.1504298493476; Fri, 01 Sep 2017 13:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504298493; cv=none; d=google.com; s=arc-20160816; b=qUAP1dY3FbRtk8jWO9o9GAm8B+SmLLqAIXrFEfnpYnechVdH9ldYkOULBPPEeaMDDH mAujAgTZi+f7BGASYM+7ILKwYW7ltsgJG0Mx6UcVgZVt0EhteHT05OgzXmjYDi4tgqt/ RLx5jOVCIhWhOB+o8UJJ7wsm2C9PLKi5IMWZSZV206LQA/ZVAPh2yuKxI7U3/iPAf5od HXbYoezFBw4iSDTlz0wLpPCT/msMuXrQHaLXXtknFZjeanGzLTN9bvS06D5A3Fg8Cs+d usTcfpqTey6Wu+q/Ogqb2ZMFa4seo/ICp7+hZw7nJ/k6qlAY2m4vzZE2vmFFKWQcPK55 N4zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=4Rf8ndpWW1sw2iJAqd5uL7qxUVkzxRpG+4l/4J0+tRU=; b=pp8PE/gH1H2RP86WTojGizH9voudjSu8h95spp5izgZfxQ99An/qOfJfiY+OEA7o1V z42T0EzDov+S4519DQsWBHYuAxu0/Qep33nU1UHD+N7bUdttECm4cO3IfCbQ1bPsA+Uo LCBav+DjXpIfQ7W41jpDQT+UE9NWXEa8KmKwEm/uHaSSn2900HreYMMIQl9ajX2S3Nml lMAs0h9LHHY+ItqVaPuen51ecz5NUO7bQDXamvoqBJHKAPkI30JNQxH7MJVFTKDInP18 4UjESwcfupUXvxyxs629S/PUbaLPE8V4s3vB4CEvnhZltUNSeB12Q5RzqjVbEawArVEZ 72Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FysQ0s89; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l33si794809pld.156.2017.09.01.13.41.33; Fri, 01 Sep 2017 13:41:33 -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=@linaro.org header.s=google header.b=FysQ0s89; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752592AbdIAUla (ORCPT + 26 others); Fri, 1 Sep 2017 16:41:30 -0400 Received: from mail-pg0-f51.google.com ([74.125.83.51]:35221 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752546AbdIAUl1 (ORCPT ); Fri, 1 Sep 2017 16:41:27 -0400 Received: by mail-pg0-f51.google.com with SMTP id 63so3493481pgc.2 for ; Fri, 01 Sep 2017 13:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4Rf8ndpWW1sw2iJAqd5uL7qxUVkzxRpG+4l/4J0+tRU=; b=FysQ0s89zHTw44uLY8kMmPt6im8KgrWTUVt0GrS8rKLEmSbzYCpnHbiaXY0WCx/oAu JjKmSk1BCONUVhRvY5EoZa3gA9ykBbsmV02JKBixRO0Khcha/MlA7udxtypAp+7/4dnG BvgExkrs2JZlnl59h95v8Y/A9PrT/jkmZtA2g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4Rf8ndpWW1sw2iJAqd5uL7qxUVkzxRpG+4l/4J0+tRU=; b=hj6ue94PZ2seHCi4KUkinwFBLWBpJ2MSqGaujG1VcV/YtI0oQ8ok79i45lr3+V2S61 eVkn6ov3rRZ+uO4m7eRIaFG3VOjRPZfDztN7ypivI9s7tXBFhxlose7gdzqMJe8G5hpB N7374ewquUn8YKRZiIyb6F+iVINzQcM/YsWUj0K1Sg4njU/Jn9eE86vVI98j9dAT7E1E K5H31AbKjq50xDwIxSXQLuUK2mO9iumfoiyj4vaHAlJnWlTYl/pTyu+QT0RvykEmoSk9 q2UxRZ7fx/4wc68OubgkDDnmDm7pwnxHoOpKm16aPrKKRlqkdxVywL+3Z+cQYfhjEOEO qREA== X-Gm-Message-State: AHPjjUisFsx/IL8pVjtEEGjwclJ9TE/h1GtWktiA6yc0vAjwIwmjLt/3 O3C83NztMifjuup9 X-Google-Smtp-Source: ADKCNb4D89VchOYiulZ3iquAs4IL4I9TZfrMEwc+EfXmUj5XiuaGqlP5mG8FsxUwEK3EEFwz9yZGfg== X-Received: by 10.84.241.135 with SMTP id b7mr611786pll.425.1504298486585; Fri, 01 Sep 2017 13:41:26 -0700 (PDT) Received: from localhost.localdomain (ip68-111-217-79.sd.sd.cox.net. [68.111.217.79]) by smtp.gmail.com with ESMTPSA id e5sm1279660pgn.57.2017.09.01.13.41.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 13:41:26 -0700 (PDT) From: Bjorn Andersson To: Marcel Holtmann , Gustavo Padovan , Johan Hedberg Cc: "David S. Miller" , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Loic Poulain Subject: [PATCH 2/2] Bluetooth: btqcomsmd: BD address setup Date: Fri, 1 Sep 2017 13:41:18 -0700 Message-Id: <20170901204118.17123-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170901204118.17123-1-bjorn.andersson@linaro.org> References: <20170901204118.17123-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Loic Poulain Bluetooth BD address can be retrieved in the same way as for wcnss-wlan MAC address. This patch mainly stores the local-mac-address property and sets the BD address during hci device setup. Signed-off-by: Loic Poulain Signed-off-by: Bjorn Andersson --- drivers/bluetooth/btqcomsmd.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) -- 2.12.0 diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c index d00c4fdae924..443bb2099329 100644 --- a/drivers/bluetooth/btqcomsmd.c +++ b/drivers/bluetooth/btqcomsmd.c @@ -26,6 +26,7 @@ struct btqcomsmd { struct hci_dev *hdev; + const bdaddr_t *addr; struct rpmsg_endpoint *acl_channel; struct rpmsg_endpoint *cmd_channel; }; @@ -100,6 +101,27 @@ static int btqcomsmd_close(struct hci_dev *hdev) return 0; } +static int btqcomsmd_setup(struct hci_dev *hdev) +{ + struct btqcomsmd *btq = hci_get_drvdata(hdev); + struct sk_buff *skb; + + skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); + if (IS_ERR(skb)) + return PTR_ERR(skb); + kfree_skb(skb); + + if (btq->addr) { + bdaddr_t bdaddr; + + /* btq->addr stored with most significant byte first */ + baswap(&bdaddr, btq->addr); + return qca_set_bdaddr_rome(hdev, &bdaddr); + } + + return 0; +} + static int btqcomsmd_probe(struct platform_device *pdev) { struct btqcomsmd *btq; @@ -123,6 +145,11 @@ static int btqcomsmd_probe(struct platform_device *pdev) if (IS_ERR(btq->cmd_channel)) return PTR_ERR(btq->cmd_channel); + btq->addr = of_get_property(pdev->dev.of_node, "local-mac-address", + &ret); + if (ret != sizeof(bdaddr_t)) + btq->addr = NULL; + hdev = hci_alloc_dev(); if (!hdev) return -ENOMEM; @@ -135,6 +162,7 @@ static int btqcomsmd_probe(struct platform_device *pdev) hdev->open = btqcomsmd_open; hdev->close = btqcomsmd_close; hdev->send = btqcomsmd_send; + hdev->setup = btqcomsmd_setup; hdev->set_bdaddr = qca_set_bdaddr_rome; ret = hci_register_dev(hdev);