Alex Chiang wrote:
quoted text > Register one slot per slot, rather than one slot per function.
> Change the name of the slot to fake%d instead of the pci address.
>
> Signed-off-by: Alex Chiang <achiang@hp.com>
> Signed-off-by: Matthew Wilcox <matthew@wil.cx>
> ---
> drivers/pci/hotplug/fakephp.c | 75
> +++++++++++++++-------------------------- 1 files changed, 27
> insertions(+), 48 deletions(-)
>
> diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
> index 027f686..828335e 100644
> --- a/drivers/pci/hotplug/fakephp.c
> +++ b/drivers/pci/hotplug/fakephp.c
> @@ -93,6 +93,7 @@ static int add_slot(struct pci_dev *dev)
> struct dummy_slot *dslot;
> struct hotplug_slot *slot;
> int retval =3D -ENOMEM;
> + static int count =3D 1;
>
> slot =3D kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
> if (!slot)
> @@ -106,7 +107,8 @@ static int add_slot(struct pci_dev *dev)
> slot->info->max_bus_speed =3D PCI_SPEED_UNKNOWN;
> slot->info->cur_bus_speed =3D PCI_SPEED_UNKNOWN;
>
> - slot->name =3D &dev->dev.bus_id[0];
> + slot->name =3D kmalloc(8, GFP_KERNEL);
> + sprintf(slot->name, "fake%d", count++);
> dbg("slot->name =3D %s\n", slot->name);
>
> dslot =3D kmalloc(sizeof(struct dummy_slot), GFP_KERNEL);
This is ugly. Please do it the way we already do e.g. for acpiphp: add a=20
char[8] to "struct dummy_slot" and just reference that here. Or better do=20
what this name suggests: kill fakephp completely and use dummyphp[1] instea=
d.
Eike
1)
http://opensource.sf-tec.de/kernel/