Re: PATCH: PCI changes for pre-2.3.16-1

Riley Williams (rhw@MemAlpha.CX)
Tue, 31 Aug 1999 23:44:59 +0100 (GMT)


Hi Martin.

>> If you want to make life easier, just do a

>> char * pci_slot_fmt(struct pci_dev *dev)
>> {
>> static char fmt[10];
>>
>> sprintf(fmt, "%d:%d:%d", BUS(dev), SLOT(dev), FN(dev));
>> return fmt;
>> }

> Writing functions returning pointers to static data is just a
> subscription for the magic bug of the week contest. I don't
> want to have to take care of "you cannot print two slot names in
> one printk" type things.

That's hardly a problem...

#define MAX_SLOTS 8

char * pci_slot_fmt(struct pci_dev *dev)
{
static char fmt[MAX_SLOTS][12], p = 0;

++p %= MAX_SLOTS;
sprintf( fmt[p], "%d:%d:%d",
BUS(dev), SLOT(dev), FN(dev) );
return fmt[p];
}

How many slots do you wish to allow for?

Best wishes from Riley.

+----------------------------------------------------------------------+
| There is something frustrating about the quality and speed of Linux |
| development, ie., the quality is too high and the speed is too high, |
| in other words, I can implement this XXXX feature, but I bet someone |
| else has already done so and is just about to release their patch. |
+----------------------------------------------------------------------+
* ftp://ftp.MemAlpha.cx/pub/rhw/Linux
* http://www.MemAlpha.cx/Linux/

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