linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Tomasz Nowicki <tn@semihalf.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Bjorn Helgaas <helgaas@kernel.org>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Hanjun Guo <hanjun.guo@linaro.org>,
	shijie.huang@arm.com, robert.richter@caviumnetworks.com,
	Marcin Wojtas <mw@semihalf.com>,
	Linux PCI <linux-pci@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linaro-acpi@lists.linaro.org" <linaro-acpi@lists.linaro.org>,
	Andrea Gallo <andrea.gallo@linaro.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Al Stone <al.stone@linaro.org>,
	G Gregory <graeme.gregory@linaro.org>,
	David Daney <ddaney.cavm@gmail.com>,
	Sinan Kaya <okaya@codeaurora.org>
Subject: Re: [PATCH V9 1/8] ACPI: I/O Remapping Table (IORT) initial support
Date: Tue, 6 Sep 2016 13:15:46 +0200	[thread overview]
Message-ID: <CAJZ5v0iSbWr3O5qDpMimNxDSmDHq8yn0TmysPDKj3=k2dSve=Q@mail.gmail.com> (raw)
In-Reply-To: <a950814b-6bfb-7435-b137-c42cf2c1908c@semihalf.com>

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

  reply	other threads:[~2016-09-06 11:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-05 20:05 [PATCH V9 0/8] Introduce ACPI world to ITS irqchip Tomasz Nowicki
2016-09-05 20:05 ` [PATCH V9 1/8] ACPI: I/O Remapping Table (IORT) initial support Tomasz Nowicki
2016-09-05 20:29   ` Rafael J. Wysocki
2016-09-06  7:24     ` Tomasz Nowicki
2016-09-06 11:15       ` Rafael J. Wysocki [this message]
2016-09-05 20:05 ` [PATCH V9 2/8] ACPI: Add new IORT functions to support MSI domain handling Tomasz Nowicki
2016-09-05 20:05 ` [PATCH V9 3/8] PCI/MSI: Setup MSI domain on a per-device basis using IORT ACPI table Tomasz Nowicki
2016-09-05 20:05 ` [PATCH V9 4/8] irqchip/gicv3-its: Cleanup for ITS domain initialization Tomasz Nowicki
2016-09-05 20:05 ` [PATCH V9 5/8] irqchip/gicv3-its: Refactor ITS DT init code to prepare for ACPI Tomasz Nowicki
2016-09-05 20:05 ` [PATCH V9 6/8] irqchip/gicv3-its: Probe ITS in the ACPI way Tomasz Nowicki
2016-09-05 20:05 ` [PATCH V9 7/8] irqchip/gicv3-its: Factor out PCI-MSI part that might be reused for ACPI Tomasz Nowicki
2016-09-05 20:05 ` [PATCH V9 8/8] irqchip/gicv3-its: Use MADT ITS subtable to do PCI/MSI domain initialization Tomasz Nowicki

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='CAJZ5v0iSbWr3O5qDpMimNxDSmDHq8yn0TmysPDKj3=k2dSve=Q@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=al.stone@linaro.org \
    --cc=andrea.gallo@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=graeme.gregory@linaro.org \
    --cc=hanjun.guo@linaro.org \
    --cc=helgaas@kernel.org \
    --cc=jason@lakedaemon.net \
    --cc=linaro-acpi@lists.linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mw@semihalf.com \
    --cc=okaya@codeaurora.org \
    --cc=rjw@rjwysocki.net \
    --cc=robert.richter@caviumnetworks.com \
    --cc=shijie.huang@arm.com \
    --cc=tglx@linutronix.de \
    --cc=tn@semihalf.com \
    --cc=will.deacon@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).