Re: [PATCH] use bus_slot number for name

From: Dave Jones
Date: Fri Aug 05 2005 - 14:55:01 EST


On Fri, Aug 05, 2005 at 12:16:06PM -0700, Kristen Accardi wrote:
> For systems with multiple hotplug controllers, you need to use more than
> just the slot number to uniquely name the slot. Without a unique slot
> name, the pci_hp_register() will fail. This patch adds the bus number
> to the name.
>
> Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@xxxxxxxxx>
>
> diff -uprN -X linux-2.6.13-rc4/Documentation/dontdiff linux-2.6.13-rc4/drivers/pci/hotplug/pciehp.h linux-2.6.13-rc4-shpchp-slot-name-fix/drivers/pci/hotplug/pciehp.h
> --- linux-2.6.13-rc4/drivers/pci/hotplug/pciehp.h 2005-07-28 15:44:44.000000000 -0700
> +++ linux-2.6.13-rc4-shpchp-slot-name-fix/drivers/pci/hotplug/pciehp.h 2005-08-04 17:57:18.000000000 -0700
> @@ -302,7 +302,7 @@ static inline void return_resource(struc
>
> static inline void make_slot_name(char *buffer, int buffer_size, struct slot *slot)
> {
> - snprintf(buffer, buffer_size, "%d", slot->number);
> + snprintf(buffer, buffer_size, "%04d_%04d", slot->bus, slot->number);
> }

Won't using..

snprintf(buffer, buffer_size, "%s", pci_name(slot));

work equally as well, and also future-proof this ?

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