On Wed, Mar 05, 2014 at 06:10:57PM +0000, Liviu Dudau wrote: > On Mon, Mar 03, 2014 at 06:46:40PM +0000, Will Deacon wrote: > > +static int gen_pci_calc_io_offset(struct device *dev, > > + struct of_pci_range *range, > > + struct resource *res, > > + resource_size_t *offset) > > +{ > > + static atomic_t wins = ATOMIC_INIT(0); > > + int err, idx, max_win; > > + unsigned int window; > > + > > + if (!PAGE_ALIGNED(range->cpu_addr)) > > + return -EINVAL; > > + > > + max_win = (IO_SPACE_LIMIT + 1) / SZ_64K; > > + idx = atomic_inc_return(&wins); > > + if (idx >= max_win) > > + return -ENOSPC; > > + > > + window = (idx - 1) * SZ_64K; > > + err = pci_ioremap_io(window, range->cpu_addr); > > + if (err) > > + return err; > > + > > + of_pci_range_to_resource(range, dev->of_node, res); > > + res->start = window; > > + res->end = res->start + range->size - 1; > > + *offset = window - range->pci_addr; > > If my fix for of_pci_range_to_resource will get accepted, this > function will have to morph into the pci_register_io_range() call. > Would that cause problems for other users of of_pci_range_to_resource() > (namely mach-integrator ?) I imagine anybody using an I/O region would break, no? Maybe you could check range->flags in of_pci_range_to_resource and do the right thing if somebody passes you an I/O range? I'm happy to update this driver, but it's best to avoid breaking other users if we can. > Otherwise, looks good to me. You can add my (worthless?) > > Reviewed-by: Liviu Dudau <Liviu.Dudau@xxxxxxx> Thanks, Liviu! Will -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html