Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1477283

Re: [PATCH V9 1/8] ACPI: I/O Remapping Table (IORT) initial support

From "Rafael J. Wysocki" <rafael@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH V9 1/8] ACPI: I/O Remapping Table (IORT) initial support
Date 2016-09-06 13:20 +0200
Message-ID <semA2-1hJ-5@gated-at.bofh.it> (permalink)
References <se8x3-8O-3@gated-at.bofh.it> <se8x4-8O-15@gated-at.bofh.it> <se8GK-f4-9@gated-at.bofh.it> <seiZr-7fd-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Sep 6, 2016 at 9:24 AM, Tomasz Nowicki <tn@semihalf.com> wrote:
> Hi Rafael,
>
>
> On 05.09.2016 22:29, Rafael J. Wysocki wrote:
>>
>> On Mon, Sep 5, 2016 at 10:05 PM, Tomasz Nowicki <tn@semihalf.com> wrote:
>>>

[cut]

> static acpi_status iort_match_node_callback(struct acpi_iort_node *node,
>                                             void *context)
> {
>         struct device *dev = context;
>         acpi_status status = AE_NOT_FOUND;
>
>         switch (node->type) {
>         case ACPI_IORT_NODE_NAMED_COMPONENT: {
>                 struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
>                 struct acpi_device *adev = to_acpi_device_node(dev->fwnode);
>                 struct acpi_iort_named_component *ncomp;
>
>                 if (!adev)
>                         break;
>
>                 status = acpi_get_name(adev->handle, ACPI_FULL_PATHNAME,
> &buf);
>                 if (ACPI_FAILURE(status)) {
>                         dev_warn(dev, "Can't get device full path name\n");
>                         break;
>                 }
>
>                 ncomp = (struct acpi_iort_named_component *)node->node_data;
>                 if (!strcmp(ncomp->device_name, buf.pointer))
>                         status = AE_OK;
>
>                 acpi_os_free(buf.pointer);
>                 break;
>         }
>         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: {
>                 struct acpi_iort_root_complex *pci_rc;
>                 struct pci_bus *bus;
>
>                 bus = to_pci_bus(dev);
>                 pci_rc = (struct acpi_iort_root_complex *)node->node_data;
>
>                 /*
>                  * It is assumed that PCI segment numbers maps one-to-one
>                  * with root complexes. Each segment number can represent
> only
>                  * one root complex.
>                  */
>                 if (pci_rc->pci_segment_number == pci_domain_nr(bus))
>                         status = AE_OK;
>
>                 break;
>         }
>         }
>
>         return status;
> }
>
>>
>>> +               } else {
>>> +                       int match;
>>> +
>>> +                       match = !strcmp(ncomp->device_name,
>>> buffer.pointer);
>>> +                       acpi_os_free(buffer.pointer);
>>> +
>>> +                       if (match)
>>> +                               return AE_OK;
>>> +               }
>>> +
>>> +               break;
>>> +       }
>>> +       case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: {
>>
>>
>> What is the brace for?
>
>
> To create namespace for below local variables. The same for
> ACPI_IORT_NODE_NAMED_COMPONENT case.

This looks weird, though.  At least nest it in a usual way.

And what would be wrong with using if () {} else if () {} instead?

There are two cases only here anyway.

Thanks,
Rafael

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V9 0/8] Introduce ACPI world to ITS irqchip Tomasz Nowicki <tn@semihalf.com> - 2016-09-05 22:20 +0200
  [PATCH V9 6/8] irqchip/gicv3-its: Probe ITS in the ACPI way Tomasz Nowicki <tn@semihalf.com> - 2016-09-05 22:20 +0200
  [PATCH V9 1/8] ACPI: I/O Remapping Table (IORT) initial support Tomasz Nowicki <tn@semihalf.com> - 2016-09-05 22:20 +0200
    Re: [PATCH V9 1/8] ACPI: I/O Remapping Table (IORT) initial support "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-05 22:30 +0200
      Re: [PATCH V9 1/8] ACPI: I/O Remapping Table (IORT) initial support Tomasz Nowicki <tn@semihalf.com> - 2016-09-06 09:30 +0200
        Re: [PATCH V9 1/8] ACPI: I/O Remapping Table (IORT) initial support "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-06 13:20 +0200
  [PATCH V9 5/8] irqchip/gicv3-its: Refactor ITS DT init code to prepare for ACPI Tomasz Nowicki <tn@semihalf.com> - 2016-09-05 22:20 +0200
  [PATCH V9 4/8] irqchip/gicv3-its: Cleanup for ITS domain initialization Tomasz Nowicki <tn@semihalf.com> - 2016-09-05 22:20 +0200
  [PATCH V9 8/8] irqchip/gicv3-its: Use MADT ITS subtable to do PCI/MSI domain initialization Tomasz Nowicki <tn@semihalf.com> - 2016-09-05 22:20 +0200
  [PATCH V9 2/8] ACPI: Add new IORT functions to support MSI domain handling Tomasz Nowicki <tn@semihalf.com> - 2016-09-05 22:20 +0200
  [PATCH V9 7/8] irqchip/gicv3-its: Factor out PCI-MSI part that might be reused for ACPI Tomasz Nowicki <tn@semihalf.com> - 2016-09-05 22:20 +0200
  [PATCH V9 3/8] PCI/MSI: Setup MSI domain on a per-device basis using IORT ACPI table Tomasz Nowicki <tn@semihalf.com> - 2016-09-05 22:20 +0200

csiph-web