From patchwork Wed Mar 2 19:51:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 12766648 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A2A9C433F5 for ; Wed, 2 Mar 2022 19:51:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242120AbiCBTw2 (ORCPT ); Wed, 2 Mar 2022 14:52:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241912AbiCBTw0 (ORCPT ); Wed, 2 Mar 2022 14:52:26 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD133D95DF for ; Wed, 2 Mar 2022 11:51:42 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id x5so3743650edd.11 for ; Wed, 02 Mar 2022 11:51:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Yrb/BN+S9473Kdgr+x3ZnvUqcQCkSxkwALLKGoVRVpA=; b=bco7aZCvlsclt+bXgiGW0Lmyr342mKTH5p4LwAFnfSIesPFEJCgRbx4xB9RydhNRlC GR/3jvHFV5rgz3un5714um/qrP2rrJXAs31zCSCxfqoOKKAYYr0EXpuufMJIKHSnFocy dNNjniJ5DQh52lPQ6iT6cb4RgBE85dlHnmB+dmCexVJNePMUEzH1Q8/3mfcdXFNFfwfD bmok/i3W6ArB6nHprVnBFrn6fLdVQVhmaqkeAndDTxsvXK91Q15PpI+2/FBptiemN4+T wcNDN2qdhKfdF79ja4yEmHlDBjSSdtfteAl62JBQvAr9gPLDXCB7Chw5K7JmuQfcDxmK C+pg== 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:mime-version :content-transfer-encoding; bh=Yrb/BN+S9473Kdgr+x3ZnvUqcQCkSxkwALLKGoVRVpA=; b=n3WeCvFRcJ9Hl6R0diR3OKjokZeLpDiPPvQRLtr3DrxvevpWLAls227mz57baxrHlo Yzje0YqtUzaDhRRGuVr8y7HiWpO/9vjO2jP9J7YVAwvqGsCTI0IChMHMjmw3tYPlU5Te 90G8oCCCS/rg3sP30qIsBBUw8KVvwfP9mRMWbgo9CUR9cS+Ar4YDTzgwPCSGUYErysqL DQiiA+EFulRktMZyHXS6x+/y69dcDPb8dBIHhaexfLbq3pHu4kQWMfw/D8X0PHyvg9kF 0dq6iJ63GIsMiYbd0UNw3r60pmG6/uHXemyCgkAb2HII2ByjUDxwXdb2hH9phG52tTQl HOxg== X-Gm-Message-State: AOAM531inSmi4/ia5L8HpHFeBaDLuyP4VzAS8nTdBdPNmarJ6PeSWAGt 5Gk63HaxsPVvlf5jERuNI6WTRE1Ddck= X-Google-Smtp-Source: ABdhPJxsHXlSWJgwFlKrsmPYnlmLlgT2bjI60HYjKGacAY8Rmvg7E5OdYMiJRhiPKOe2Md+g++kkpQ== X-Received: by 2002:a05:6402:2549:b0:415:c31c:f9c2 with SMTP id l9-20020a056402254900b00415c31cf9c2mr3446902edb.335.1646250701410; Wed, 02 Mar 2022 11:51:41 -0800 (PST) Received: from debian64.daheim (p5b0d776b.dip0.t-ipconnect.de. [91.13.119.107]) by smtp.gmail.com with ESMTPSA id m7-20020aa7c487000000b00413a99bf3a3sm5620449edq.56.2022.03.02.11.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 11:51:38 -0800 (PST) Received: from chuck by debian64.daheim with local (Exim 4.95) (envelope-from ) id 1nPV0c-000IOz-G3; Wed, 02 Mar 2022 20:51:38 +0100 From: Christian Lamparter To: linux-wireless@vger.kernel.org Cc: Kalle Valo Subject: [PATCH v1 1/5] carl9170: replace GFP_ATOMIC in ampdu_action, it can sleep Date: Wed, 2 Mar 2022 20:51:34 +0100 Message-Id: <0036538d0933626a1a5eb2c2c3935cf173028926.1646250537.git.chunkeey@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Since ~2010, the driver is allowed to sleep in the ampdu_action callback thanks to: commit 85ad181ea788 ("mac80211: allow drivers to sleep in ampdu_action") Signed-off-by: Christian Lamparter --- drivers/net/wireless/ath/carl9170/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index 2208ec800482..f6974aff0c59 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c @@ -1412,7 +1412,7 @@ static int carl9170_op_ampdu_action(struct ieee80211_hw *hw, return -EOPNOTSUPP; tid_info = kzalloc(sizeof(struct carl9170_sta_tid), - GFP_ATOMIC); + GFP_KERNEL); if (!tid_info) return -ENOMEM; From patchwork Wed Mar 2 19:51:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 12766646 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8D0CC433FE for ; Wed, 2 Mar 2022 19:51:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241985AbiCBTw1 (ORCPT ); Wed, 2 Mar 2022 14:52:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231847AbiCBTwZ (ORCPT ); Wed, 2 Mar 2022 14:52:25 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CDE0D95CF for ; Wed, 2 Mar 2022 11:51:42 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id qt6so5985832ejb.11 for ; Wed, 02 Mar 2022 11:51:42 -0800 (PST) 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=6vyonuIYbQFfvGJr2SF2YCWFfmFUdkwV/iwFQ8ptY9o=; b=Lf6bvC7ZvEcvEo+aZnoz18dgO7rCFCPBJcdZxQPPCQ2pCO8+0DmA+lRPqiQiEhvE+o j8HkE16Bs1GqbEYmUKY+KTxkymjA3SEsqlwAQw1GLAYhkCGdLLXnU0gFWMSPB6YdCs3f ZSdLnjYjUEf5cQBqD2MjYi5LE6wV4o6FIir36MMp3iBDuqgUvQUC75UjpblVfBxNaF0i wEUSSbMEWbU1HTES7K90CBRAnAWhqWjmkOmVtKrxNYyKBkqxu+sLyKlLsgGKSuwnWQy5 odFproFtFAX2d6fLVDR6gYjza4CmjHyDpQM14ZGtV7alc9N2TrFijbPaWCVcWIFl1vhT KmDQ== 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=6vyonuIYbQFfvGJr2SF2YCWFfmFUdkwV/iwFQ8ptY9o=; b=sudMkC17nEa/bo36wo1GYim49PjeKQM0o6T55sTUkyeexHmE07BbkN+EvFgf3zzmQI 0VXLKLfP0yD5M2HDbjo+5GY+f7Dfs7QkULWbQ/7XZfrBFzHQuQ2mXGyUn1va324vJ0yH 21oD462sQ8MgdQDx3tB8l9d1sIoPYpc0tKO8ISPlvViuG0TJKt5xNQrSZPtp0u+NxEAU htuxjJTl3Fw3PxE84TDj7aDkyWYXnx4q9LH9yiah8M7VNEw3+sO3JuHxzF7ZPxLEfrKK oqZXfwQaazk+nBGSii7wC9o0APXGzdaOPOD9JnHR9H+D9GgtDfWBNMc8ldDPk4djC8qd ktlg== X-Gm-Message-State: AOAM53143y79AMhJkM0XT+fwlW1n+8+hHpE7wLkKwOmIz1DFx5jStO6S YtJxcea5JRvhmyX4loSgzlLWjB31Bpk= X-Google-Smtp-Source: ABdhPJyYmcJkTFq2Z8wdnnJBKp1DfTpVr/Rax8xUKTcaxzqa1Svedvv2otEDEJ6LZs7+j4vE67Jb+Q== X-Received: by 2002:a17:906:360a:b0:6b9:1f8:9cdd with SMTP id q10-20020a170906360a00b006b901f89cddmr24652482ejb.461.1646250700463; Wed, 02 Mar 2022 11:51:40 -0800 (PST) Received: from debian64.daheim (p5b0d776b.dip0.t-ipconnect.de. [91.13.119.107]) by smtp.gmail.com with ESMTPSA id t4-20020a056402524400b00415b90801edsm1243535edd.57.2022.03.02.11.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 11:51:38 -0800 (PST) Received: from chuck by debian64.daheim with local (Exim 4.95) (envelope-from ) id 1nPV0c-000IP1-Gh; Wed, 02 Mar 2022 20:51:38 +0100 From: Christian Lamparter To: linux-wireless@vger.kernel.org Cc: Kalle Valo Subject: [PATCH v1 2/5] carl9170: devres-ing hwrng_register usage Date: Wed, 2 Mar 2022 20:51:35 +0100 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: <0036538d0933626a1a5eb2c2c3935cf173028926.1646250537.git.chunkeey@gmail.com> References: <0036538d0933626a1a5eb2c2c3935cf173028926.1646250537.git.chunkeey@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org devres will take care of freeing the hwrng once it is no longer needed. Signed-off-by: Christian Lamparter --- drivers/net/wireless/ath/carl9170/carl9170.h | 1 - drivers/net/wireless/ath/carl9170/main.c | 29 ++------------------ 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h index 84a8ce0784b1..ba29b4aebe9f 100644 --- a/drivers/net/wireless/ath/carl9170/carl9170.h +++ b/drivers/net/wireless/ath/carl9170/carl9170.h @@ -458,7 +458,6 @@ struct ar9170 { # define CARL9170_HWRNG_CACHE_SIZE CARL9170_MAX_CMD_PAYLOAD_LEN struct { struct hwrng rng; - bool initialized; char name[30 + 1]; u16 cache[CARL9170_HWRNG_CACHE_SIZE / sizeof(u16)]; unsigned int cache_idx; diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index f6974aff0c59..9495b3da1978 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c @@ -1539,7 +1539,7 @@ static int carl9170_rng_get(struct ar9170 *ar) BUILD_BUG_ON(RB > CARL9170_MAX_CMD_PAYLOAD_LEN); - if (!IS_ACCEPTING_CMD(ar) || !ar->rng.initialized) + if (!IS_ACCEPTING_CMD(ar)) return -EAGAIN; count = ARRAY_SIZE(ar->rng.cache); @@ -1585,14 +1585,6 @@ static int carl9170_rng_read(struct hwrng *rng, u32 *data) return sizeof(u16); } -static void carl9170_unregister_hwrng(struct ar9170 *ar) -{ - if (ar->rng.initialized) { - hwrng_unregister(&ar->rng.rng); - ar->rng.initialized = false; - } -} - static int carl9170_register_hwrng(struct ar9170 *ar) { int err; @@ -1603,25 +1595,14 @@ static int carl9170_register_hwrng(struct ar9170 *ar) ar->rng.rng.data_read = carl9170_rng_read; ar->rng.rng.priv = (unsigned long)ar; - if (WARN_ON(ar->rng.initialized)) - return -EALREADY; - - err = hwrng_register(&ar->rng.rng); + err = devm_hwrng_register(&ar->udev->dev, &ar->rng.rng); if (err) { dev_err(&ar->udev->dev, "Failed to register the random " "number generator (%d)\n", err); return err; } - ar->rng.initialized = true; - - err = carl9170_rng_get(ar); - if (err) { - carl9170_unregister_hwrng(ar); - return err; - } - - return 0; + return carl9170_rng_get(ar); } #endif /* CONFIG_CARL9170_HWRNG */ @@ -2064,10 +2045,6 @@ void carl9170_unregister(struct ar9170 *ar) } #endif /* CONFIG_CARL9170_WPC */ -#ifdef CONFIG_CARL9170_HWRNG - carl9170_unregister_hwrng(ar); -#endif /* CONFIG_CARL9170_HWRNG */ - carl9170_cancel_worker(ar); cancel_work_sync(&ar->restart_work); From patchwork Wed Mar 2 19:51:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 12766649 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C42AAC433EF for ; Wed, 2 Mar 2022 19:51:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242355AbiCBTw3 (ORCPT ); Wed, 2 Mar 2022 14:52:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241654AbiCBTw2 (ORCPT ); Wed, 2 Mar 2022 14:52:28 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58E0BD95CF for ; Wed, 2 Mar 2022 11:51:43 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id qt6so5985922ejb.11 for ; Wed, 02 Mar 2022 11:51:43 -0800 (PST) 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=bCoxThg0BgDvUZW1SxPOzG8xYONpAW2nI0hT5dyuJ+8=; b=E1UR1coOBUydg9tjcKe22ruZqfCSDhM8R7IJODWapeZsAxvyy4jn/PAi/rQaR/hF+r lwgKyboCRZ0HUB2m87y+bb+wL8R+yWJt57q8LxUNLzx+jn6pfayuTTANn4ESI3h3IdTr o2yPn/XEPE5z8hCEOt0z9EvL8t2pA+pQp9r1Skjasu9DIUB+ylij8HgXHXPTKEzxzTlz Nyoo7UsPJRcBKWjnRsavcMA3zdFXpMRcXJRxnzvDZuoNsNmDKYWrKQSGqNAeYCMXGwGO DWmUn2BuzcNDpKc4llw0v/YtscpDVbNzuV+zpFhFPMBSOhrvFFXMurGguOfzXpSreRGj Ekzw== 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=bCoxThg0BgDvUZW1SxPOzG8xYONpAW2nI0hT5dyuJ+8=; b=iuNrjzV4+SsnpEn2iiA1hYBqY+RdJSMLvdD+r/HvIYSFkBDgDF/QwqAeK9bEbY2GkU Ra6lpPlrndwUa239bVozpzhcONi13tRFzxhGt+juK6uuloOqpVA566c1c7HjP0Ho19CJ ES6SPCZ+eqxcqoVgxP6aYw8Gg+KA8E+7/fEBv6mvi2/IIz45kWovSdSPIsqDqnY1CAh6 Z9XwydZRUnJYpzmBmH7HFkhrjHkXoB2nziqVshxP/tbahR+SJ4JAtkyYcvufVk6k2FE/ chYRaRotTuaSDWPyWyUrKYgeiNzCdcGi01GXyyIgFqZa8WSNyjA5K2j4eAE8PJp+ONue NrdA== X-Gm-Message-State: AOAM530dRUBL4+te4gYZnjTTDlRiRRd2T8FRwO6einWs/NaPhgRUVHlD 3MzEs7GIgHdKCRvF4d+rtDJGSsgZXk4= X-Google-Smtp-Source: ABdhPJxWlSvtuC29nF+E7m14ac5qWwtG3tuzUZSsIDHT5ORykNN2RehJC2Cm14LTUG5LISCN7nIGew== X-Received: by 2002:a17:907:3f9e:b0:6da:842e:873e with SMTP id hr30-20020a1709073f9e00b006da842e873emr1144996ejc.383.1646250701706; Wed, 02 Mar 2022 11:51:41 -0800 (PST) Received: from debian64.daheim (p5b0d776b.dip0.t-ipconnect.de. [91.13.119.107]) by smtp.gmail.com with ESMTPSA id qx13-20020a170906fccd00b006bdeb94f50csm6592339ejb.203.2022.03.02.11.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 11:51:38 -0800 (PST) Received: from chuck by debian64.daheim with local (Exim 4.95) (envelope-from ) id 1nPV0c-000IP3-HH; Wed, 02 Mar 2022 20:51:38 +0100 From: Christian Lamparter To: linux-wireless@vger.kernel.org Cc: Kalle Valo Subject: [PATCH v1 3/5] carl9170: devres-ing input_allocate_device Date: Wed, 2 Mar 2022 20:51:36 +0100 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: References: <0036538d0933626a1a5eb2c2c3935cf173028926.1646250537.git.chunkeey@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org devres will take care of freeing the input_device once it is no longer needed. Signed-off-by: Christian Lamparter --- drivers/net/wireless/ath/carl9170/main.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index 9495b3da1978..e833052e9056 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c @@ -1494,7 +1494,7 @@ static int carl9170_register_wps_button(struct ar9170 *ar) if (!(ar->features & CARL9170_WPS_BUTTON)) return 0; - input = input_allocate_device(); + input = devm_input_allocate_device(&ar->udev->dev); if (!input) return -ENOMEM; @@ -1512,10 +1512,8 @@ static int carl9170_register_wps_button(struct ar9170 *ar) input_set_capability(input, EV_KEY, KEY_WPS_BUTTON); err = input_register_device(input); - if (err) { - input_free_device(input); + if (err) return err; - } ar->wps.pbc = input; return 0; @@ -2038,13 +2036,6 @@ void carl9170_unregister(struct ar9170 *ar) carl9170_debugfs_unregister(ar); #endif /* CONFIG_CARL9170_DEBUGFS */ -#ifdef CONFIG_CARL9170_WPC - if (ar->wps.pbc) { - input_unregister_device(ar->wps.pbc); - ar->wps.pbc = NULL; - } -#endif /* CONFIG_CARL9170_WPC */ - carl9170_cancel_worker(ar); cancel_work_sync(&ar->restart_work); From patchwork Wed Mar 2 19:51:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 12766645 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74AC0C433EF for ; Wed, 2 Mar 2022 19:51:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241886AbiCBTw0 (ORCPT ); Wed, 2 Mar 2022 14:52:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240435AbiCBTwZ (ORCPT ); Wed, 2 Mar 2022 14:52:25 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35A9BD95D0 for ; Wed, 2 Mar 2022 11:51:42 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id r13so6044024ejd.5 for ; Wed, 02 Mar 2022 11:51:42 -0800 (PST) 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=//V6s70njW8Gqdv3PUMtK2rANsRzdBZe0tVhsi6Kse0=; b=S22zYVEoY8+z0lYLmvbJTkAiKzRGVyumBIZvSgJsrTx8rXQKrZAYgfc7SI+toIr13+ ptAM8Ii7gE+KeEdKuHY2mR19ijMMCCGUbWKLsi7L7t+iW0hHyoRRc86PwEt5oauXTvpq Liq1+Q5o9LV6GjaLMOUE0ZE3FBXkJoROYF3MGdTUN49+kNU4kciDiy/gJZPGeulM5i/F yU33VilDSOFA0sFFrfgTZHzEzZ3zz7aHzHGRQ5PIJeEc98lZgqGHUu/EvZeMty6f1yEZ BXTVwSpnayZxXoal5itcbXHKP7zelQ8s0Qjdg6ZmzQ88lOLfeHuyKWv9Yy/8JECvExng htlQ== 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=//V6s70njW8Gqdv3PUMtK2rANsRzdBZe0tVhsi6Kse0=; b=MArR8+HwgLYC/QLwGckE0OMz6VulOgsV3mKuu8taXzAq9X2x+YW4sRG7FjLxldN3tj HcyEgKpbrn4q54ZCZO4sYZQ51KUtyJOxd47p5RtGJoYJUvGhVMZwAoSYv61/t7Zp+7Oe VBoMBFG6//9XwpsLgGQrgf9DaXxS89usBZ1YoZCfm3PHYf3lxgQs5XziJbroumRp4G7/ RPByfwV6y3yRjs0I+WuE6R5rmFlk3bx2v+df7Jc6BTvBvbmQFenfbpxdK9II2u9mjp4X 0+4wZzkpUGdEQlwUNdsh9UIq5M4NjAcue1ONWyefWurpFoiC6RfmweBWxWIoVXWnL+If 2UOw== X-Gm-Message-State: AOAM531YP0CbPtPm8HZ8VVLgZgIm8WQFpwlG7p3SXIu4XhDnErej62oH 7OUzceC+k7miVoOJIsjEKK7TcGd0pTE= X-Google-Smtp-Source: ABdhPJyBWnPsbgaLBzhEAboNhKLPGtsfO0zXdMeGDP4zjaPkmg2rsFbvMa629AWyGGZXkMeBk730nA== X-Received: by 2002:a17:906:130f:b0:6ce:88a9:42fa with SMTP id w15-20020a170906130f00b006ce88a942famr24107501ejb.469.1646250700767; Wed, 02 Mar 2022 11:51:40 -0800 (PST) Received: from debian64.daheim (p5b0d776b.dip0.t-ipconnect.de. [91.13.119.107]) by smtp.gmail.com with ESMTPSA id n6-20020aa7c786000000b00410d2403ccfsm8841837eds.21.2022.03.02.11.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 11:51:38 -0800 (PST) Received: from chuck by debian64.daheim with local (Exim 4.95) (envelope-from ) id 1nPV0c-000IP7-Hp; Wed, 02 Mar 2022 20:51:38 +0100 From: Christian Lamparter To: linux-wireless@vger.kernel.org Cc: Kalle Valo Subject: [PATCH v1 4/5] carl9170: replace bitmap_zalloc with devm_bitmap_zalloc Date: Wed, 2 Mar 2022 20:51:37 +0100 Message-Id: <0a79221aa5477501c3def032e95ef8018973a514.1646250537.git.chunkeey@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: <0036538d0933626a1a5eb2c2c3935cf173028926.1646250537.git.chunkeey@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org the mem_bitmap is kept around for the lifetime of the driver device. This is a perfect candidate for devm. Signed-off-by: Christian Lamparter --- drivers/net/wireless/ath/carl9170/main.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index e833052e9056..fae927ca4863 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c @@ -1943,11 +1943,7 @@ int carl9170_register(struct ar9170 *ar) struct ath_regulatory *regulatory = &ar->common.regulatory; int err = 0, i; - if (WARN_ON(ar->mem_bitmap)) - return -EINVAL; - - ar->mem_bitmap = bitmap_zalloc(ar->fw.mem_blocks, GFP_KERNEL); - + ar->mem_bitmap = devm_bitmap_zalloc(&ar->udev->dev, ar->fw.mem_blocks, GFP_KERNEL); if (!ar->mem_bitmap) return -ENOMEM; @@ -2050,9 +2046,6 @@ void carl9170_free(struct ar9170 *ar) kfree_skb(ar->rx_failover); ar->rx_failover = NULL; - bitmap_free(ar->mem_bitmap); - ar->mem_bitmap = NULL; - kfree(ar->survey); ar->survey = NULL; From patchwork Wed Mar 2 19:51:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 12766647 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53754C4332F for ; Wed, 2 Mar 2022 19:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241990AbiCBTw1 (ORCPT ); Wed, 2 Mar 2022 14:52:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241654AbiCBTw0 (ORCPT ); Wed, 2 Mar 2022 14:52:26 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B7CFD95D8 for ; Wed, 2 Mar 2022 11:51:42 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id qx21so5966952ejb.13 for ; Wed, 02 Mar 2022 11:51:42 -0800 (PST) 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=xRoBG7B0zH0T2Cz4z4vAwwSe16WQ3ILZgUAbzOIFsNc=; b=K0OBZ7grkGPMVqdFKYZXXKZdC4KgpmdEWNFFzR5UjHlv+iaWCuyN5V3DnjZwJkvOu/ 3f9OIw201YuRfByTzmunSRU2q8ViIJnfrBN5sr3B8JW8NSAyoTVZLWZaGzPVQakWh9LZ eE6GhNB/Ry10VwImGU6nQWHw+5Yec/VqkwWAgWywrFnuNz+bO8JEWqsfalNpAK5Elbqz oetgOUxVEK30iHSOTKp43xmUpXGN2T7Ip4SBH/fiNUQrGq7TVB1hRoUu1fyIN+0crSgk apR2GQqB0gUXahOG83jlnckuM3w5JoiPfBABuN20ur5YrHzGiTQreSMoMuw5JNWmEMSY hezg== 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=xRoBG7B0zH0T2Cz4z4vAwwSe16WQ3ILZgUAbzOIFsNc=; b=ma6rbbl+eJ6Kthd6N5SwPhT8iCltSNVmP0duyv4ovLTEJXyzfyUsptMLrdZtZXnI5a 6GN2n966nTa/rO6WklAGT2rxgmtfaPun9gOy3/eeTqEwrtMrYCWhWkd7T5iRt5EJxNk/ MNCCMDJXxioM1SKPBLeuo90LMNuE03//jGjGN1Y6OLdL0qSgAFXbZE4/94c4qKWm9h50 xZkhC1BL9cO//YG+/qxw1MpZfRaZ74yokY3g5KiB5TXF+KckV1mhZgMYYVovuV4MZogU aqIuW7XzIg7o0XS1yW5CiSnp7WPaZbunyC2yC/FG6vgWQ+n8W/MvMlI46QsxsDTMWNg/ XUZw== X-Gm-Message-State: AOAM532fv/N/CkETn3kDX8mTpnLd8zOniMisHw/jydsgKhr8oauIYmru HgyZI8UUcmfoI2WtFDJOLviI7nyCMco= X-Google-Smtp-Source: ABdhPJzQvNOonSOApOmECH3r7vaz9ot8uaA4BHEjmTSTtMR2XLnMegT5BAEjesJS783xyg/wylTHbA== X-Received: by 2002:a17:907:6e24:b0:6d9:43f1:d3ce with SMTP id sd36-20020a1709076e2400b006d943f1d3cemr4003419ejc.166.1646250701068; Wed, 02 Mar 2022 11:51:41 -0800 (PST) Received: from debian64.daheim (p5b0d776b.dip0.t-ipconnect.de. [91.13.119.107]) by smtp.gmail.com with ESMTPSA id n6-20020a170906724600b006d4e2f6857dsm6620806ejk.139.2022.03.02.11.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 11:51:38 -0800 (PST) Received: from chuck by debian64.daheim with local (Exim 4.95) (envelope-from ) id 1nPV0c-000IPA-IM; Wed, 02 Mar 2022 20:51:38 +0100 From: Christian Lamparter To: linux-wireless@vger.kernel.org Cc: Kalle Valo Subject: [PATCH v1 5/5] carl9170: devres ar->survey_info Date: Wed, 2 Mar 2022 20:51:38 +0100 Message-Id: <9b9a059b384f49587f4384ba47f01d3fb2115b22.1646250537.git.chunkeey@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <0a79221aa5477501c3def032e95ef8018973a514.1646250537.git.chunkeey@gmail.com> References: <0036538d0933626a1a5eb2c2c3935cf173028926.1646250537.git.chunkeey@gmail.com> <0a79221aa5477501c3def032e95ef8018973a514.1646250537.git.chunkeey@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org driver keeps the same survey_info struct for its lifetime around. This is used because while firmware does help by providing accounting information of the current channel, it doesn't keep track on the remaining channels. Signed-off-by: Christian Lamparter --- drivers/net/wireless/ath/carl9170/main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index fae927ca4863..76e84adf57c1 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c @@ -1916,7 +1916,8 @@ static int carl9170_parse_eeprom(struct ar9170 *ar) if (!bands) return -EINVAL; - ar->survey = kcalloc(chans, sizeof(struct survey_info), GFP_KERNEL); + ar->survey = devm_kcalloc(&ar->udev->dev, chans, + sizeof(struct survey_info), GFP_KERNEL); if (!ar->survey) return -ENOMEM; ar->num_channels = chans; @@ -2046,9 +2047,6 @@ void carl9170_free(struct ar9170 *ar) kfree_skb(ar->rx_failover); ar->rx_failover = NULL; - kfree(ar->survey); - ar->survey = NULL; - mutex_destroy(&ar->mutex); ieee80211_free_hw(ar->hw);