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 40439228CB5; Mon, 2 Jun 2025 15:04:44 +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=1748876686; cv=none; b=UccpacUCFsqH9ozZAlPotz5NocRunzGgdmAM9gSRsbOOQy5zrtAeXq0ThqwlWV0q+bYhoVbma1e/xJ2RxFoPhYA1Rhpd5kw/5HRMkd0lINmrMQcM77x1NIL1qvYj7N2HudnOkOL0Vg541yEWZZ8gRP09QNQD1KgNozLnLxleAqE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748876686; c=relaxed/simple; bh=rUsIRM+9r27arhyOobO8wzABLvaPiC8Dw85uNKkdTB8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fe5xIxADXKjJkhQWTD1mPUeDacewS/y8/ZmCI/lx2k92v+kOPgK4cnBZg/b3D/Ol8EKfU9Th+rhuPHD25S7QZcQEvtxi+JevolLQuWRYP6vfd0+gRWlYl/6IxvBVveEtZIL3cMngyCQXi2E4wrKYP6i61v2LAQT1mBKK2Ozgy4U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=phzqtkVx; 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="phzqtkVx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F34EC4CEEB; Mon, 2 Jun 2025 15:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748876684; bh=rUsIRM+9r27arhyOobO8wzABLvaPiC8Dw85uNKkdTB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=phzqtkVxUASUzPv3a/pd/anmWHk/a1drAcPJVQGZmSHocgemapVJDuwuvEBBLk/Vi /kiMfQSe5OtCs8n9PbH/5OTcf7244oz918Ocumchl9GCLDvB+m9UFI28DP88g9naJn GUgEzXeS8mXoZnWPHlXJJdeIYiipl16WJ+GJmBuU= 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.1 011/325] dma-mapping: avoid potential unused data compilation warning Date: Mon, 2 Jun 2025 15:44:47 +0200 Message-ID: <20250602134320.201946335@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134319.723650984@linuxfoundation.org> References: <20250602134319.723650984@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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 e13050eb97771..af3f39ecc1b87 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -598,10 +598,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