From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vb0-f46.google.com ([209.85.212.46]:42621 "EHLO mail-vb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750775Ab2HVRfn (ORCPT ); Wed, 22 Aug 2012 13:35:43 -0400 Received: by vbbff1 with SMTP id ff1so1303950vbb.19 for ; Wed, 22 Aug 2012 10:35:42 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <20120618050333.GA13469@ram-ThinkPad-T61> <20120816032602.GN2449@ram-ThinkPad-T61> <20120816044104.GQ2449@ram-ThinkPad-T61> <20120821151245.GA2356@ram-ThinkPad-T61> <20120822101533.GA2332@ram-ThinkPad-T61> Date: Wed, 22 Aug 2012 10:35:42 -0700 Message-ID: Subject: Re: [RFC PATCH v2 ]pci: pci resource iterator From: Yinghai Lu To: Ram Pai Cc: linux-pci@vger.kernel.org, Bjorn Helgaas Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-pci-owner@vger.kernel.org List-ID: On Wed, Aug 22, 2012 at 10:31 AM, Yinghai Lu wrote: > On Wed, Aug 22, 2012 at 3:15 AM, Ram Pai wrote: >> On Tue, Aug 21, 2012 at 04:22:52PM -0700, Yinghai Lu wrote: >>> On Tue, Aug 21, 2012 at 8:13 AM, Ram Pai wrote: >> by exposing idx through the interface, we are exposing the implementation to >> the enduser. I want the end user not know that the resources are >> structured as a array. This will help easily restructure resources >> in the pci_dev structure to whatever implementation we want, linked list >> or hash or whatever... >> >> Why can't the addon resource be hidden behind the interface? something >> like this? > keep the idx would make thing simple for referencing and converting. pci_dev_resource_n() would be wrapper to from idx to real resource pointer. we just need to change &dev->resource[i] referencing to pci_dev_resource_n(dev, i) instead. We did that before for irq_desc storage converting, and now we have for_each_irq_desc(irq, desc) later for the resource allocation, I will change resource member from struct resource resource[DEVICE_COUNT_RESOURCE]; to struct resource std_res[7]; struct resource *iov_res; struct resource *bridge_res; and allocate iov_res and bridge array as needed. anyway keep the overalll idx is good way to go and follow. Thanks Yinghai