Re: [PATCH 3/3] PNP cleanups - Version 2 - Pass struct pnp_dev to pnp_clean_resource_table for cleanup reasons

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20-11-07 19:00, Alan Cox wrote:

On Tue, 20 Nov 2007 18:52:04 +0100
Thomas Renninger <[email protected]> wrote:

Pass struct pnp_dev to pnp_clean_resource_table for cleanup reasons

Again I don't see the point of this change. A routine for cleaning up
resource tables expects logically to be passed a resource table to clean
up not some device it may be attached to.

He needs to pass the pnp_dev to later be able to replace the:

	for (idx = 0; idx < PNP_MAX_PORT; idx++)

loops with:

	for (idx = 0; pnp_port(dev, idx); idx++)

in a later patch when he introduces dynamic resource tables -- pnp-acpi can (and does) now sometimes require more resources than the current pnp limits allow but simply upping the limits uncoditionally wastes too much space in the resource tables. He therefore aims to krealloc() the arrays as required.

Perhaps if you could explain where you are trying to end up, it would help understand what you are trying to do.

I don't see why pnp_dma() and pnp_irq() should change either. It just causes noise and breaks driver code. I don't see where it needs to change
to make internal pnp changes work ?

As he explained in his 0/3, his pnp_port() would look like:

#define pnp_port(dev,bar)      ((dev)->res.allocated_ports > (bar) \
	? (&(dev)->res.port_resource[(bar)]) : NULL)

If the above replacement was the only use for the macros, he could as well do:

	for (idx = 0; idx < dev->res.allocated_ports; idx++)

but given that he'll need to get at the resource more generally, the simple pnp_port(), pnp_irq(), pnp_dma() and pnp_mem() names sound best. It would ofcourse be possible to call them something like pnp_port_addr() as well but given that he only needs to get rid of pnp_irq() and pnp_dma() to have these better names available, I'd say go for it.

pnp_{irq,dma}_no(), or pnp_{irq,dma}_start() as he originally proposed and which has consistency both with the existing pnp_{port,mem}_start() and the struct resource name as its plus should be fine and he then frees up the better names for the new use which should make for better readable code at the end of things.

My vote's with pnp_irq_start(). As said, consistent both with the port and mem variants and the struct resource usage and name.

Rene.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux