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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

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


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.


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.

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 3/3] PNP cleanups - Version 2 - Pass struct pnp_dev ..., Thomas Renninger, (Tue Nov 20, 10:52 am)
Re: [PATCH 3/3] PNP cleanups - Version 2 - Pass struct pnp ..., Rene Herman, (Tue Nov 20, 12:36 pm)