Re: [patch] pci hotplug: add common acpi functions to core

Greg KH
2006-03-01T00:53:12Z

On Tue, Feb 28, 2006 at 04:46:57PM -0800, Kristen Accardi wrote:
> shpchprm_acpi.c and pciehprm_acpi.c are nearly identical.
> In addition, there are functions in both these files that
> are also in acpiphp_glue.c. This patch will remove duplicate
> functions from shpchp, pciehp, and acpiphp and move this
> functionality to pci_hotplug, as it is not hardware specific.
> Get rid of shpchprm* and pciehprm* files since they are no longer needed.
> shpchprm_nonacpi.c and pciehprm_nonacpi.c are identical, as well
> as shpchprm_legacy.c and can be replaced with a macro.

Looks good, only a minor comment:

> +u8 * acpi_path_name( acpi_handle handle)

Funky spacing here.

> +int is_root_bridge(acpi_handle handle)
> +{
> + acpi_status status;
> + struct acpi_device_info *info;
> + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
> + int i;
> +
> + status = acpi_get_object_info(handle, &buffer);
> + if (ACPI_SUCCESS(status)) {
> + info = buffer.pointer;
> + if ((info->valid & ACPI_VALID_HID) &&
> + !strcmp(PCI_ROOT_HID_STRING,
> + info->hardware_id.value)) {
> + acpi_os_free(buffer.pointer);
> + return 1;
> + }
> + if (info->valid & ACPI_VALID_CID) {
> + for (i=0; i < info->compatibility_id.count; i++) {
> + if (!strcmp(PCI_ROOT_HID_STRING,
> + info->compatibility_id.id[i].value)) {
> + acpi_os_free(buffer.pointer);
> + return 1;
> + }
> + }
> + }
> + }
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(is_root_bridge);

The name "is_root_bridge" is pretty generic. Especially as it wants an
acpi handle. "acpi_is_root_bridge" perhaps?

thanks,

greg k-h