Jonathan Cameron wrote: > On Tue, 24 Mar 2026 00:37:53 +0000 > John Groves <[email protected]> wrote: > > > From: John Groves <[email protected]> > > > > 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. > > > > Reviewed-by: Ira Weiny <[email protected]> > > Reviewed-by: Dave Jiang <[email protected]> > > Signed-off-by: John Groves <[email protected]> > Obviously this is a straight forward code move... But I can't resist > commenting on what is moving (feel free to ignore! or maybe a follow > up patch if you agree. > > Reviewed-by: Jonathan Cameron <[email protected]>
Added this to the series. LMK if I missed something. Ira --- commit ccc1878ab00178e82108bdd1ece497388a24290b (HEAD -> nvdimm-famfs-dax) Author: Ira Weiny <[email protected]> Date: Tue Mar 24 12:36:19 2026 -0500 dax: Modernize dax_pgoff_to_phys() The patch to move dax_pgoff_to_phys() to bus.c revealed that the function could be improved with more modern style and the newer in_range() utility function. Update it while we are moving it around. Link: https://lore.kernel.org/all/[email protected]/ Suggested-by: Jonathan Cameron <[email protected]> Signed-off-by: Ira Weiny <[email protected]> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index e4bd5c9f006c..1b412264bb36 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -1421,16 +1421,12 @@ static const struct device_type dev_dax_type = { __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++) { + for (int 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) + if (!in_range(pgoff, dax_range->pgoff, PHYS_PFN(range_len(range)))) continue; phys = PFN_PHYS(pgoff - dax_range->pgoff) + range->start; if (phys + size - 1 <= range->end)

