Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp26872pxb; Tue, 12 Apr 2022 15:50:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxefPuKnGmXsn7+Q0p7oyr8oGA/MfniuRbWe9wLRANXJF9nKlTEMotaiD1wvX/JHLIv65ji X-Received: by 2002:a05:6a00:e8e:b0:4fa:a52f:59cf with SMTP id bo14-20020a056a000e8e00b004faa52f59cfmr40140919pfb.84.1649803806569; Tue, 12 Apr 2022 15:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649803806; cv=none; d=google.com; s=arc-20160816; b=JOSSgTFi9jv/E/3QYke3cRHrwF9ABscK2TCLMwpZRk9fu0xoL3bI9a8BgqZmPdF8wE UZKXrR7PrXoTqRuiBkDmFg5HUpEX+girbYXTWZR5uU40AddvZ9xGWg/mqCV4fBo7kTGN NHRMJaoeCeZom0T0ZXVVKNnHFSwwldtCLiBappmUiqkvi4E/PdlrnOE1QByipIyii3m9 z1j7j3VlIfEnnzgg2NDjvRhFtYcrPM90BX8uzk9GAIDzcXTPR9huCC7crb4Msh3LnAvs p78sOTU3pTAyERBfAj2luI8ajdwNHCxu9TCBVRISdTlaO40znAudR+2u2avaasC4H2xo s7xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UDJwfC4bXVfds8p9uj2dvjrmmyg7JkvC30fvf514tUw=; b=ZMuopFxuxK2r0r9J1M/ou6QDQAFZSVmFPbJzTPTAoaUjZuhvnbyiMAHQRqXFOUM7pU 3GlBNEZY3de1paw/FrW0XFSlvLXe8dwJdj/r8gwsXLnTW+Ktszkf1M5m/RHAQcUqfuCU 3btWwSnSK5LPHXdrQ+1Xn/Ud7rBEUKr9yKjci8Vuwtwccc6BX6iwRqgLW+OOwGgWcQ/u LRkTyyMyUMSEYjrwglKlkR4OaSSfq7RHWOjb/tDpjKeKwIdTcwd164EHv0cAiXPBVInH sAkP+KB14aHLQNQR086SxsSYa+VDMLHX6E5FTId3TXGJMAd4SsGIhpHF0ZEJCYFcnGD9 Ew/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=atCReM7G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d26-20020aa78e5a000000b004fadadfe285si12255189pfr.335.2022.04.12.15.50.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 15:50:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=atCReM7G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ACAC81C2A27; Tue, 12 Apr 2022 14:31:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242336AbiDKKZn (ORCPT + 99 others); Mon, 11 Apr 2022 06:25:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345414AbiDKKZW (ORCPT ); Mon, 11 Apr 2022 06:25:22 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21FFC44A12 for ; Mon, 11 Apr 2022 03:22:03 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id f3so14227080pfe.2 for ; Mon, 11 Apr 2022 03:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UDJwfC4bXVfds8p9uj2dvjrmmyg7JkvC30fvf514tUw=; b=atCReM7GsEniNQu0eCNJ6aQxRV2SMOdKBHn4gjkvwZaPYYBYmaAoAA09Ho6TWsw2lJ UlepctMkONgP33D7RXbn7vHddoESrb/UmCTLYuJ+ZdXlAh8V7eeiSdhkGSP12UPKuy1f L+z9Wd8pchqmYJIiU2FxlrVE3kVYIMcrpBiB+iCROQctDLErcjO1bZlp3Za/t7npcBW+ l6vzKDo+UGuFFfwONCgp78q30rWiwNojvQ/T74pqyUY+6/DkNIaOZt00lhNlicmd01/C Rhpaa6Co/kxuSfiWCuRSjJgCnRfrQlqHpMaa8XNj1V4QzunLH6Z4EFGrD22OsEuRBEF3 ZTLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UDJwfC4bXVfds8p9uj2dvjrmmyg7JkvC30fvf514tUw=; b=Vpsb3rUssTA2eUQyXn1TKkH7t2KM6pCN078ejbjDnYCJfb9XWsDSFvji3BJpJbsqhu S07ZTQvhcl8hFqQMKFT4aXflNU7k2nvTUs0RfkK6aN6eKI5G3Ol7H/qy9M8iYK87JJ+1 aTuGGG5emJ43yAs4Dp00zNSG7R0GpqeqyG1WF5SfYeVd1MpLXcPF3DEzb//EwanqCqNW fuw4tiezMVIQXU/yMpZBlD09vpSljhmECmPrm57nS3PTwzETcN4EPEvmfT4NOy8JWO1N 1Exo4LrlAxgbKI6uVdHLKeRV0JXMwsTy75ZOsBKF9dXnLZ5NMH7fKjO2HDXjun2nzdq0 s97Q== X-Gm-Message-State: AOAM533yp/KsevM3XVxaNNkuOhc7ulLyDfOHlI9yJ0GKZhkm1QD8NRsx xfHEKOjqF4aqepkynzZbaWk= X-Received: by 2002:a63:f048:0:b0:39d:6f6d:47ad with SMTP id s8-20020a63f048000000b0039d6f6d47admr1130450pgj.494.1649672522385; Mon, 11 Apr 2022 03:22:02 -0700 (PDT) Received: from makvihas.localhost.com ([2405:201:202b:15:4376:c658:ae1e:1781]) by smtp.gmail.com with ESMTPSA id z14-20020a17090a170e00b001cb7e69ee5csm4886318pjd.54.2022.04.11.03.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Apr 2022 03:22:02 -0700 (PDT) From: Vihas Makwana To: Larry Finger , Phillip Potter , Greg Kroah-Hartman , Michael Straube Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Dan Carpenter , Pavel Skripkin , Vihas Makwana Subject: [PATCH v2 2/7] staging: r8188eu: drop unnecessary wrapper _rtw_init_cmd_priv Date: Mon, 11 Apr 2022 15:51:31 +0530 Message-Id: <20220411102136.14937-3-makvihas@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220411102136.14937-1-makvihas@gmail.com> References: <20220411102136.14937-1-makvihas@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NO_RDNS_DOTCOM_HELO, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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-kernel@vger.kernel.org Drop unnecessary wrapper _rtw_init_cmd_priv and move its logic to rtw_init_cmd_priv. Signed-off-by: Vihas Makwana --- drivers/staging/r8188eu/core/rtw_cmd.c | 77 ++++++++++++-------------- 1 file changed, 34 insertions(+), 43 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index d53217900..3d1fdc852 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -15,47 +15,6 @@ * No irqsave is necessary. */ -static int _rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) -{ - int res = _SUCCESS; - - init_completion(&pcmdpriv->enqueue_cmd); - /* sema_init(&(pcmdpriv->cmd_done_sema), 0); */ - init_completion(&pcmdpriv->start_cmd_thread); - init_completion(&pcmdpriv->stop_cmd_thread); - - rtw_init_queue(&pcmdpriv->cmd_queue); - - /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */ - - pcmdpriv->cmd_seq = 1; - - pcmdpriv->cmd_allocated_buf = kzalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ, - GFP_KERNEL); - - if (!pcmdpriv->cmd_allocated_buf) { - res = _FAIL; - goto exit; - } - - pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ((size_t)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ - 1)); - - pcmdpriv->rsp_allocated_buf = kzalloc(MAX_RSPSZ + 4, GFP_KERNEL); - - if (!pcmdpriv->rsp_allocated_buf) { - res = _FAIL; - goto exit; - } - - pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((size_t)(pcmdpriv->rsp_allocated_buf) & 3); - - pcmdpriv->cmd_done_cnt = 0; - pcmdpriv->rsp_cnt = 0; -exit: - - return res; -} - static void c2h_wk_callback(struct work_struct *work); static int _rtw_init_evt_priv(struct evt_priv *pevtpriv) @@ -133,9 +92,41 @@ static struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue) u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { - u32 res; + u32 res = _SUCCESS; + + init_completion(&pcmdpriv->enqueue_cmd); + /* sema_init(&(pcmdpriv->cmd_done_sema), 0); */ + init_completion(&pcmdpriv->start_cmd_thread); + init_completion(&pcmdpriv->stop_cmd_thread); + + rtw_init_queue(&pcmdpriv->cmd_queue); + + /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */ + + pcmdpriv->cmd_seq = 1; + + pcmdpriv->cmd_allocated_buf = kzalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ, + GFP_KERNEL); + + if (!pcmdpriv->cmd_allocated_buf) { + res = _FAIL; + goto exit; + } + + pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ((size_t)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ - 1)); + + pcmdpriv->rsp_allocated_buf = kzalloc(MAX_RSPSZ + 4, GFP_KERNEL); + + if (!pcmdpriv->rsp_allocated_buf) { + res = _FAIL; + goto exit; + } - res = _rtw_init_cmd_priv(pcmdpriv); + pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((size_t)(pcmdpriv->rsp_allocated_buf) & 3); + + pcmdpriv->cmd_done_cnt = 0; + pcmdpriv->rsp_cnt = 0; +exit: return res; } -- 2.30.2