Include PNP device names in /proc/ioports and when matching
driver with devices.
Signed-off-by: Bjorn Helgaas <[email protected]>
===== drivers/pnp/driver.c 1.14 vs edited =====
--- 1.14/drivers/pnp/driver.c 2003-03-09 16:44:14 -07:00
+++ edited/drivers/pnp/driver.c 2005-01-11 14:57:28 -07:00
@@ -94,7 +94,7 @@
pnp_dev = to_pnp_dev(dev);
pnp_drv = to_pnp_driver(dev->driver);
- pnp_dbg("match found with the PnP device '%s' and the driver '%s'", dev->bus_id,pnp_drv->name);
+ pnp_dbg("match found with the PnP device '%s' (%s) and the driver '%s'", dev->bus_id, pnp_dev->name, pnp_drv->name);
error = pnp_device_attach(pnp_dev);
if (error < 0)
===== drivers/pnp/system.c 1.12 vs edited =====
--- 1.12/drivers/pnp/system.c 2004-10-19 10:54:38 -06:00
+++ edited/drivers/pnp/system.c 2005-01-11 11:21:49 -07:00
@@ -21,18 +21,19 @@
{ "", 0 }
};
-static void reserve_ioport_range(char *pnpid, int start, int end)
+static void reserve_ioport_range(struct pnp_dev *dev, int start, int end)
{
struct resource *res;
char *regionid;
+ int length = strlen(dev->dev.bus_id) + strlen(dev->name) + 8;
- regionid = kmalloc(16, GFP_KERNEL);
- if ( regionid == NULL )
+ regionid = kmalloc(length, GFP_KERNEL);
+ if (regionid == NULL)
return;
- snprintf(regionid, 16, "pnp %s", pnpid);
- res = request_region(start,end-start+1,regionid);
- if ( res == NULL )
- kfree( regionid );
+ snprintf(regionid, length, "pnp %s (%s)", dev->dev.bus_id, dev->name);
+ res = request_region(start, end - start + 1, regionid);
+ if (res == NULL)
+ kfree(regionid);
else
res->flags &= ~IORESOURCE_BUSY;
/*
@@ -41,15 +42,15 @@
* have double reservations.
*/
printk(KERN_INFO
- "pnp: %s: ioport range 0x%x-0x%x %s reserved\n",
- pnpid, start, end,
+ "pnp: %s (%s): ioport range 0x%x-0x%x %s reserved\n",
+ dev->dev.bus_id, dev->name, start, end,
NULL != res ? "has been" : "could not be"
);
return;
}
-static void reserve_resources_of_dev( struct pnp_dev *dev )
+static void reserve_resources_of_dev(struct pnp_dev *dev)
{
int i;
@@ -76,7 +77,7 @@
/* Do nothing */
continue;
reserve_ioport_range(
- dev->dev.bus_id,
+ dev,
pnp_port_start(dev, i),
pnp_port_end(dev, i)
);
Looks good.
Thanks,
Adam
On Tue, Jan 11, 2005 at 04:52:24PM -0700, Bjorn Helgaas wrote:
> Include PNP device names in /proc/ioports and when matching
> driver with devices.
>
> Signed-off-by: Bjorn Helgaas <[email protected]>
>
> ===== drivers/pnp/driver.c 1.14 vs edited =====
> --- 1.14/drivers/pnp/driver.c 2003-03-09 16:44:14 -07:00
> +++ edited/drivers/pnp/driver.c 2005-01-11 14:57:28 -07:00
> @@ -94,7 +94,7 @@
> pnp_dev = to_pnp_dev(dev);
> pnp_drv = to_pnp_driver(dev->driver);
>
> - pnp_dbg("match found with the PnP device '%s' and the driver '%s'", dev->bus_id,pnp_drv->name);
> + pnp_dbg("match found with the PnP device '%s' (%s) and the driver '%s'", dev->bus_id, pnp_dev->name, pnp_drv->name);
>
> error = pnp_device_attach(pnp_dev);
> if (error < 0)
> ===== drivers/pnp/system.c 1.12 vs edited =====
> --- 1.12/drivers/pnp/system.c 2004-10-19 10:54:38 -06:00
> +++ edited/drivers/pnp/system.c 2005-01-11 11:21:49 -07:00
> @@ -21,18 +21,19 @@
> { "", 0 }
> };
>
> -static void reserve_ioport_range(char *pnpid, int start, int end)
> +static void reserve_ioport_range(struct pnp_dev *dev, int start, int end)
> {
> struct resource *res;
> char *regionid;
> + int length = strlen(dev->dev.bus_id) + strlen(dev->name) + 8;
>
> - regionid = kmalloc(16, GFP_KERNEL);
> - if ( regionid == NULL )
> + regionid = kmalloc(length, GFP_KERNEL);
> + if (regionid == NULL)
> return;
> - snprintf(regionid, 16, "pnp %s", pnpid);
> - res = request_region(start,end-start+1,regionid);
> - if ( res == NULL )
> - kfree( regionid );
> + snprintf(regionid, length, "pnp %s (%s)", dev->dev.bus_id, dev->name);
> + res = request_region(start, end - start + 1, regionid);
> + if (res == NULL)
> + kfree(regionid);
> else
> res->flags &= ~IORESOURCE_BUSY;
> /*
> @@ -41,15 +42,15 @@
> * have double reservations.
> */
> printk(KERN_INFO
> - "pnp: %s: ioport range 0x%x-0x%x %s reserved\n",
> - pnpid, start, end,
> + "pnp: %s (%s): ioport range 0x%x-0x%x %s reserved\n",
> + dev->dev.bus_id, dev->name, start, end,
> NULL != res ? "has been" : "could not be"
> );
>
> return;
> }
>
> -static void reserve_resources_of_dev( struct pnp_dev *dev )
> +static void reserve_resources_of_dev(struct pnp_dev *dev)
> {
> int i;
>
> @@ -76,7 +77,7 @@
> /* Do nothing */
> continue;
> reserve_ioport_range(
> - dev->dev.bus_id,
> + dev,
> pnp_port_start(dev, i),
> pnp_port_end(dev, i)
> );
>