linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] include PNP device names in /proc/ioports and debug output
@ 2005-01-11 23:52 Bjorn Helgaas
  2005-01-13 17:54 ` Adam Belay
  0 siblings, 1 reply; 2+ messages in thread
From: Bjorn Helgaas @ 2005-01-11 23:52 UTC (permalink / raw)
  To: ambx1; +Cc: linux-kernel

Include PNP device names in /proc/ioports and when matching
driver with devices.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

===== 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)
 		);



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

* Re: [PATCH] include PNP device names in /proc/ioports and debug output
  2005-01-11 23:52 [PATCH] include PNP device names in /proc/ioports and debug output Bjorn Helgaas
@ 2005-01-13 17:54 ` Adam Belay
  0 siblings, 0 replies; 2+ messages in thread
From: Adam Belay @ 2005-01-13 17:54 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-kernel

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 <bjorn.helgaas@hp.com>
> 
> ===== 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)
>  		);
> 

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

end of thread, other threads:[~2005-01-13 18:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-11 23:52 [PATCH] include PNP device names in /proc/ioports and debug output Bjorn Helgaas
2005-01-13 17:54 ` Adam Belay

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).