Re: [ACPI] [RFC/PATCH 3/3] ACPI based I/O APIC hot-plug

Bjorn Helgaas
2005-04-21T17:22:11Z

> +static struct pci_dev *get_apic_pci_info(acpi_handle handle)

Nitpick: follow function declaration style of file.

> + struct acpi_pci_id id;
> + struct pci_bus *bus;
> + struct pci_dev *dev;
> +
> + if (ACPI_FAILURE(acpi_get_pci_id(handle, &id)))
> + return NULL;
> +
> + bus = pci_find_bus(id.segment, id.bus);
> + if (!bus)
> + return NULL;
> +
> + list_for_each_entry(dev, &bus->devices, bus_list) {
> + if (dev->devfn != PCI_DEVFN(id.device, id.function))
> + continue;

Use pci_get_slot() here rather than walking bus->devices yourself.

> + if ((dev->class >> 8) != PCI_CLASS_SYSTEM_PIC)
> + continue;
> + if ((dev->class & 0xff) == 0x10 || (dev->class & 0xff) == 0x20)

What are 0x10 and 0x20? Looks like they should be #defines in
include/linux/pci_ids.h.

> +static int get_gsi_base(acpi_handle handle, u32 *gsi_base)
> +{
> + acpi_status status;
> + int result = -1;
> + unsigned long gsb;
> + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
> + union acpi_object *obj;
> + void *table;
> +
> + status = acpi_evaluate_integer(handle, "_GSB", NULL, &gsb);
> + if (ACPI_SUCCESS(status)) {
> + *gsi_base = (u32)gsb;
> + return 0;
> + }
> +
> + status = acpi_evaluate_object(handle, "_MAT", NULL, &buffer);
> + if (ACPI_FAILURE(status) || !buffer.length || !buffer.pointer)
> + return result;

Nothing can modify result before this point, so it'd be clearer
to just "return -1" here.