mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* RE: [ACPI] [PATCH] 1/3 ACPI resource handling
@ 2003-02-21 18:25 Moore, Robert
  2003-02-21 18:33 ` Bjorn Helgaas
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Moore, Robert @ 2003-02-21 18:25 UTC (permalink / raw)
  To: 'Bjorn Helgaas', Grover, Andrew, Walz, Michael
  Cc: t-kochi, linux-kernel, acpi-devel


1) This seems like a good idea to simplify the parsing of the resource lists

2) I'm not convinced that this buys a whole lot -- it just hides the code
behind a macro (something that's not generally liked in the Linux world.)
Would this procedure be called from more than one place?

3) Fallout from (1), ok.

Bob


-----Original Message-----
From: Bjorn Helgaas [mailto:bjorn_helgaas@hp.com] 
Sent: Tuesday, February 11, 2003 1:58 PM
To: Grover, Andrew
Cc: t-kochi@bq.jp.nec.com; linux-kernel@vger.kernel.org;
acpi-devel@lists.sourceforge.net
Subject: [ACPI] [PATCH] 1/3 ACPI resource handling

These patches against acpi-20030123-2.5.59.diff.gz make it more
convenient to handle ACPI resources and reduce code duplication.

The changes fall into three pieces:

    1) Addition of acpi_walk_resources(), which calls a callback for
       each resource in _CRS or _PRS.  This is handy because you don't
       have to allocate/free buffers, loop over resource lists, or
       make assumptions about the order in which resources appear.

    2) Addition of acpi_resource_to_address64(), which copies
       address16, address32, or address64 resources to an address64
       structure, so you don't have to maintain three sets of code
       that differ only in the size of the address they deal with.

    3) Changes to the EC, PCI link, and ACPI PCI hot-plug drivers to
       use acpi_walk_resources() instead of acpi_get_current_resources().

So far this is just "cleanup" in the sense that there's no new
functionality.  As soon as any issues with these patches are
worked out, I have additional patches that build on them to
add ia64 support for multiple I/O port spaces.

Bjorn



^ permalink raw reply	[flat|nested] 10+ messages in thread
* RE: [ACPI] [PATCH] 1/3 ACPI resource handling
@ 2003-02-21 23:07 Moore, Robert
  0 siblings, 0 replies; 10+ messages in thread
From: Moore, Robert @ 2003-02-21 23:07 UTC (permalink / raw)
  To: 'Bjorn Helgaas', Matthew Wilcox
  Cc: Moore, Robert, Grover, Andrew, Walz, Michael, t-kochi,
	linux-kernel, acpi-devel

This is worth looking into, anyway.
memcpy is appropriate, also.
Bob


-----Original Message-----
From: Bjorn Helgaas [mailto:bjorn_helgaas@hp.com] 
Sent: Friday, February 21, 2003 2:37 PM
To: Matthew Wilcox
Cc: Moore, Robert; Grover, Andrew; Walz, Michael; t-kochi@bq.jp.nec.com;
linux-kernel@vger.kernel.org; acpi-devel@lists.sourceforge.net
Subject: Re: [ACPI] [PATCH] 1/3 ACPI resource handling

On Friday 21 February 2003 3:15 pm, Matthew Wilcox wrote:
> On Fri, Feb 21, 2003 at 03:09:15PM -0700, Bjorn Helgaas wrote:
> > Or, since you mention a macro, maybe your question is not about
> > the usefulness of acpi_resource_to_address64() itself, but about
> > how I implemented it, namely, with the copy_field and copy_address
> > macros:
> 
> Can I suggest that you do a simple memcpy() for the case where you're
> translating an address64 into an address64?

I suppose we could.  Or maybe we should just get to the root of the
thing and make a generic acpi_resource_address structure and never
even expose the 16, 32, and 64 bit variants.  As far as I can tell,
they just make life difficult for consumers.

Then acpi_rs_address16_resource(), acpi_rs_address32_resource(),
and acpi_rs_address64_resource() could be collapsed into one function
with pretty trivial checks for the different sizes.  And there's lots
of similar collapsing that could be done.  I bet we'd even find one
or two defects in the process of removing all the duplicated code.

Of course, I guess that would change the CA interface, so that
constrains things a bit.

Bjorn

^ permalink raw reply	[flat|nested] 10+ messages in thread
* RE: [ACPI] [PATCH] 1/3 ACPI resource handling
@ 2003-02-24 22:48 Moore, Robert
  2003-02-25 16:57 ` Bjorn Helgaas
  0 siblings, 1 reply; 10+ messages in thread
From: Moore, Robert @ 2003-02-24 22:48 UTC (permalink / raw)
  To: 'Pavel Machek', Moore, Robert
  Cc: 'Bjorn Helgaas',
	Grover, Andrew, Walz, Michael, t-kochi, linux-kernel, acpi-devel


Yes, as long as the code is used more than once (which it appears to be),
then of course it should be procedurized.
Bob


-----Original Message-----
From: Pavel Machek [mailto:pavel@ucw.cz] 
Sent: Sunday, February 23, 2003 2:55 PM
To: Moore, Robert
Cc: 'Bjorn Helgaas'; Grover, Andrew; Walz, Michael; t-kochi@bq.jp.nec.com;
linux-kernel@vger.kernel.org; acpi-devel@lists.sourceforge.net
Subject: Re: [ACPI] [PATCH] 1/3 ACPI resource handling

Hi!

> 1) This seems like a good idea to simplify the parsing of the resource
lists
> 
> 2) I'm not convinced that this buys a whole lot -- it just hides the code
> behind a macro (something that's not generally liked in the Linux world.)
> Would this procedure be called from more than one place?

Well, reducing code duplication *is* liked in Linux world. Use inline
function instead of macro if possible, through.
	
Pavel
-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-02-25 16:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-21 18:25 [ACPI] [PATCH] 1/3 ACPI resource handling Moore, Robert
2003-02-21 18:33 ` Bjorn Helgaas
2003-02-21 22:09 ` Bjorn Helgaas
2003-02-21 22:15   ` Matthew Wilcox
2003-02-21 22:36     ` Bjorn Helgaas
2003-02-23 22:54 ` Pavel Machek
2003-02-24 20:48   ` Folkert van Heusden
2003-02-21 23:07 Moore, Robert
2003-02-24 22:48 Moore, Robert
2003-02-25 16:57 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®