From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (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 EFF572FBDF0 for ; Wed, 14 Jan 2026 21:32:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768426368; cv=none; b=nhMWrLOQZzAwX2PhagVSX6yTCBa490BhSKfBw046LiVjkvybp4zfotRSK7FUOWUJ+dRZodDl8jZr/CLQF2qRNj+jx5++F+LYrBZpag/YbdVeT2S29QDUt4sxfZT45xNwfSh4FDq4EGoYeO6boTvJnq5ekKmtLVQarpPWZmG9sfw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768426368; c=relaxed/simple; bh=rl+jQFmW9bJctWZaIMhOgi7nvti71S9dTb0lCysIN04=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M/9uJ90zPyOrpY23U4zWob3IP55n6rSRBQt01GdMmrtNAiSEJuNYMvDTCq2VCmYJmIxPduLsFFbZCne9mKuVr8ZKVNny1d9J9+I9FfHeUdCOg35plrA7q/cltkOWnpWjwyvZT6kbpErLrMkYyjSgMUvxKjm7KwsO3vP1u23vwMQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=Groves.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DtvkIwjv; arc=none smtp.client-ip=209.85.210.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=Groves.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DtvkIwjv" Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-7c750b10e14so115984a34.2 for ; Wed, 14 Jan 2026 13:32:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768426365; x=1769031165; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=5+ZFzB1bOq1z4EOZD4cYTHTPj9h8hzHs0/3N91Bb6XY=; b=DtvkIwjvXfYtf/To5+Fx2Hg9xeKVhr5+4S/kYC9GDIKtL1Ocb1tLNBm1JYvtrcSrDy KIpKbv7TyOBPgtuqtavqCobaLpGEIEH9ozpJXn3HaRPeBBIV9V+MerOT3Y977RIv4L5p J44aeEvWfaM9O30vqRibyH8titOwGRPtVx2RLuuie60hZhN643yxeuKBCmjynZ/k/rqp sK28s4ONTINstsrJT2s0aC+pDh8RXjfZc2EHg5wpTS0nwu8uroRL/u2fwsfznPnw5Hwr oDr7Cd8ses94H52hMhe/QlyKCrtx8kmOu3gw4uVTwDQ/G3YhxpOgytASSfTIxy3HDtJ5 nsdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768426365; x=1769031165; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5+ZFzB1bOq1z4EOZD4cYTHTPj9h8hzHs0/3N91Bb6XY=; b=uroZt9o/CYiaHCwZKvSLklOKmSlAlISk33n25fLlvEWvj6ZB658bKKH94Bmtn3YYhT v7JxG8BNPmDruYWEWZV833nk0gzT4L4ZxchzLLJHoKAXqGzJoWnMr5dg7FRuQ6oOVS3V gZ48/Z+EmiVJEDw8rJHOPcPL4O4IBepgJXWbneXw6GrZgOeUNNattXp05DDQz86ZjGhm wBnDIsZ04LOhPuqtFng5ubluivda2vWavEceqgRYG0m4QkIJbP+GUJLdlirreEa76Q5H k+nlnGiP9LuNXyYFX3cMyq+UKq/abDumbSviIs5jXoFvabUpEyh9XiV0ja4tlhrY3SJh zxbw== X-Forwarded-Encrypted: i=1; AJvYcCXr/RqtbPQXJrDZ8YG30mKcVNyFzDAN1E6JgtlM7aKLaZdAKwCE7qzWTly4PC0faNTNoLX6C+LshYkztpQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzacfsjGMRMpNP4SGV5snD+xmPEx75oO0/RddzHKPG63MEX+PnN tELLU4OWdB2dtTq8mCRJONCMfUFHx0rmcZKedeopvlEuc9jwugNayAmN X-Gm-Gg: AY/fxX7M/lyb/SbyzxoSj8uSmRO91wS3I84xMS483aNBV3NkAJlAWQb2PsQ50B+eayx tt+ym4iwuW4DzfvGDppITV5jyJ6gdEu8A8rUaROI0rIigoAltPohuwwRkTo0RNoy1Lw+bMO1U/y hjOI6pvQ86ZqmYyYwvLfBvhSym7SJmkKDeCaFp8QT+moUVTKd/Mrl98vricY4FnKhLdchFzPa7U J1c78chzJWlKmvn+Xtg8GZVcgy4RpLmQxvM4zBQwJez+8Pe+1BJES2XyrJXlMs5Vq0nvc+3Xkp8 K55pD5Eq+hB6Dqku2OlixRcLCwJbCVkVuZEgqB8fcyZjtppYYYOgwobAJHJx2yIWKWAn4HktLj8 Pf2xoPNox5LvYxVA1V90ShAgQpPgl1sY7k11R5V9Fqc7D90/lFOWhj20/hS7fL2wqXJcCjY7hHf PVoklyM5wrUDpcwBX1wC9FAALdl6fZeJbvvb1CqKF9L2De X-Received: by 2002:a05:6830:268c:b0:7c7:6e32:dc7f with SMTP id 46e09a7af769-7cfcb46d690mr2240341a34.0.1768426364916; Wed, 14 Jan 2026 13:32:44 -0800 (PST) Received: from localhost.localdomain ([2603:8080:1500:3d89:4c85:2962:e438:72c4]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7cfcb084c89sm2440494a34.12.2026.01.14.13.32.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 14 Jan 2026 13:32:44 -0800 (PST) Sender: John Groves From: John Groves X-Google-Original-From: John Groves To: John Groves , Miklos Szeredi , Dan Williams , Bernd Schubert , Alison Schofield Cc: John Groves , Jonathan Corbet , Vishal Verma , Dave Jiang , Matthew Wilcox , Jan Kara , Alexander Viro , David Hildenbrand , Christian Brauner , "Darrick J . Wong" , Randy Dunlap , Jeff Layton , Amir Goldstein , Jonathan Cameron , Stefan Hajnoczi , Joanne Koong , Josef Bacik , Bagas Sanjaya , James Morse , Fuad Tabba , Sean Christopherson , Shivank Garg , Ackerley Tng , Gregory Price , Aravind Ramesh , Ajay Joshi , venkataravis@micron.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH V4 01/19] dax: move dax_pgoff_to_phys from [drivers/dax/] device.c to bus.c Date: Wed, 14 Jan 2026 15:31:48 -0600 Message-ID: <20260114213209.29453-2-john@groves.net> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114213209.29453-1-john@groves.net> References: <20260114153133.29420.compound@groves.net> <20260114213209.29453-1-john@groves.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This function will be used by both device.c and fsdev.c, but both are loadable modules. Moving to bus.c puts it in core and makes it available to both. No code changes - just relocated. Signed-off-by: John Groves --- drivers/dax/bus.c | 24 ++++++++++++++++++++++++ drivers/dax/device.c | 23 ----------------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index fde29e0ad68b..a73f54eac567 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -1417,6 +1417,30 @@ static const struct device_type dev_dax_type = { .groups = dax_attribute_groups, }; +/* see "strong" declaration in tools/testing/nvdimm/dax-dev.c */ +__weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff, + unsigned long size) +{ + int i; + + for (i = 0; i < dev_dax->nr_range; i++) { + struct dev_dax_range *dax_range = &dev_dax->ranges[i]; + struct range *range = &dax_range->range; + unsigned long long pgoff_end; + phys_addr_t phys; + + pgoff_end = dax_range->pgoff + PHYS_PFN(range_len(range)) - 1; + if (pgoff < dax_range->pgoff || pgoff > pgoff_end) + continue; + phys = PFN_PHYS(pgoff - dax_range->pgoff) + range->start; + if (phys + size - 1 <= range->end) + return phys; + break; + } + return -1; +} +EXPORT_SYMBOL_GPL(dax_pgoff_to_phys); + static struct dev_dax *__devm_create_dev_dax(struct dev_dax_data *data) { struct dax_region *dax_region = data->dax_region; diff --git a/drivers/dax/device.c b/drivers/dax/device.c index 22999a402e02..132c1d03fd07 100644 --- a/drivers/dax/device.c +++ b/drivers/dax/device.c @@ -57,29 +57,6 @@ static int check_vma(struct dev_dax *dev_dax, struct vm_area_struct *vma, vma->vm_file, func); } -/* see "strong" declaration in tools/testing/nvdimm/dax-dev.c */ -__weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff, - unsigned long size) -{ - int i; - - for (i = 0; i < dev_dax->nr_range; i++) { - struct dev_dax_range *dax_range = &dev_dax->ranges[i]; - struct range *range = &dax_range->range; - unsigned long long pgoff_end; - phys_addr_t phys; - - pgoff_end = dax_range->pgoff + PHYS_PFN(range_len(range)) - 1; - if (pgoff < dax_range->pgoff || pgoff > pgoff_end) - continue; - phys = PFN_PHYS(pgoff - dax_range->pgoff) + range->start; - if (phys + size - 1 <= range->end) - return phys; - break; - } - return -1; -} - static void dax_set_mapping(struct vm_fault *vmf, unsigned long pfn, unsigned long fault_size) { -- 2.52.0