From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Chemparathy Subject: Re: [PATCH v5 04/12] spi: add ti-ssp spi master driver Date: Wed, 17 Nov 2010 12:35:37 -0500 Message-ID: <4CE41269.2040303@ti.com> References: <1289848334-8695-1-git-send-email-cyril@ti.com> <1289848334-8695-5-git-send-email-cyril@ti.com> <20101116072225.GF4074@angua.secretlab.ca> <4CE31F0E.7050103@ti.com> <20101117161130.GC5757@angua.secretlab.ca> Reply-To: cyril-l0cyMroinI0@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: "davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org" , "dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org" , "sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org" , "khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org" , "broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org" , "Rafael J. Wysocki" , "rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org" , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , "spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org" , "akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org" , Greg Kroah-Hartman , "alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org" , "lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org" To: Grant Likely Return-path: In-Reply-To: <20101117161130.GC5757-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-spi.vger.kernel.org On 11/17/2010 11:11 AM, Grant Likely wrote: [...] > To start, I'm not a fan of matching by name. It's fragile because it > makes assumptions about how devices will be names when they actually > appear (ie. Sometimes .id is dynamically assigned). Ideally I'd > prefer to have direct references (ie. pointers) to the devices that > need to be registered, which *shouldn't* be difficult to handle. That > guarantees that the correct device is always referenced. (aside: the > device-tree use case provides this information by having direct > 'phandle' references between dependencies.) The pointer approach is possibly problematic with devices that get registered by other drivers/masters (mfd, spi, i2c, etc.). With these devices the board doesn't really have a reference to the device in question. Something along the following lines may be better: int device_requires(struct device *dev, const char *res); int device_provides(struct device *provider, const char *res); where res is a string of the form "gpio:25", "regulator:vlcd", or even "dev:". device_requires() would typically be used by board implementations, and device_provides() would be called by gpiolib, regulator core, device core, etc. I guess this is somewhat along the lines of an earlier discussion on the PPC list ([1] below), except that the drivers don't get probed until specified prereqs are available. Regards Cyril. [1] http://www.spinics.net/lists/linux-embedded/msg02764.html ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev