Received: by 2002:a05:6359:322:b0:b3:69d0:12d8 with SMTP id ef34csp337194rwb; Wed, 10 Aug 2022 09:03:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR6YmN3lsHjuf5WoEab8Th6PFnQHYjDy9Wyx2iYUUiG0D3CVAHN+4IxaDucMx4MMUTXEPgud X-Received: by 2002:a05:6402:28c4:b0:43a:cdde:e047 with SMTP id ef4-20020a05640228c400b0043acddee047mr27644347edb.368.1660147395833; Wed, 10 Aug 2022 09:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660147395; cv=none; d=google.com; s=arc-20160816; b=UAD+JkgvzJc8G1P5qNszv+00bjyoVOYzW0LrVKG1YHFo8KbYqmB5T+sHS8AEHd0Rq2 0r/7gAtFFy5kEsvqLN0/ItLP4nBx5PnzotJgpHxpcJmhTy79PPlScuLCbAC6AUewQEu6 jl9TooEz9XGO3qGndMXDIiZaQba3SBt11Iu2rAmoJNwillY3pcQXsLumlXloFUon7zgv 3RF+ronOfLDyzEw2PQpiNmaq3puDv/nAgxI1BloYlYyhy1OaeHVjZj/QAcSs+IINzzIh nOM9O1fv7nTSbzLM1CQopqMazmQbBpFFlJCZIhvdJCkYv1HpJi4QQX87tCRpAtsKVYH/ Garg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=l7PZD+YaratyWuraoD6FFlyszu21r1R3dL9LFvoq6k0=; b=VBiYlxo+dY77YAsAMPNxx15uf8WBLzRa0gXqlLl+pF1VLez0um2B/M1d9WEoBC2Mx5 wIQkVftRQFKRmlnl+aCKx838+Va+Ek4PotEYTBlj5WSK9e7yMc8/tFigZu0h3Tmu6NCw NTbNo0oe4LAhz7PUZgwcMo1QSGrQJYT450pNuUKXTyzA2+AYLhTDoKZPZMEH79JCzh0O ked6OTfLIAmBWctNSFJbcPtnHq3ftTXDgM9MUvPUbFrkHQqN4RcrCqqubO0sSKaqersN B33DA16J0gELt5WCDfsCoQi+GpKriqn89kbRN+Ir+N8+PCpEF5YS1s44BCK0Se3V7U9J ziqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=jcmeIl1N; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020aa7d907000000b0043d983232acsi10704950edr.483.2022.08.10.09.01.32; Wed, 10 Aug 2022 09:03:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=jcmeIl1N; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232711AbiHJQBE (ORCPT + 99 others); Wed, 10 Aug 2022 12:01:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233222AbiHJQAx (ORCPT ); Wed, 10 Aug 2022 12:00:53 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7491F5D0C0 for ; Wed, 10 Aug 2022 09:00:52 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-324966c28e5so129049087b3.3 for ; Wed, 10 Aug 2022 09:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc; bh=l7PZD+YaratyWuraoD6FFlyszu21r1R3dL9LFvoq6k0=; b=jcmeIl1NpNa7TnyD+eLPi7e6zk/kVWAJSsfHmHu3w/Xm5Sr84D4AnVAbdGqmxY1/rX b7fNe6NOGDHsFWsaGhR9f/rlfrEXlH6M9L1u4r3/Ir1sofL6f9v33e4TigWbRQ0Wch/t ia+r1izURNqhbIPH5MA4Bjb1fsSu6i0/HepEKJz0enLpMCBxfExi3+iyvcl1hQx/67zs UqWXZfV5UpzdnxNUFFTfYfXAnafT/Mxp9Ah54+yUeMXSCiyAiipmyL5suRHsanRZk3tv 0Zogb17vBr2mpWIeQ9/Hoc740SfWND/RDfokXgF62wbF442ne4BhrnUWl+ti044445Tu NKrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc; bh=l7PZD+YaratyWuraoD6FFlyszu21r1R3dL9LFvoq6k0=; b=CZjGaynueMqMtR8IwxbalRJ72T4xhkKMBW1acDy4TkBDm9lil1M59nE2DhX2bg1lzH 8CPlLlasAUuSVk67/KnEFy7H+0v7vZCBy3u39PJIJFd2xmMcS9TXVK+a683AwgMT2xpd QyxHQhocCNyloQedqkMUxDYUErUX4v8bRtvI4H9ljNJADYQnzoAvk8Lzc954LOpVX1xl niL6LoVtr4GwJcZGfnwtKwAAMZdSF0Z+A5fy0SYl8tPZQBLhNQpw5k9Xl4IyrF+w8H4Y YXWVqDY639yJyrmTn32GsdWnjj3sMQMmlVRFNP6mrsPXU8IaCJQ11qEkYu8Eza8Kzj6i p/vw== X-Gm-Message-State: ACgBeo3YXLwHyg9r7+72J269KxHR3MLJ6PEorz+oUwyJqif/SKiYiCxz 7oPf5mYPYJwGk0IhDOWyUyxhI1hKmWeTFg== X-Received: from mmandlik.mtv.corp.google.com ([2620:15c:202:201:1e7:803:63a4:33]) (user=mmandlik job=sendgmr) by 2002:a05:6902:15cf:b0:67c:1ee7:149 with SMTP id l15-20020a05690215cf00b0067c1ee70149mr8637670ybu.594.1660147251724; Wed, 10 Aug 2022 09:00:51 -0700 (PDT) Date: Wed, 10 Aug 2022 09:00:37 -0700 In-Reply-To: <20220810085753.v5.1.I5622b2a92dca4d2703a0f747e24f3ef19303e6df@changeid> Message-Id: <20220810085753.v5.4.Id0d6e772f00432d55f6bcbf68a50cb4ad89396c6@changeid> Mime-Version: 1.0 References: <20220810085753.v5.1.I5622b2a92dca4d2703a0f747e24f3ef19303e6df@changeid> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog Subject: [PATCH v5 4/5] Bluetooth: btusb: Add btusb devcoredump support From: Manish Mandlik To: Arend van Spriel , Greg Kroah-Hartman , marcel@holtmann.org, luiz.dentz@gmail.com Cc: Johannes Berg , Dan Williams , Jason Gunthorpe , "Signed-off-by : Manish Mandlik" , linux-bluetooth@vger.kernel.org, Thomas Gleixner , "Rafael J . Wysocki" , chromeos-bluetooth-upstreaming@chromium.org, Won Chung , Abhishek Pandit-Subedi , Johan Hedberg , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch implements the btusb driver side .coredump() callback to trigger a devcoredump via sysfs and .enable_coredump() callback to check if the devcoredump functionality is enabled for a device. Signed-off-by: Manish Mandlik Reviewed-by: Abhishek Pandit-Subedi --- (no changes since v4) Changes in v4: - New patch in the series drivers/bluetooth/btusb.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 30dd443f395f..b00851327aa3 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1510,6 +1510,15 @@ static void btusb_isoc_tx_complete(struct urb *urb) kfree_skb(skb); } +#ifdef CONFIG_DEV_COREDUMP +static bool btusb_coredump_enabled(struct hci_dev *hdev) +{ + struct btusb_data *data = hci_get_drvdata(hdev); + + return !data->intf->dev.coredump_disabled; +} +#endif + static int btusb_open(struct hci_dev *hdev) { struct btusb_data *data = hci_get_drvdata(hdev); @@ -3765,6 +3774,9 @@ static int btusb_probe(struct usb_interface *intf, hdev->send = btusb_send_frame; hdev->notify = btusb_notify; hdev->wakeup = btusb_wakeup; +#ifdef CONFIG_DEV_COREDUMP + hdev->dump.enabled = btusb_coredump_enabled; +#endif #ifdef CONFIG_PM err = btusb_config_oob_wake(hdev); @@ -4180,6 +4192,17 @@ static int btusb_resume(struct usb_interface *intf) } #endif +#ifdef CONFIG_DEV_COREDUMP +static void btusb_coredump(struct device *dev) +{ + struct btusb_data *data = dev_get_drvdata(dev); + struct hci_dev *hdev = data->hdev; + + if (!dev->coredump_disabled && hdev->dump.coredump) + hdev->dump.coredump(hdev); +} +#endif + static struct usb_driver btusb_driver = { .name = "btusb", .probe = btusb_probe, @@ -4191,6 +4214,14 @@ static struct usb_driver btusb_driver = { .id_table = btusb_table, .supports_autosuspend = 1, .disable_hub_initiated_lpm = 1, + +#ifdef CONFIG_DEV_COREDUMP + .drvwrap = { + .driver = { + .coredump = btusb_coredump, + }, + }, +#endif }; module_usb_driver(btusb_driver); -- 2.37.1.559.g78731f0fdb-goog