From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4D60221F0A; Mon, 2 Jun 2025 14:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748873049; cv=none; b=eQZ10Ue3nw6VGA4R40smvf3OPbUFhgkMG+mwmFlRcCx359jufijGf8ZH7TbmlK49//ygOcIiAObgDnTDv7nxU9em/WmQJaxJvy45TLXHvDUJxsLS1sRJS/CP3YsYdXjFxTc+Lr5ikRXSXOx5+nNg8zJ6ugVAPEkZArM5UAdS3J4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748873049; c=relaxed/simple; bh=GNkAOfvOJD8a7cxtKUEwYI1UDi7UyCfTe+y3uIVXuYE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z0c+nOKiA9kD5ject2CKeKk9ZPnCHFtNXPLpGCOvS1/qEcHj3d3qbJKJCmgxjo4kkZjMHOydkMuw9zfbJXw/vkoXC13W12YYGrZcC94fWS53tEaXsEZUb1fEf+fwuO7UlOLyi+VqRgULuNWa4eUZwY8Z4zVvDHdQuhOH378/OdY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OelKayJT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="OelKayJT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA2DDC4CEEB; Mon, 2 Jun 2025 14:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748873049; bh=GNkAOfvOJD8a7cxtKUEwYI1UDi7UyCfTe+y3uIVXuYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OelKayJTDtulvt/sYP0UUct07jCx9UnwHrmga3crE4IzxTE5+1A4Ub5IGYH97dHdC wAmYMeA01fvG6SX0p7mqstZokgaqk1o8SFwb5EWnv7B2A34jL9BGlMn/TkTFLYROKy Bo7ElfIrXSPqd85vp4SUV7LxKm8roHZ21okh1YSU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andy Shevchenko , Jakub Kicinski , Marek Szyprowski , Sasha Levin Subject: [PATCH 6.6 022/444] dma-mapping: avoid potential unused data compilation warning Date: Mon, 2 Jun 2025 15:41:26 +0200 Message-ID: <20250602134341.816116998@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134340.906731340@linuxfoundation.org> References: <20250602134340.906731340@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marek Szyprowski [ Upstream commit c9b19ea63036fc537a69265acea1b18dabd1cbd3 ] When CONFIG_NEED_DMA_MAP_STATE is not defined, dma-mapping clients might report unused data compilation warnings for dma_unmap_*() calls arguments. Redefine macros for those calls to let compiler to notice that it is okay when the provided arguments are not used. Reported-by: Andy Shevchenko Suggested-by: Jakub Kicinski Signed-off-by: Marek Szyprowski Tested-by: Andy Shevchenko Link: https://lore.kernel.org/r/20250415075659.428549-1-m.szyprowski@samsung.com Signed-off-by: Sasha Levin --- include/linux/dma-mapping.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index f0ccca16a0aca..608e8296ba206 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -600,10 +600,14 @@ static inline int dma_mmap_wc(struct device *dev, #else #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) #define DEFINE_DMA_UNMAP_LEN(LEN_NAME) -#define dma_unmap_addr(PTR, ADDR_NAME) (0) -#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) -#define dma_unmap_len(PTR, LEN_NAME) (0) -#define dma_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) +#define dma_unmap_addr(PTR, ADDR_NAME) \ + ({ typeof(PTR) __p __maybe_unused = PTR; 0; }) +#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) \ + do { typeof(PTR) __p __maybe_unused = PTR; } while (0) +#define dma_unmap_len(PTR, LEN_NAME) \ + ({ typeof(PTR) __p __maybe_unused = PTR; 0; }) +#define dma_unmap_len_set(PTR, LEN_NAME, VAL) \ + do { typeof(PTR) __p __maybe_unused = PTR; } while (0) #endif #endif /* _LINUX_DMA_MAPPING_H */ -- 2.39.5