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 8004319EEBD; Mon, 2 Jun 2025 14:30:34 +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=1748874634; cv=none; b=Sm6AIsOmLI7zemQlXCKxJD+dAgEBhPw8MQjIdrG/z3coO/bZ9q7vdCFNjH3ewz+A3VYb4PpRV8Sw7a3tIF2tHaaOeKl8SASjj94Wz2PJ3KuA3HV49Rzm6DHwww/bQCI4rEbb74V24U2f8dX9efk23BhUTe9nklm4jOiUh2HplRk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748874634; c=relaxed/simple; bh=7lDCS/Y6Tk1/nCNEgk0Owe9OPNpKVt5CkLdgbM55bYE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kxOK1P+BIaizhkcWLHc9fij5ib+MJYxzC3SBpWFxusvfrMZZXdcJOYayjuBoVv7eXMQih+3+eIXeoOjAgO36fvoimItHvIZg54ctSc7zMm5qR+EQ4ylVkuPolAVwJwp2gtSMWKaGgt/JQaR1cEt1RuukYNIUrKSHk4mrs4CNJ1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UAl2wWn7; 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="UAl2wWn7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E49F5C4CEEB; Mon, 2 Jun 2025 14:30:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748874634; bh=7lDCS/Y6Tk1/nCNEgk0Owe9OPNpKVt5CkLdgbM55bYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UAl2wWn7KAmyd1Hxms/sd6q+hA1ZWTOrjIcQFbUspyaLma+2IXjSUJyTJZR5/nR9g loB6Bswwo+8QCGogaboCgxoSZlMJgmUwODD1NDPCl9DVMOCDrPzVoB1WefCqN/1SMc 6jG78wbuN5McpCwCZNRLmOkmFZzUpXqHON2mXzYs= 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 5.4 087/204] dma-mapping: avoid potential unused data compilation warning Date: Mon, 2 Jun 2025 15:47:00 +0200 Message-ID: <20250602134259.083584363@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134255.449974357@linuxfoundation.org> References: <20250602134255.449974357@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 5.4-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 87cbae4b051f1..ead09620e2138 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -895,10 +895,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 -- 2.39.5