From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta1.migadu.com (out-192.mta1.migadu.com [95.215.58.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 662BC3DB30C for ; Tue, 25 Aug 2026 08:08:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.192 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787645302; cv=none; b=o7+YIsLEDSirEiLt1B0nJWxYrurdsLvYq5KxZqpAQd7oo1/YNEq7TDrCN1ccT2lNYe4hRIRSy7JOCqI9OFj+N50PKrnPpTcskGHyZmwj8CJ714qh/96vR1vxHUsXwow6FsqP7f5DinDCrb8MKIX+qmZadPuM78i8B5+CzG9QMD0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787645302; c=relaxed/simple; bh=xwSCTUisnEan090oTItdJ4c5cg/rEdInRMJkKPoeQ5I=; h=Date:From:To:CC:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type; b=i4NxBZq5+hqA1/0Kr126qN72t7i7h8mAoRuU2T03RyST0qGYMWHXUuLFplBv/RgQulQQIzji5mblb6mYqKfaKCnKAzJCBu844G4P8aPDCxX1UBbB+f3wSSfMMAbM537eKdyTIIzhXxO///mSexxcp9i++JNFJIvtkCLlCG+73uc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=HqWUk0sJ; arc=none smtp.client-ip=95.215.58.192 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="HqWUk0sJ" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=xwSCTUisnEan090oTItdJ4c5cg/rEdInRMJkKPoeQ5I=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1787645295; v=1; x=1788250095; b=HqWUk0sJQqxy6JXCm86jWqkNhrowzLafSFeve9ubGHLswbZ8jtL+aZees1ShBza28Mii3Tmg G6aJwoBq1RpvbxTLEYBo47MkRKFlP1ahg0zfnCOi0x0Sg3NNAmtcF5Bpxz6YKsD5OHhXPF7eDhb UdP5cJh0zuH52SjgL9992ksw= X-Envelope-To: linux-kernel@vger.kernel.org Received: from ehlo.thunderbird.net (31.223.131.35) by smtp.migadu.com with ESMTPS id 93f490c8784e81a4; Tue, 25 Aug 2026 08:08:05 +0000 X-Mizu-Trace-ID: 93f490c8784e81a4 X-Migadu-Flow: FLOW_OUT Date: Tue, 25 Aug 2026 10:07:59 +0200 From: Luka Gejak To: Ping-Ke Shih , "linux-wireless@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" , Michael Straube , Bitterblue Smith , Peter Robinson , Hans de Goede , luka.gejak@linux.dev Subject: =?US-ASCII?Q?RE=3A_=5BPATCH_v7_4/6=5D_wifi=3A_rtw88=3A_sdio=3A_track?= =?US-ASCII?Q?_free_TX_pages_and_OQT_credits_for_RTL8723BS?= User-Agent: Thunderbird for Android In-Reply-To: <68a844f5ea2b4eea827da95080a9dbcb@realtek.com> References: <20260820090412.19574-1-luka.gejak@linux.dev> <20260820090412.19574-5-luka.gejak@linux.dev> <17c3c1f641fe41c4bfacb989af4b75a6@realtek.com> <68a844f5ea2b4eea827da95080a9dbcb@realtek.com> Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On August 25, 2026 9:50:05 AM GMT+02:00, Ping-Ke Shih wrote: >Luka Gejak wrote: >> On August 25, 2026 9:25:13 AM GMT+02:00, Ping-Ke Shih wrote: >> >Luka Gejak wrote: >> >> Hi Ping-Ke, >> >> >> >> On August 25, 2026 8:12:58 AM GMT+02:00, Ping-Ke Shih wrote: >> >> > guard(mutex)(&rtwsdio->tx_credit_lock); >> >> >> >> The lock is only taken for this chip, and guard() is unconditional, = so I >> >> split the locked region into its own function instead of branching a= round >> >> the lock: >> >> >> >> if (!rtw_is_8723bs(rtwdev)) { >> >> txsize =3D sdio_align_size(rtwsdio->sdio_func, skb->= len); >> >> >> >> ret =3D rtw_sdio_check_free_txpg(rtwdev, queue, txsi= ze); >> >> if (ret) >> >> return ret; >> >> >> >> return rtw_sdio_write_to_port(rtwdev, skb, queue, tx= addr, >> >> txsize); >> >> } >> >> =2E=2E=2E >> >> guard(mutex)(&rtwsdio->tx_credit_lock); >> >> >> >> return rtw_sdio_8723bs_write_port(rtwdev, skb, queue, txaddr= , txsize, >> >> write_size); >> > >> >I meant >> > >> > if (rtw_is_8723bs(rtwdev)) >> > guard(mutex)(&rtwsdio->tx_credit_lock); >> > >> >Doesn't it work? >> > >> > >>=20 >> I tried it, and no=2E guard() expands to a declaration, and a declarati= on >> cannot be the body of an if, so it does not build: >>=20 >> sdio=2Ec: In function 'rtw_sdio_write_port': >> include/linux/cleanup=2Eh:302:9: error: expected expression before >> 'class_mutex_t' >> 302 | class_##_name##_t var __cleanup(=2E=2E=2E) =3D >>=20 >> Adding braces builds cleanly, which is the more dangerous version, beca= use >> the cleanup then runs at the closing brace and the mutex is released ag= ain >> before any of the code it is meant to protect runs=2E >>=20 >> That is why I moved the locked part into its own function: the guard ne= eds >> a scope that is exactly the critical section, and an if body is either = too >> small or not allowed=2E > >Okay=2E Got it=2E > > Do you mind answering this question, it seems like you missed it: The unaligned SKB warning now sits in both callers rather than once inside rtw_sdio_write_to_port(), because __func__ would otherwise report rtw_sdio_write_to_port for every other SDIO chip where it reports rtw_sdio_write_port today=2E Keeping that message identical costs three duplicated lines=2E Putting it once in rtw_sdio_write_to_port() is the tidier code and arguably the more accurate message, at the price of changing a log line on chips this series is not about=2E I went with the duplicate to leave the other parts alone, but I have no strong feeling either way, so say which you prefer=2E