From nobody Mon Dec 1 22:06:15 2025 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A37B830EF69 for ; Thu, 27 Nov 2025 07:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764229272; cv=none; b=dU/WS7rEwZ5WrX6kC0I6M4Dxld3jHMSc5cz/euqe8dhaCWziCexeSssktgcy69u4palL+j4bWBCFZm2Y6Jjn4tIha1w7b0uwDTZ4q3kFSwk4XUav2HFuxVMlngYqNDb9aTBXfxUdFkj9XzyRm0gAdFwv8PB8eiQFk0PQQMPcIcI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764229272; c=relaxed/simple; bh=mdIkYc2+6jX+i4VkKjflF+MhxT7eT8qnSHRa7YHnUlw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=NUaVXEghCL9lpsEpTRW6MhvSjVKDwnwng9E7nKkzDnQpLsG7+evHMwqoCYl/2IxLKRqHah760oN4//IfI2hL19tZLEOtjfQSruN1pWPt5LxSSEDg+k4QqgrZOF5e1I0Qf5wiPlknloiMfcFQlOn7420HLt+qvmBKusn9dTf5uuc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=uqpb5HsZ; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uqpb5HsZ" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2957850c63bso4684965ad.0 for ; Wed, 26 Nov 2025 23:41:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764229269; x=1764834069; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6TQCT7eTDg2XHHUkD6C/L3ICqZT3KdP+WG9DmEyMuo0=; b=uqpb5HsZ/nkECDsRxiLgUihLsFARTKJTnWWivMvpRrOpOLXz6REbeBRfz0UBJrdcaQ buiH5eKudfKTvFOIPyqJ6bSGlvIWpk6kkcWh0KWJj60R+V7QW2sh2iwbaTGwdrQahALg h7A7N5klv4fjdQi5jkZBUpLToueAJZeAPgL9MhIa0+RsVEeDDIdNN51G2vaYE2u+6c4s kaXG0X+TdqwW4eWsIhcVqd7Ll1y8LmYkUu9FMjZZ68j42OMPXr4EFDqbAbJgompUTz8i RtCKbHzImysXy9WB/jNyWtIf0Vc3Y2U9ADpmIyK9xKCpa2YPK8IxIExBKR49qyild2PQ aleQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764229269; x=1764834069; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6TQCT7eTDg2XHHUkD6C/L3ICqZT3KdP+WG9DmEyMuo0=; b=mm778T8MFz2wA9FkfrUJK+tXGZtfcWp5hYAUfHDHOI/gmuU0+XvtZjzFb3IWkESXzX 2+3zWsRC+YMBsKguVdMmLFQzMuuuwFtxmvNZgq8u5OGY/g53oE5roPBqJ8gWkfQWY+8Q pe2deV8hXSQaDr5Mfu/BTvVT/JleXEE9SodqGvsKjdz/MOFOwduZ6dNBn4f3sj7o+1Gm 4SV2kGbkUD0lBdAxdz19HyBMskc6373UXAneSwA7NmBflU3EJI9+ZYtASIOZ5WNdWfbF g4b2IQI8buY2SQkTbNRbe0BNYPd1I2WoNZewMsI4m5QFKMMdPXTsG8XUPcw4gf1On9lv bJYg== X-Forwarded-Encrypted: i=1; AJvYcCUaWxPk6KmUegv1v5k+SJ0VimpACaM/vAIitYOAF0FqlRomzumB5luJqmLnDzrY6HLkBNEsVXe6JQ/Eb7k=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7eRvzQFzPUvQxxLwpz4iZTH3TTiNejXvmDUNLLBHBxz5NXSVm 8QnRh/D/NHiGC8jXUHAJhOxN7zM2PjBYDGfahRsaFFm8ZOsixImh1Fk/wcATNA4O7f0= X-Gm-Gg: ASbGncv7fJb3xd6GpyH1n2OA3QPFrC7oNHKoEdXaSHwkrlAXLhl3qrc2B/OyoMKaq/H W8QPWMDy6WPa8KVqvtnunbTYK3W2jU3qRdigmzhi1rBV0lY8F1sWSRJ7da8mYaE4pT7l43+SsBb 4/UsnJRu9oRU7L6LG8W+VfssIDWbUuC7Cxe6oQRD46w764s7UD9edoA8e1ECEqbhx1k/jSFGz8+ 1L9XPtMQTU5ZhgB+tQJEs82/C1twF2rQnrkNyTRouzo2G1hlR6N3/8EWg25jlb9eUnVMxmALI4x idYeIvuaq4mzedY2brQSFN9EPkxLR8TBLpdLtECFsTvMsYlwPvBLAQrTghlTuv3BWMYfN0ES082 HCRWcUvaF9pAugJeQRNmbiQiW8MeDpPe6dtGtp0ubMysbiAe8aPT5xUzx/DBgKwoYmxqFZ4Rg6k f+bSrkEMWnupY= X-Google-Smtp-Source: AGHT+IEBlmzvPfpPZSYziqgyCSQiiLlC/euU1UMGI4AMImrD/tBfX/XLDOjeV/TfCVGjyrfd8/xH/Q== X-Received: by 2002:a17:903:3c67:b0:29a:69d:acdc with SMTP id d9443c01a7336-29b6bffd87amr213892395ad.25.1764229268696; Wed, 26 Nov 2025 23:41:08 -0800 (PST) Received: from localhost ([122.172.86.94]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29bceb54454sm7966145ad.84.2025.11.26.23.41.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Nov 2025 23:41:08 -0800 (PST) From: Viresh Kumar To: Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= Cc: Viresh Kumar , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH] dma-buf: add no-op stubs when CONFIG_DMA_SHARED_BUFFER is disabled Date: Thu, 27 Nov 2025 13:10:55 +0530 Message-Id: <6202945f4af2d10e0fb6602b25ff9cb454c1ee85.1764229204.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move several dma-buf function declarations under CONFIG_DMA_SHARED_BUFFER and provide static inline no-op implementations for the disabled case to allow the callers to build when the feature is not compiled in. Signed-off-by: Viresh Kumar --- include/linux/dma-buf.h | 116 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index d58e329ac0e7..06e494d8f6b0 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h @@ -568,6 +568,7 @@ static inline bool dma_buf_is_dynamic(struct dma_buf *d= mabuf) return !!dmabuf->ops->pin; } =20 +#ifdef CONFIG_DMA_SHARED_BUFFER struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, struct device *dev); struct dma_buf_attachment * @@ -609,4 +610,119 @@ int dma_buf_vmap_unlocked(struct dma_buf *dmabuf, str= uct iosys_map *map); void dma_buf_vunmap_unlocked(struct dma_buf *dmabuf, struct iosys_map *map= ); struct dma_buf *dma_buf_iter_begin(void); struct dma_buf *dma_buf_iter_next(struct dma_buf *dmbuf); + +#else +static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dm= abuf, + struct device *dev) +{ + return NULL; +} + +static inline struct dma_buf_attachment * +dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev, + const struct dma_buf_attach_ops *importer_ops, + void *importer_priv) +{ + return NULL; +} + +static inline void dma_buf_detach(struct dma_buf *dmabuf, + struct dma_buf_attachment *attach) { } + +static inline int dma_buf_pin(struct dma_buf_attachment *attach) +{ + return -EOPNOTSUPP; +} + +static inline void dma_buf_unpin(struct dma_buf_attachment *attach) { } + +static inline struct dma_buf * +dma_buf_export(const struct dma_buf_export_info *exp_info) +{ + return NULL; +} + + +static inline int dma_buf_fd(struct dma_buf *dmabuf, int flags) +{ + return -EOPNOTSUPP; +} + + +static inline struct dma_buf *dma_buf_get(int fd) +{ + return NULL; +} + +static inline void dma_buf_put(struct dma_buf *dmabuf) { } + +static inline struct sg_table * +dma_buf_map_attachment(struct dma_buf_attachment *, enum dma_data_directio= n) +{ + return NULL; +} + +static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *, + struct sg_table *, + enum dma_data_direction) { } + +static inline void dma_buf_move_notify(struct dma_buf *dma_buf) { } + +static inline int dma_buf_begin_cpu_access(struct dma_buf *dma_buf, + enum dma_data_direction dir) +{ + return -EOPNOTSUPP; +} + +static inline int dma_buf_end_cpu_access(struct dma_buf *dma_buf, + enum dma_data_direction dir) +{ + return -EOPNOTSUPP; +} + +static inline struct sg_table * +dma_buf_map_attachment_unlocked(struct dma_buf_attachment *attach, + enum dma_data_direction direction) +{ + return NULL; +} + +static inline void +dma_buf_unmap_attachment_unlocked(struct dma_buf_attachment *attach, + struct sg_table *sg_table, + enum dma_data_direction direction) { } + +static inline int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *, + unsigned long) +{ + return -EOPNOTSUPP; +} + +static inline int dma_buf_vmap(struct dma_buf *dmabuf, struct iosys_map *m= ap) +{ + return -EOPNOTSUPP; +} + +static inline void dma_buf_vunmap(struct dma_buf *dmabuf, struct iosys_map= *map) +{ } + +static inline int dma_buf_vmap_unlocked(struct dma_buf *dmabuf, + struct iosys_map *map) +{ + return -EOPNOTSUPP; +} + +static inline void dma_buf_vunmap_unlocked(struct dma_buf *dmabuf, + struct iosys_map *map) { } + +static inline struct dma_buf *dma_buf_iter_begin(void) +{ + return NULL; +} + +static inline struct dma_buf *dma_buf_iter_next(struct dma_buf *dmbuf) +{ + return NULL; +} +#endif /* CONFIG_DMA_SHARED_BUFFER */ #endif /* __DMA_BUF_H__ */ --=20 2.31.1.272.g89b43f80a514