Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754296Ab2HGL2n (ORCPT ); Tue, 7 Aug 2012 07:28:43 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:55947 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753846Ab2HGL2l (ORCPT ); Tue, 7 Aug 2012 07:28:41 -0400 From: Arnd Bergmann To: Russell King Subject: Re: [PATCH 0/5] mfd: replace IORESOURCE_IO by IORESOURCE_MEM Date: Tue, 7 Aug 2012 11:28:27 +0000 User-Agent: KMail/1.12.2 (Linux/3.5.0; KDE/4.3.2; x86_64; ; ) Cc: Benjamin Herrenschmidt , Mark Brown , Haojian Zhuang , sameo@linux.intel.com, rpurdie@rpsys.net, bryan.wu@canonical.com, linux-kernel@vger.kernel.org References: <1344184373-9670-1-git-send-email-haojian.zhuang@gmail.com> <1344327742.2698.15.camel@pasglop> <20120807082813.GB24257@flint.arm.linux.org.uk> In-Reply-To: <20120807082813.GB24257@flint.arm.linux.org.uk> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201208071128.27616.arnd@arndb.de> X-Provags-ID: V02:K0:bZMfZI3mXFJXmooZxU+CIhshSQrfUoRW23hh4/7CVys x/XWyA7/QZfA3exzZJ+G9GNdLjFNtHAZp6HGM/58CkF/vonKwB FhY34UJb3NBddWGgPRckBIysUmihOnrsEkFsDjnCG2XgseRca+ jTKmsISkC+VN/Bc7xgbMydGu/fB2HLZ+dgEH2U7YzZmMqqCALL X6Ceq9w7Yhs5SBVY73Xl+e0VkcEwl9LpE8WPmLJdHQO8tAN/bo l9ARJbFpuj4E3KicsG86JvbdWLMgblzqCMP7Uj+hUTtKsDd1Y5 f5QWZCTZL4a+Cl5cklwejk42vsA8MVBAZeJ1AdPTEXHI6R6zKN uBLQsA2TpVdOSLCEM9BY= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2335 Lines: 54 On Tuesday 07 August 2012, Russell King wrote: > On Tue, Aug 07, 2012 at 06:22:22PM +1000, Benjamin Herrenschmidt wrote: > > On Mon, 2012-08-06 at 22:31 +0100, Russell King wrote: > > > > > > So, if we made this a numeric index, then we have 32 resource types > > > to deal with, and no need to bugger around with re-using an existing > > > type for something else. > > > > > > This makes sense, MEM, IRQ and DMA are all mutually exclusive, as > > > should be MEM and IO (because they can't coexist in two resource trees > > > at the same time.) BUS only gets used in a hand-full of places and > > > not with any other flags. > > > > > > So, looks like we can have 27 new resource types fairly easily. > > > > Besides we can easily use a single IORESOURCE_OTHER for most things > > really, if we prefer, make it IORESOURCE_IO | IORESOURCE_MEM and have > > platform device avoid that combo... > > That will work just the same way that I'm suggesting. We can keep > the existing bit-based numbers, and: > > #define IORESOURCE_OTHER 0x00000300 > > and the platform code will avoid using the standard resource trees, > because it does things correctly here: > > if (resource_type(r) == IORESOURCE_MEM) > p = &iomem_resource; > else if (resource_type(r) == IORESOURCE_IO) > p = &ioport_resource; > I had not realized that we did this in platform_device_add(), which means using IORESOURCE_IO in mfd is even more broken than I thought previously. I've looked through the code some more and your solution sounds like the best option to get this sorted quickly. The entire resource logic will probably come back to haunt us with ACPI 5.0 which adds region types for a number of new things (i2c, gpio, ipmi, cmos, ...) and we might end up representing them as resource. Or we might not. If we introduce a new IORESOURCE_OTHER, I would actually prefer to define it to 0x00000000 for purely aesthetic reasons, the effect should be the same as using 0x00000300. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/