Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1954472lql; Wed, 13 Mar 2024 12:57:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUC0dYwgyAtJOYFch+Bsa6a1iqTzOx9oSUIATVlgCh26oopuV7ZNkFXXc2pSDaardh8/J1BKcWfnx4E9ocwJzm1XWStfIsb+0Ai57Qjsw== X-Google-Smtp-Source: AGHT+IGjlmEfksHhtYBGfN7xTUF8HsY06otr8U+bHLR3cCLKJRfYsqXlKrAbfU4XzpBvHjLEumYe X-Received: by 2002:a0c:df04:0:b0:68f:44eb:b944 with SMTP id g4-20020a0cdf04000000b0068f44ebb944mr996194qvl.15.1710359823906; Wed, 13 Mar 2024 12:57:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710359823; cv=pass; d=google.com; s=arc-20160816; b=axNxs2fjigQhaROJeYsrruIdP7Au0zj1+k6QWbvTqicv2iaqSrmDdbNTH4lpzBo8jV lQlwr9uyzdZybuwm2p5jJLCHbTGZa3bIgEJ9FMGDZkC3MFjeKwOMdAz59xkElU1WFphE UufTfslRGbFzYXf9EGN+0w+ZdwF4JVMFM8rFgJZzumbJaFy98E3L8T4jp45Y+ZDbN7b4 5NXH9KTOZL5SjLVUbWhT/XkiPsIgu68En+1Hd0ar2bEuE1kMl3hR8b4Bk1Ah7JZLsuAn Z+kHmU7HEdatAk19X48+ZIy7KrR7qKd1hN6uWm+bhhOdQebYo3Ntsh/OYhxmDr3zp+Vx 1KkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=R9BIhdFsSeXM2bYHGsp/3rh0lF2hEZKMymreY4sLWlo=; fh=vEZPNsynO8VApCQftqekiatFf+vl2grsMNvNyx3YEQo=; b=BOwG7q1t9jemO7Qczs9RViw4pijxcwDghm+V0ZY785u4dV52ReCaSaKDCDEkEIoRkE FG4bEG0teRTLNRV+xAmDSV9XjPZveiDxhLr63ajea+LEq99qE6UGilc8X39EMR8osH+A rOzpdvwR2Tyx3dVdhj/45BW5Ojjx53XFKknLQb+LNoHKRI/wYdlcOiVIb4R91F/9JI+c Rei2JG2+CO0RcSJzmEujHjpKllhXY4Wz1LKBKTcBOtsXHh137G60dXx0kb279O0RYBri ACvLT5VDy2bomBSwylqmwnHPGSvh4YbcceOoPpqz20dNQ6gbvd1g5grnONNvxsSN2+jt DCGw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WlztrFQj; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-4697-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4697-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 12-20020a0562140dcc00b00690cfe922f5si8022340qvt.400.2024.03.13.12.57.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 12:57:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4697-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WlztrFQj; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-4697-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4697-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5D3ED1C25CE2 for ; Wed, 13 Mar 2024 19:57:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74D2A50261; Wed, 13 Mar 2024 19:57:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WlztrFQj" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 E3A2D4F88A for ; Wed, 13 Mar 2024 19:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710359822; cv=none; b=MVcnY/hC4xC8W4XSX84uo5u7pNRwuBu4uXI+IQ3h327JzWdMKdnXYlj2T255jPkbEvvB2fcD3d0KmFacStRO7FIWqsxK/FTfLYnREcJpNUT1JN+haYIYzSq3sya6xMNOvwIY+1wlAbfGbJD7brXJitf1vbksyZ+maNCaeisvPkA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710359822; c=relaxed/simple; bh=Ig7e77/d/kykTewz4aOEKwihFw8EYCmrLassdKaTYVI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=aW3qFFPf1CUjaPuxkPre0k2Oj7KQnl/k5XA1+sjnG4YdNvGrPSpi3pgOSPWpJGJJaYLNUg+uKAr5LLg4nYUrgQpZK9IQnPDFznKhGnAEaVgO3Bvl0gynzAolfmt/4sd9Fm6s7pQvNDro8EHauCLhUWk49xQpPJWKJ7wuBkIwDiY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WlztrFQj; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1dd81aee2b4so2098205ad.0 for ; Wed, 13 Mar 2024 12:57:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710359820; x=1710964620; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=R9BIhdFsSeXM2bYHGsp/3rh0lF2hEZKMymreY4sLWlo=; b=WlztrFQjxrneNKCYab1vGQHzoi52HRwfHPB+kQayElmHSN1wQpZJdICI5UaGqO173w Pr1KrUo+u4fZXBuOVYti8d5KXLulix+P+1hnN5cKsvr47+fNepL1czSM+HBKoQM3U/SE NjuFaEveJmd16SUvtJTA3F1FeHsSn9o5fRzaEXDQQFektKvOkF11uvJy/Nsi351BLclK Bcef/Qq+GzLfJgUwMBT+gYvk8bxCOW54WawNR2hWGAkLjnO4mv/e/itiHE6uUMq4Tf8t aMMc6j70RfLC35CTWf/RGjFcCoeGMMjwksFuWv/eZkme5COs1hKPZ161Fx4Qq06kwLuH AcSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710359820; x=1710964620; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=R9BIhdFsSeXM2bYHGsp/3rh0lF2hEZKMymreY4sLWlo=; b=qAphzv9fpqiDre7DDbJZ8K7mKn/G3gpl5cwf95no2ig5npwdIRFtwSV+Mqd8PDSNUJ zlTCaACm05XSPMjmtQX7jGZNChpyrv3XffhIMsjNZiNhZN7cz7/wm7YY359Idv1t8J06 gf6eaF4FlbgDLj4A1r4TAbkp1br23Nv2+ufVVVp6+9GHS19jpGcxwKXGZDEFDMvsPRnD xHoqumhiw5pjVjSCmrTF5DM7nVp3h9H3AH/XnzXSQU1eMYPCcSPDL1hbFj9hYYqrnG/o GoIeZvbn134sy9XWMETa4+IMovF8cQ5dxtJlRpEBzYmF8LY+TOm6n9EBx5TBh0h9ZqYA Ou9g== X-Forwarded-Encrypted: i=1; AJvYcCVUQibODIjl0WsE5eLhYUidNZR0iCNQBrYrowU7lHVOfuhRC7TFsg6tUQzr8upVKVpSEzcFZ1qrm62tEOqZP+lk3vNHssC4wy5RJgYa8tk= X-Gm-Message-State: AOJu0YycUF7Jpve8sX1lQqawkikezm5CasTc7wws8ENMk2C4TyQ/bTXO 5KlxCVAc3Rbl2xOfa7wW+okGRTkPvl23emIN2jm4WAuME+hBCU9apWZe7JfOZwJgDT4/kbI15tH 9Km7C2UHnyyxWSF6631JfqICUBNg9RbDxeMw= X-Received: by 2002:a17:902:7403:b0:1dd:e34:d820 with SMTP id g3-20020a170902740300b001dd0e34d820mr15001228pll.28.1710359820091; Wed, 13 Mar 2024 12:57:00 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240312135557.1778379-1-quic_ramess@quicinc.com> <20240312135557.1778379-2-quic_ramess@quicinc.com> <4a527729-2bf8-47ce-8275-d36b76bde95c@quicinc.com> <3178cf8c-d328-4fe2-b3be-f5c4c908f20f@quicinc.com> <605a673e-3686-47d0-b71b-1e314fde65db@quicinc.com> <87il1qf571.fsf@kernel.org> <87edcef4qi.fsf@kernel.org> In-Reply-To: From: Jonas Gorski Date: Wed, 13 Mar 2024 20:56:48 +0100 Message-ID: Subject: Re: [PATCH v4 01/12] wifi: ath12k: add multiple radio support in a single MAC HW un/register To: Jeff Johnson Cc: Kalle Valo , Rameshkumar Sundaram , ath12k@lists.infradead.org, linux-wireless@vger.kernel.org, Karthikeyan Periyasamy Content-Type: text/plain; charset="UTF-8" On Wed, 13 Mar 2024 at 20:18, Jeff Johnson wrote: > > On 3/13/2024 9:58 AM, Kalle Valo wrote: > > Kalle Valo writes: > > > >> Jeff Johnson writes: > >> > >>> On 3/13/2024 5:57 AM, Rameshkumar Sundaram wrote: > >>>> On 3/13/2024 3:23 AM, Jeff Johnson wrote: > >>>>> and guess we have to figure out how to suppress the ath12k-check issues with > >>>>> this macro > >>>> ath12k-check complains about the reuse of ah and index arguments which > >>>> may get evaluated multiple times if its an arithmetic expression, But > >>>> areas where we use the macro in our code aren't doing so. > >>>> Do you have any suggestions here ? or shall we go back and use this > >>>> for-loop inline. > >>> > >>> The macro makes sense -- we'll need to update the overrides in ath12k-check. > >> > >> IIRC it is possible to avoid variable reuse in macros with typeof() > >> operator (or something like that). I can't remember the details right > >> now but I think there are examples in the kernel code. > > > > Here's the GCC documentation with an example: > > > > https://gcc.gnu.org/onlinedocs/gcc/Typeof.html > > > > the problem here is that the macro actually writes to those arguments multiple > times, so we actually need to reuse the arguments > > the macro as defined exactly matches the semantics of other for_each macros in > the kernel, i.e. see in include/linux/list.h: > #define list_for_each(pos, head) \ > for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next) > > what I don't understand is why list_for_each() doesn't trigger the same > checkpatch issues. even stranger is that if I copy that macro into ath12k then > I do see the same checkpatch issues: > CHECK: Macro argument reuse 'pos' - possible side-effects? > #998: FILE: drivers/net/wireless/ath/ath12k/core.h:998: > +#define list_for_each(pos, head) \ > + for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next) > > CHECK: Macro argument reuse 'head' - possible side-effects? > #998: FILE: drivers/net/wireless/ath/ath12k/core.h:998: > +#define list_for_each(pos, head) \ > + for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next) > > So I'm really confused since I don't see anything in checkpatch.pl that would > cause the behavior to change between macros in include/linux/list.h vs macros > in drivers/net/wireless/ath/ath12k/core.h The definition of the macro causes the complaint, not the usage of it. If you run checkpatch.pl on include/linux/list.h, you'll get the same output: $ ./scripts/checkpatch.pl --strict --file include/linux/list.h ... CHECK: Macro argument reuse 'pos' - possible side-effects? #686: FILE: include/linux/list.h:686: +#define list_for_each(pos, head) \ + for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next) CHECK: Macro argument reuse 'head' - possible side-effects? #686: FILE: include/linux/list.h:686: +#define list_for_each(pos, head) \ + for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next) ... Best Regards, Jonas