[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200711141339.31839.eike-hotplug@sf-tec.de>
Date: Wed, 14 Nov 2007 13:39:26 +0100
From: Rolf Eike Beer <eike-hotplug@...tec.de>
To: pcihpd-discuss@...ts.sourceforge.net
Cc: Alex Chiang <achiang@...com>, gregkh@...e.de,
kristen.c.accardi@...el.com, lenb@...nel.org, matthew@....cx,
rick.jones2@...com, linux-kernel@...r.kernel.org,
linux-pci@...ey.karlin.mff.cuni.cz, linux-acpi@...r.kernel.org
Subject: Re: [Pcihpd-discuss] [PATCH 2/5] Construct one fakephp slot per pci slot
Alex Chiang wrote:
> 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@...com>
> Signed-off-by: Matthew Wilcox <matthew@....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 = -ENOMEM;
> + static int count = 1;
>
> slot = 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 = PCI_SPEED_UNKNOWN;
> slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN;
>
> - slot->name = &dev->dev.bus_id[0];
> + slot->name = kmalloc(8, GFP_KERNEL);
> + sprintf(slot->name, "fake%d", count++);
> dbg("slot->name = %s\n", slot->name);
>
> dslot = kmalloc(sizeof(struct dummy_slot), GFP_KERNEL);
This is ugly. Please do it the way we already do e.g. for acpiphp: add a
char[8] to "struct dummy_slot" and just reference that here. Or better do
what this name suggests: kill fakephp completely and use dummyphp[1] instead.
Eike
1) http://opensource.sf-tec.de/kernel/
Download attachment "signature.asc " of type "application/pgp-signature" (195 bytes)
Powered by blists - more mailing lists