Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp205495pxf; Wed, 10 Mar 2021 04:33:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6/ZvByeQ8O0fZXe1fqTqtmHD7AQx+XdKA++TTwjmaOynRd31fXiOEiCsKIma8ir+pvmvn X-Received: by 2002:a05:6402:5244:: with SMTP id t4mr3033928edd.87.1615379583458; Wed, 10 Mar 2021 04:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615379583; cv=none; d=google.com; s=arc-20160816; b=oMgy7c0zFRzwvkTmZ2e20lhgeox1hzT9SOHyJi3BG0ENQOULH6AqC2RGqKO9bEUWFD JRYvsWZ3LFO7CBFd/8Z0jto/4aiLMHatiXlOtjB+HGHcHOcCupcUtMkoK/RJk5KsxnAV HAyr8fC0HXQMgiAtQ43qMkRK99AGSfz3XBrL6wg9xzy+VD2wU3/cq1sJbd4T/2Dv5Yr9 RlTO4Cp4UkPLd+TiVt2uwdTbRQ1tAqi4oEwrlntoP1RLnvwnW4Rszjqdr73oCjtKeaII vBlbHaWcTmDuYz22XNBvZ9xHceiQZv7k6hvIfmxkO7jwzliO3ViGH/wpPI4NytaUfIUG x0pw== 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; bh=6PEHWMnPB7IQntvRh4UqsPrXjx5GMPtnwV00rN+/M5A=; b=sx55eCuFWRh073N+d876cbDQlZMyVDx90pt9YfMYP/kXDxICe+2s/3gcBd01VRO3Ow NR1/K5nrhqtWd0d2YjKIZJLmAcbemmKHv7snEEmzMFfdiDVqO5YmDGVy9UCoh1KM9X1Z c2wG1D/FmQw1zC8oDxdw8dq9Ufc6Ej1394J8yhe9uql6gFv6QFecTMK8qL4N+ESxGa61 ome9Sz8Ud7WTjHSr3IKHL16XiuqUrediZgQPx/35vf7OJXedWb6xq8DigJ7FAFK4poxW IRRBz1nRtGwL//DsN8xwcqqZepjHberBF1/TADZDmQIuhkf0eydJOKwvGHt56IYGnv4X cZ4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 40si11175664edq.26.2021.03.10.04.32.35; Wed, 10 Mar 2021 04:33:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231956AbhCJMb2 (ORCPT + 99 others); Wed, 10 Mar 2021 07:31:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230081AbhCJMbS (ORCPT ); Wed, 10 Mar 2021 07:31:18 -0500 Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59142C061760 for ; Wed, 10 Mar 2021 04:31:18 -0800 (PST) Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id BC3769D83C; Wed, 10 Mar 2021 12:31:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DwWdq4Z6Wz3F5K; Wed, 10 Mar 2021 12:31:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 73E401042; Wed, 10 Mar 2021 12:31:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 47C698D4A157; Wed, 10 Mar 2021 12:31:09 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 65D16E707DF; Wed, 10 Mar 2021 12:31:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id vBufYr1yu8lY; Wed, 10 Mar 2021 12:31:06 +0000 (UTC) Received: from [127.0.0.1] (unknown [IPv6:fde9:577b:c1a9:4902:408a:bbb4:e93e:18d9]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 919B4E707B5; Wed, 10 Mar 2021 12:31:06 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Kalle Valo" Cc: linux-wireless@vger.kernel.org, luciano.coelho@intel.com Subject: Re: [PATCH iwlwifi-next] iwlwifi: de-const properly where needed Date: Wed, 10 Mar 2021 12:31:05 +0000 X-Mailer: MailMate (2.0BETAr6151) Message-ID: In-Reply-To: <87tupvcp6t.fsf@tynnyri.adurom.net> References: <87tupvcp6t.fsf@tynnyri.adurom.net> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 1 Mar 2021, at 7:23, Kalle Valo wrote: > "Bjoern A. Zeeb" writes: > >> In order to de-const variables simply casting through (void *) is >> not enough: "cast from 'const .. *' to 'void *' drops const >> qualifier". >> Cast through (uintptr_t) as well [1] to make this compile on systems >> with more strict requirements. >> In addition passing const void *data to dma_map_single() also >> drops the (const) qualifier. De-constify on variable on assignment >> which may be overwritten later. In either case the (void *) cast >> to dma_map_single() is not needed (anymore) either. >> >> [1] See __DECONST() in sys/sys/cdefs.h in FreeBSD >> >> Sponsored-by: The FreeBSD Foundation >> Signed-off-by: Bjoern A. Zeeb > > Why are we using the const in the first place? That sounds like a bug > to > me. For the he_cap cases I’ll leave this to Intel to answer as they added the comment that it is writeable. For the dma_map_single(.., DMA_TO_DEVICE) having const data is probably okay. This seems more (and I can only say from the distance not knowing Linux internals) that the Linux KPI doesn’t/cannot cater for it. I am not sure why it would need to change a virtual address along the lines and the argument is not “const”. > BTW, your patches are hard to read due to excessive context, I guess > you > are using a very large context value with diff? Our recommendation is > to > use git with default values, see the wiki below for more info. Sorry. I’ll fix the three casts you mentioned on the other review and send out v2 with less context for all of them. Best Regards, Bjoern