From patchwork Wed Feb 3 18:12:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12065111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1E96C433DB for ; Wed, 3 Feb 2021 18:14:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51D6064F7E for ; Wed, 3 Feb 2021 18:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232810AbhBCSNx (ORCPT ); Wed, 3 Feb 2021 13:13:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232793AbhBCSNX (ORCPT ); Wed, 3 Feb 2021 13:13:23 -0500 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27763C06121D for ; Wed, 3 Feb 2021 10:12:23 -0800 (PST) Received: by mail-il1-x12c.google.com with SMTP id m20so75240ilj.13 for ; Wed, 03 Feb 2021 10:12:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sMW3CNRkXAOc9KAd8J07IhXCHX6Qv+SqEQtIsx8ACMQ=; b=b9fnxMS19FGFawMAjOPzOEcoC4JgrqxWgH8K2OX2hwQqH1l4SDSpNNoUUstpJzf4G9 KY0hONkplnyMToYmcCauhew9EeN5GPuDVyaOF5DrLuEUVQ2Ne4S7nr4yk7QUfbHjUjhC jJLnBv8suG996FrIsQO9a86ihkZy+BQnf4FxE= 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:mime-version:content-transfer-encoding; bh=sMW3CNRkXAOc9KAd8J07IhXCHX6Qv+SqEQtIsx8ACMQ=; b=F5tBzcmooT7bR+6ZYS9BmbCf1MRKBaSSzVzxiV/Xbwo1GVlxVu1CMoC3uOCk1QGxf4 WH4HE6cyKIrop6gcgTPwYfZouftkTmFxsFyijqDRGwXPHXDea3Qi26kf6AkpiuSUFwod SsrZw1LrY84Jc9H2ZjDRnrvwcAyF/KLF3Bxqk6InjJlCTEO5hnwZFukM5lihCfWEXhPN ttE4VjjyaJzFtPi6mKMPOrmeaHUdgx/auT4WC1p026MRiJBKbFBXRbbOxWZD+SEuW89V Ej9nDSIyik4NShg7BH3lZimIFAXwEksBjWdVk7q6eCQmEAHk+xUs6Bh5w2W1582SPpXK E7wQ== X-Gm-Message-State: AOAM531hMbmLwZiOXRD555JzwqxI6khPp6xDJ+TBE82w6zcn3GMendga CB+b3u/FMI7+epvixv5WAp61Yw== X-Google-Smtp-Source: ABdhPJxjrtfT1+6QN/5yrKNnuIvDVPU5UrlfJEcRxt7l04gm+3ENjo/Y9yfHqeiCNcK9Ib3TtZNR/Q== X-Received: by 2002:a92:650b:: with SMTP id z11mr3627266ilb.84.1612375942658; Wed, 03 Feb 2021 10:12:22 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id h21sm399684iob.30.2021.02.03.10.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 10:12:22 -0800 (PST) From: Shuah Khan To: corbet@lwn.net, gregkh@linuxfoundation.org, peterz@infradead.org, keescook@chromium.org, rafael@kernel.org, lenb@kernel.org, james.morse@arm.com, tony.luck@intel.com, bp@alien8.de Cc: Shuah Khan , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kselftest@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH v3 5/7] drivers/staging/rtl8723bs: convert event_seq to use seqnum_ops Date: Wed, 3 Feb 2021 11:12:01 -0700 Message-Id: <1dffcc128b59ed991f9fb9f5064a05741c282f26.1612314468.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Sequence Number api provides interfaces for unsigned atomic up counters leveraging atomic_t and atomic64_t ops underneath. Convert it to use seqnum_ops. event_seq atomic_t variables are atomic counters. Convert them to use seqnum_ops. Signed-off-by: Shuah Khan --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 3 +- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 33 +++++++++++++------ drivers/staging/rtl8723bs/include/rtw_cmd.h | 3 +- .../staging/rtl8723bs/include/rtw_mlme_ext.h | 3 +- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index 3fe79169a811..4db737cd748e 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -10,6 +10,7 @@ #include #include #include +#include static struct _cmd_callback rtw_cmd_callback[] = { {GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/ @@ -207,7 +208,7 @@ static void c2h_wk_callback(_workitem * work); int rtw_init_evt_priv(struct evt_priv *pevtpriv) { /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */ - atomic_set(&pevtpriv->event_seq, 0); + seqnum32_init(&pevtpriv->event_seq, 0); pevtpriv->evt_done_cnt = 0; _init_workitem(&pevtpriv->c2h_wk, c2h_wk_callback, NULL); diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index fa4b0259c5ae..46e7f487a5ba 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -11,6 +11,7 @@ #include #include #include +#include #include static struct mlme_handler mlme_sta_tbl[] = { @@ -281,7 +282,7 @@ static void init_mlme_ext_priv_value(struct adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - atomic_set(&pmlmeext->event_seq, 0); + seqnum32_init(&pmlmeext->event_seq, 0); pmlmeext->mgnt_seq = 0;/* reset to zero when disconnect at client mode */ pmlmeext->sa_query_seq = 0; pmlmeext->mgnt_80211w_IPN = 0; @@ -5049,7 +5050,9 @@ void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct survey_event); pc2h_evt_hdr->ID = GEN_EVT_CODE(_Survey); - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); psurvey_evt = (struct survey_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); @@ -5102,7 +5105,9 @@ void report_surveydone_event(struct adapter *padapter) pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct surveydone_event); pc2h_evt_hdr->ID = GEN_EVT_CODE(_SurveyDone); - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); psurveydone_evt = (struct surveydone_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); psurveydone_evt->bss_cnt = pmlmeext->sitesurvey_res.bss_cnt; @@ -5149,7 +5154,9 @@ void report_join_res(struct adapter *padapter, int res) pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct joinbss_event); pc2h_evt_hdr->ID = GEN_EVT_CODE(_JoinBss); - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); pjoinbss_evt = (struct joinbss_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); memcpy((unsigned char *)(&(pjoinbss_evt->network.network)), &(pmlmeinfo->network), sizeof(struct wlan_bssid_ex)); @@ -5200,7 +5207,9 @@ void report_wmm_edca_update(struct adapter *padapter) pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct wmm_event); pc2h_evt_hdr->ID = GEN_EVT_CODE(_WMM); - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); pwmm_event = (struct wmm_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); pwmm_event->wmm = 0; @@ -5247,7 +5256,9 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct stadel_event); pc2h_evt_hdr->ID = GEN_EVT_CODE(_DelSTA); - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); pdel_sta_evt = (struct stadel_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); memcpy((unsigned char *)(&(pdel_sta_evt->macaddr)), MacAddr, ETH_ALEN); @@ -5300,7 +5311,9 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, int pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd); pc2h_evt_hdr->len = sizeof(struct stassoc_event); pc2h_evt_hdr->ID = GEN_EVT_CODE(_AddSTA); - pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq); + + /* seq is unsigned int seq:8 */ + pc2h_evt_hdr->seq = seqnum32_inc(&pmlmeext->event_seq); padd_sta_evt = (struct stassoc_event *)(pevtcmd + sizeof(struct C2HEvent_Header)); memcpy((unsigned char *)(&(padd_sta_evt->macaddr)), MacAddr, ETH_ALEN); @@ -6616,10 +6629,10 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) #ifdef CHECK_EVENT_SEQ /* checking event sequence... */ - if (evt_seq != (atomic_read(&pevt_priv->event_seq) & 0x7f)) { + if (evt_seq != (seqnum32_get(&pevt_priv->event_seq) & 0x7f)) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("Event Seq Error! %d vs %d\n", (evt_seq & 0x7f), - (atomic_read(&pevt_priv->event_seq) & 0x7f))); + (seqnum32_get(&pevt_priv->event_seq) & 0x7f))); pevt_priv->event_seq = (evt_seq+1)&0x7f; @@ -6643,7 +6656,7 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) } - atomic_inc(&pevt_priv->event_seq); + seqnum32_inc(&pevt_priv->event_seq); peventbuf += 2; diff --git a/drivers/staging/rtl8723bs/include/rtw_cmd.h b/drivers/staging/rtl8723bs/include/rtw_cmd.h index 56c77bc7ca81..cc0ea649388b 100644 --- a/drivers/staging/rtl8723bs/include/rtw_cmd.h +++ b/drivers/staging/rtl8723bs/include/rtw_cmd.h @@ -8,6 +8,7 @@ #define __RTW_CMD_H_ #include +#include #define C2H_MEM_SZ (16*1024) @@ -62,7 +63,7 @@ struct rtw_cbuf *c2h_queue; #define C2H_QUEUE_MAX_LEN 10 - atomic_t event_seq; + struct seqnum32 event_seq; u8 *evt_buf; /* shall be non-paged, and 4 bytes aligned */ u8 *evt_allocated_buf; u32 evt_done_cnt; diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h index 1567831caf91..537813c00670 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h @@ -7,6 +7,7 @@ #ifndef __RTW_MLME_EXT_H_ #define __RTW_MLME_EXT_H_ +#include /* Commented by Albert 20101105 */ /* Increase the SURVEY_TO value from 100 to 150 (100ms to 150ms) */ @@ -461,7 +462,7 @@ struct p2p_oper_class_map { struct mlme_ext_priv { struct adapter *padapter; u8 mlmeext_init; - atomic_t event_seq; + struct seqnum32 event_seq; u16 mgnt_seq; u16 sa_query_seq; u64 mgnt_80211w_IPN;