Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp315333lqt; Thu, 6 Jun 2024 04:43:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1S/QK32z5zraiwuphlhJ4zjfpT7sAap8vMwmHBXn48SvSRvlia0T7+oo24ZHCe/4cu+l5wjLSDIffJlF2EIt9lCMl6PRCNpNRLBs+xA== X-Google-Smtp-Source: AGHT+IF4ohZS3/fIU/mfs/kwwd+eUrE5wPb6dy3LTpj+CM+KYe+AdveO3mL2+W6vgKEvI5vIUiie X-Received: by 2002:a50:c04e:0:b0:578:3336:92a with SMTP id 4fb4d7f45d1cf-57a8b528778mr3745967a12.0.1717674231494; Thu, 06 Jun 2024 04:43:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717674231; cv=pass; d=google.com; s=arc-20160816; b=1Hdj8YU+QKx4Vfz2Mc2++rvK8QwpGMXLx2dg2diaQPkEnCSzpjx6MX7fqbXfMeLkOA XhxIIF4IXnY4hEpdLX0oQlist3+SkB8B4xgqMeqLpnNnnG5diVjgrAONY2aZUtwTzoeE HgY/i9foCQFOtGFVeYmd89zvb8QrOQuMu56Z6q3GTeByFUkhAWE0GBJivmooqOhrIEzC IgSqmzcsE3xMp/t6Ofu7f86+lZpIlcYIrOjvHw7NaNabG9NxmJBwHj3u62R4pEuWzMN4 weMzYRA+HRsb9UTHHjI9U4jliLHstZ0tdSzMspzGoUCG6tAktFZwHF9ttNSA3TqBOLvC 9tvw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LKjKCz6MWko6tQGKhAEekON+68KMgjRQz4EtM95IYls=; fh=hCUCV0br0LS2gL0tIN+7VEl76HGBTws3+qgN3MgZyy8=; b=WigltO0maQKM0a+gKbWMLkpF/WCuM1xQFFiKhpdTPjlfaVrHJETvTc9ttffobIIS+R 0aTc57VKftZoPHOg1CPlLBkZdM5xaUbu4deuf9ZrzFzs0+Tawn3H7boPMVi+DZPzfTk5 PG9tczm1hLaphUhEFrishOyBFjvFvTGR1EoL0NMOW0bqbS+oIO+umx8cDFmup4qT4zco 6330XySmdyUF1yeK3008hpVLANaYRZRt8nJZ1THvRdKwfUgdNndfCjrx+U8DG4KK9Rye CxbEaLtHJ88yWd4+ovPFlN9WmMUAsBp9Tv5+t4V6rwjANdu6+MTtg6Sa7W7JwICyHicz BKVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="RgbthJy/"; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-204195-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204195-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae228e0bsi591541a12.382.2024.06.06.04.43.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 04:43:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204195-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="RgbthJy/"; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-204195-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204195-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3A6FC1F27230 for ; Thu, 6 Jun 2024 11:43:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C8E2195982; Thu, 6 Jun 2024 11:43:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="RgbthJy/" Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E8281E52A; Thu, 6 Jun 2024 11:43:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.244.123.138 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717674216; cv=none; b=DbekwN90UNXAQN9xg6HGamlLTEjcaqlrDpMXmfYlJWF34D9Qye5pQYyfp271/nTYuR4F812YFRNL2kslN7YEMrPG3YJnmthZG3IQ4JzgDn/6EAQI1ORDqGdzZIRc4pTHX2ewQOpTC4Ti7d6+5xJoqePuVwQ/M/PrqYxWbFFHIA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717674216; c=relaxed/simple; bh=mEozOdyq3JhE4NZ9GAdH3wSUhRyds+L/Hs1E9DZ0gv8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VbR5sOSF3703bkaN0wrS+e4Zr7vcBLnsRb+CAvondZZgTh+0n2MFqXuO2wBI5gm8hxkCEYoQZ4fzYNP4zIhC+12N20I/52tQB1pLxpW1dkeWwZkHWvHWoaLN5e5tjrRMZpdj1df0baVznXNVQWuAJGvgRAnawcWNNeyPmInddRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=RgbthJy/; arc=none smtp.client-ip=60.244.123.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: fd09aa4023f911efa54bbfbb386b949c-20240606 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=LKjKCz6MWko6tQGKhAEekON+68KMgjRQz4EtM95IYls=; b=RgbthJy/nW5FOn4xqiMRzLTBUw+EERs6rpYKRRroiHGvd9TH/Y/2wDp0RCOyzmpGKtnNbIpAl5pTBJ7zQz9vxnJUhoWPNes+Tg98sNme1pddDWY7QhfNp4kYq0oictJGZQKSITlMzaSzAv1e1Jkouswkd2d74V5jezlXuoYgTP8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.39,REQID:4f714a76-c35c-4e6e-934d-cb04a03f92b2,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:393d96e,CLOUDID:0efd4a88-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES :1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: fd09aa4023f911efa54bbfbb386b949c-20240606 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 511123124; Thu, 06 Jun 2024 19:43:27 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 6 Jun 2024 19:43:25 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 6 Jun 2024 19:43:25 +0800 From: Chris Lu To: Marcel Holtmann , Johan Hedberg , Luiz Von Dentz CC: Sean Wang , Deren Wu , Aaron Hou , Steve Lee , linux-bluetooth , linux-kernel , linux-mediatek , Chris Lu Subject: [PATCH v4 3/4] Bluetooth: btmtk: add macro to get/set/clear MediaTek defined flags Date: Thu, 6 Jun 2024 19:43:20 +0800 Message-ID: <20240606114321.30515-4-chris.lu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240606114321.30515-1-chris.lu@mediatek.com> References: <20240606114321.30515-1-chris.lu@mediatek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Define a enumeration to store MediaTek specific flags and macro function to set/test/clear the flags in data structure. Signed-off-by: Chris Lu Signed-off-by: Sean Wang --- drivers/bluetooth/btmtk.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/bluetooth/btmtk.h b/drivers/bluetooth/btmtk.h index e76b8a358be8..6a0697a22b16 100644 --- a/drivers/bluetooth/btmtk.h +++ b/drivers/bluetooth/btmtk.h @@ -128,6 +128,10 @@ struct btmtk_hci_wmt_params { typedef int (*btmtk_reset_sync_func_t)(struct hci_dev *, void *); +enum { + __BTMTK_NUM_FLAGS, +}; + struct btmtk_coredump_info { const char *driver_name; u32 fw_version; @@ -136,11 +140,30 @@ struct btmtk_coredump_info { }; struct btmediatek_data { + DECLARE_BITMAP(flags, __BTMTK_NUM_FLAGS); + u32 dev_id; btmtk_reset_sync_func_t reset_sync; struct btmtk_coredump_info cd_info; }; +#define btmtk_set_flag(hdev, nr) \ + do { \ + struct btmediatek_data *mediatek = hci_get_priv((hdev)); \ + set_bit((nr), mediatek->flags); \ + } while (0) + +#define btmtk_clear_flag(hdev, nr) \ + do { \ + struct btmediatek_data *mediatek = hci_get_priv((hdev)); \ + clear_bit((nr), mediatek->flags); \ + } while (0) + +#define btmtk_get_flag(hdev) \ + (((struct btmediatek_data *)hci_get_priv(hdev))->flags) + +#define btmtk_test_flag(hdev, nr) test_bit((nr), btmtk_get_flag(hdev)) + typedef int (*wmt_cmd_sync_func_t)(struct hci_dev *, struct btmtk_hci_wmt_params *); -- 2.18.0