All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Cc: Andrew Morton <akpm@osdl.org>, Len Brown <len.brown@intel.com>,
	"Luck, Tony" <tony.luck@intel.com>, Greg KH <greg@kroah.com>,
	acpi-devel@lists.sourceforge.net, linux-ia64@vger.kernel.org,
	pcihpd-discuss@lists.sourceforge.net
Subject: Re: [ACPI] [RFC/PATCH 3/3] ACPI based I/O APIC hot-plug
Date: Thu, 21 Apr 2005 11:22:11 -0600	[thread overview]
Message-ID: <1114104131.2784.43.camel@eeyore> (raw)
In-Reply-To: <4267AD21.7040006@jp.fujitsu.com>

> +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.


WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Cc: Andrew Morton <akpm@osdl.org>, Len Brown <len.brown@intel.com>,
	"Luck, Tony" <tony.luck@intel.com>, Greg KH <greg@kroah.com>,
	acpi-devel@lists.sourceforge.net, linux-ia64@vger.kernel.org,
	pcihpd-discuss@lists.sourceforge.net
Subject: Re: [ACPI] [RFC/PATCH 3/3] ACPI based I/O APIC hot-plug
Date: Thu, 21 Apr 2005 17:22:11 +0000	[thread overview]
Message-ID: <1114104131.2784.43.camel@eeyore> (raw)
In-Reply-To: <4267AD21.7040006@jp.fujitsu.com>

> +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.


  reply	other threads:[~2005-04-21 17:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-21 13:39 [RFC/PATCH 3/3] ACPI based I/O APIC hot-plug Kenji Kaneshige
2005-04-21 13:39 ` Kenji Kaneshige
2005-04-21 17:22 ` Bjorn Helgaas [this message]
2005-04-21 17:22   ` [ACPI] " Bjorn Helgaas
2005-04-22  6:38   ` Kenji Kaneshige
2005-04-22  6:38     ` Kenji Kaneshige
2005-04-22 14:58     ` Bjorn Helgaas
2005-04-22 14:58       ` Bjorn Helgaas
2005-04-22 15:15       ` Greg KH
2005-04-22 15:15         ` [ACPI] " Greg KH
2005-04-25  9:16       ` Kenji Kaneshige
2005-04-25  9:16         ` Kenji Kaneshige

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1114104131.2784.43.camel@eeyore \
    --to=bjorn.helgaas@hp.com \
    --cc=acpi-devel@lists.sourceforge.net \
    --cc=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=len.brown@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=pcihpd-discuss@lists.sourceforge.net \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.