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 CAEC227E7C1; Tue, 27 May 2025 17:19:51 +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=1748366391; cv=none; b=Fhi/O669WqBKQY5MbXR3egv3baJZUoeknJWbEHvCAfMjqdPpqdfZ9og7ZKF1gKcWXW8/vmW6raURYD1aQqALNx2F2g3gyqM5EgK5aYoncvgl0dQC/rJpKdVm/b7/pMQNjSk9sq753zXOmqSZ+xdMLSMjn1hk642c7sOx2Gb/zoc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748366391; c=relaxed/simple; bh=+u6bxOYFEaPFWJreG4YB1Xm02JkwlEncx4ahuEE1t58=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oIFjmyr/oODnwC47ZGX3EunknRbyammB8oR9b3cbc67peXgi/8rON8LQfSxaut7JZhgfYE4qv6scMeZuVVBeC1dRpMpdSyzDAOHdjXWLG9vwGf6cXfJM25eGsmsTvw/XhbQNCWJ7ZeQTVganZQJ7iLhocVJZNgqfCZDwakEbUX4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=PEWSKLHX; 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="PEWSKLHX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7381C4CEE9; Tue, 27 May 2025 17:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748366391; bh=+u6bxOYFEaPFWJreG4YB1Xm02JkwlEncx4ahuEE1t58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PEWSKLHX1BtmtjHU28k80dUXKhm18yQUQ+WZPg6E7+WqcbjlNchoerOb24i++25SD 7DIOvJl2UMXfuZEHDBW+lj3T3H2H3LCv/z1nLyUY3tR+AD6FRBsS3k6liAWMfstZKe ya5m5w3yQ/OopaVPVnHY/5jXCJBXreBnh60MQA98= 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.14 022/783] dma-mapping: avoid potential unused data compilation warning Date: Tue, 27 May 2025 18:16:59 +0200 Message-ID: <20250527162513.999545105@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527162513.035720581@linuxfoundation.org> References: <20250527162513.035720581@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.14-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 b79925b1c4333..85ab710ec0e72 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -629,10 +629,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