Skip to contentSkip to conversation

parisc: struct device - replace bus_id with dev_name(), dev_set_name()

PATCH Kay Sievers 3 participants 4 messages Jan 25, 2009 – Jan 26, 2009 PA-RISC architecture

lore
Share & tools
lore
#0 lore raw

From: Kay Sievers <[email protected]>
Subject: parisc: struct device - replace bus_id with dev_name(), dev_set_name()

---
 drivers/parisc/dino.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/parisc/dino.c +6 -5
@@ -479,7 +479,7 @@ dino_card_setup(struct pci_bus *bus, voi
 	res = &dino_dev->hba.lmmio_space;
 	res->flags = IORESOURCE_MEM;
 	size = scnprintf(name, sizeof(name), "Dino LMMIO (%s)", 
-			 bus->bridge->bus_id);
+			 dev_name(bus->bridge));
 	res->name = kmalloc(size+1, GFP_KERNEL);
 	if(res->name)
 		strcpy((char *)res->name, name);
@@ -493,7 +493,7 @@ dino_card_setup(struct pci_bus *bus, voi
 		struct list_head *ln, *tmp_ln;
 
 		printk(KERN_ERR "Dino: cannot attach bus %s\n",
-		       bus->bridge->bus_id);
+		       dev_name(bus->bridge));
 		/* kill the bus, we can't do anything with it */
 		list_for_each_safe(ln, tmp_ln, &bus->devices) {
 			struct pci_dev *dev = pci_dev_b(ln);
@@ -611,12 +611,12 @@ dino_fixup_bus(struct pci_bus *bus)
 			}
 					
 			DBG("DEBUG %s assigning %d [0x%lx,0x%lx]\n",
-			    bus->self->dev.bus_id, i,
+			    dev_name(&bus->self->dev), i,
 			    bus->self->resource[i].start,
 			    bus->self->resource[i].end);
 			pci_assign_resource(bus->self, i);
 			DBG("DEBUG %s after assign %d [0x%lx,0x%lx]\n",
-			    bus->self->dev.bus_id, i,
+			    dev_name(&bus->self->dev), i,
 			    bus->self->resource[i].start,
 			    bus->self->resource[i].end);
 		}
@@ -1026,7 +1026,8 @@ static int __init dino_probe(struct pari
 		dino_current_bus = bus->subordinate + 1;
 		pci_bus_assign_resources(bus);
 	} else {
-		printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (probably duplicate bus number %d)\n", dev->dev.bus_id, dino_current_bus);
+		printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (probably duplicate bus number %d)\n",
+		       dev_name(&dev->dev), dino_current_bus);
 		/* increment the bus number in case of duplicates */
 		dino_current_bus++;
 	}
Reviewed-by
#1 lore raw
Quoted 2 lines · Kay Sievers

From: Kay Sievers <[email protected]>
Subject: parisc: struct device - replace bus_id with dev_name(), dev_set_name()

In general, no objection. Just one nit below.

Otherwise, please add:

Quoted 22 lines
---
 drivers/parisc/dino.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/parisc/dino.c +1 -1
@@ -479,7 +479,7 @@ dino_card_setup(struct pci_bus *bus, voi
 	res = &dino_dev->hba.lmmio_space;
 	res->flags = IORESOURCE_MEM;
 	size = scnprintf(name, sizeof(name), "Dino LMMIO (%s)", 
-			 bus->bridge->bus_id);
+			 dev_name(bus->bridge));
 	res->name = kmalloc(size+1, GFP_KERNEL);
 	if(res->name)
 		strcpy((char *)res->name, name);

drivers/parisc/dino.c dino_card_setup(struct pci_bus *bus, voi · line 496

Quoted 5 lines
drivers/parisc/dino.c +1 -1
@@ -493,7 +493,7 @@ dino_card_setup(struct pci_bus *bus, voi
 		struct list_head *ln, *tmp_ln;
 
 		printk(KERN_ERR "Dino: cannot attach bus %s\n",
-		       bus->bridge->bus_id);
+		       dev_name(bus->bridge));

I think the "cannot attach bus" string needs to be changed to "cannot attach dev" or whatever dev_name() is supposed to represent. While the code in include/linux/device.h is using "bus_id", the comments say:

static inline const char *dev_name(const struct device *dev)

{
        /* will be changed into kobject_name(&dev->kobj) in the near future */
        return dev->bus_id;
}

And that could mean anything.
The rest look fine.

thanks,
grant

Quoted 33 lines
drivers/parisc/dino.c +4 -4
 		/* kill the bus, we can't do anything with it */
 		list_for_each_safe(ln, tmp_ln, &bus->devices) {
 			struct pci_dev *dev = pci_dev_b(ln);
@@ -611,12 +611,12 @@ dino_fixup_bus(struct pci_bus *bus)
 			}
 
 			DBG("DEBUG %s assigning %d [0x%lx,0x%lx]\n",
-			    bus->self->dev.bus_id, i,
+			    dev_name(&bus->self->dev), i,
 			    bus->self->resource[i].start,
 			    bus->self->resource[i].end);
 			pci_assign_resource(bus->self, i);
 			DBG("DEBUG %s after assign %d [0x%lx,0x%lx]\n",
-			    bus->self->dev.bus_id, i,
+			    dev_name(&bus->self->dev), i,
 			    bus->self->resource[i].start,
 			    bus->self->resource[i].end);
 		}
@@ -1026,7 +1026,8 @@ static int __init dino_probe(struct pari
 		dino_current_bus = bus->subordinate + 1;
 		pci_bus_assign_resources(bus);
 	} else {
-		printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (probably duplicate bus number %d)\n", dev->dev.bus_id, dino_current_bus);
+		printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (probably duplicate bus number %d)\n",
+		       dev_name(&dev->dev), dino_current_bus);
 		/* increment the bus number in case of duplicates */
 		dino_current_bus++;
 	}
 
--

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

#2 lore raw
Quoted 7 lines · Grant Grundler
Quoted 2 lines · Kay Sievers

From: Kay Sievers <[email protected]>
Subject: parisc: struct device - replace bus_id with dev_name(), dev_set_name()

In general, no objection. Just one nit below.

Otherwise, please add:

Quoted 8 lines

Review

Quoted 3 lines

printk(KERN_ERR "Dino: cannot attach bus %s\n",

(quoted diff) +1 -1
-                    bus->bridge->bus_id);
+                    dev_name(bus->bridge));

I think the "cannot attach bus" string needs to be changed to "cannot attach dev" or whatever dev_name() is supposed to represent.

The code probably uses a "struct device" to represent a "bus", which sounds fine because the "devices" are more "objects" than "devices" sometimes.

Quoted 8 lines

While the code in include/linux/device.h is using "bus_id", the comments say:

static inline const char *dev_name(const struct device *dev)

{
       /* will be changed into kobject_name(&dev->kobj) in the near future */
       return dev->bus_id;
}

It's the "name" of a "device", the comment has already gone away with the final patch in the bus_id series.

Thanks,
Kay