From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] mfd: max8925: request resource region
Date: Wed, 9 May 2012 17:07:47 +0100 [thread overview]
Message-ID: <20120509160747.GA10241@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <201205091243.13206.arnd@arndb.de>
On Wed, May 09, 2012 at 12:43:13PM +0000, Arnd Bergmann wrote:
> I think the subtraction in some form is needed if you want to register
> the resources, to guarantee that they are non-conflicting. Registering
> them has the advantage that we can print them in a similar way to what
> we do for /proc/{ioports,iomem}.
You don't need to - you only need them non-conflicting if they're part of
the same tree.
It seems to me that having all device register resources being part of
the same tree is the wrong approach, it's certainly the wrong model for
this kind of thing.
Instead, we should be having per-device resources trees. So, for instance,
an I2C device with two functions, function 1 say owns register indices
0-0x3f and function 2 owns 0x40-0x7f. We should have:
struct i2c_blah_driver_info {
struct resource reg_res;
};
priv->reg_res.start = 0;
priv->reg_res.end = 0x7f;
priv->reg_res.flags = 0;
subdev1->resource[0].start = 0;
subdev1->resource[0].end = 0x3f;
subdev1->resource[0].flags = 0;
ret = request_resource(&priv->reg_res, &subdev1->resource[0]);
/* check ret */
subdev2->resource[0].start = 0x40;
subdev2->resource[0].end = 0x7f;
subdev2->resource[0].flags = 0;
ret = request_resource(&priv->reg_res, &subdev2->resource[0]);
/* check ret */
This means that we end up with lots of per-device resource trees rooted
at the top-level-device driver, each effectively with their own separate
name spaces.
If we care about marking resources busy to avoid drivers conflicting, I
would also suggest that we augment the resource interfaces so that we can
have mark_resource_busy(dev, res, drivername) which takes the 'bus'
resource and adds the IORESOURCE_BUSY resource below it. I'd also suggest
at this point that we don't have a corresponding release function for this
as I believe we should be using devm stuff internally for this now.
Do we care about making them appear in procfs? I suspect at this stage
that would be wrong. If we care at all, they should probably be per-
top-level-device sysfs files - and we should have a function which sysfs
can use along with the root resource to create that output.
next prev parent reply other threads:[~2012-05-09 16:07 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-07 3:10 [PATCH 1/2] mfd: max8925: request resource region Haojian Zhuang
2012-05-07 3:10 ` [PATCH 2/2] ARM: mmp: add io head file Haojian Zhuang
2012-05-07 9:23 ` Arnd Bergmann
2012-05-07 7:58 ` [PATCH 1/2] mfd: max8925: request resource region Russell King - ARM Linux
2012-05-07 8:18 ` Haojian Zhuang
2012-05-07 8:59 ` Russell King - ARM Linux
2012-05-07 9:01 ` Mark Brown
2012-05-07 9:08 ` Russell King - ARM Linux
2012-05-07 9:47 ` Mark Brown
2012-05-07 10:14 ` Arnd Bergmann
2012-05-07 10:23 ` Haojian Zhuang
2012-05-07 11:21 ` Arnd Bergmann
2012-05-07 11:29 ` Mark Brown
[not found] ` <201205071319.48768.arnd@arndb.de>
2012-05-07 14:02 ` Samuel Ortiz
2012-05-07 14:15 ` Mark Brown
2012-05-07 15:15 ` Arnd Bergmann
2012-05-07 15:28 ` Mark Brown
2012-05-07 10:37 ` Mark Brown
[not found] ` <201205071314.51886.arnd@arndb.de>
2012-05-07 14:06 ` Mark Brown
2012-05-07 15:09 ` Arnd Bergmann
2012-05-07 15:17 ` Mark Brown
2012-05-07 19:26 ` Arnd Bergmann
2012-05-07 19:58 ` Mark Brown
2012-05-08 8:17 ` Mark Brown
2012-05-08 14:44 ` Arnd Bergmann
2012-05-08 15:31 ` Mark Brown
2012-05-09 12:43 ` Arnd Bergmann
2012-05-09 14:13 ` Mark Brown
2012-05-09 14:19 ` Arnd Bergmann
2012-05-09 14:42 ` Mark Brown
2012-05-09 15:03 ` Arnd Bergmann
2012-05-09 15:28 ` Mark Brown
2012-05-09 16:27 ` Arnd Bergmann
2012-05-09 16:18 ` Russell King - ARM Linux
2012-05-09 16:30 ` Mark Brown
2012-05-09 16:07 ` Russell King - ARM Linux [this message]
2012-05-09 16:26 ` Arnd Bergmann
2012-05-09 16:27 ` Russell King - ARM Linux
2012-05-07 18:57 ` Russell King - ARM Linux
2012-05-07 19:27 ` Mark Brown
2012-05-07 8:12 ` Samuel Ortiz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120509160747.GA10241@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).