linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
To: Hiroo Matsumoto <matsumoto.hiroo@jp.fujitsu.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	jbarnes@virtuousgeek.org,
	Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Subject: Re: [PATCH v2 1/2] powerpc/PCI: Add pcibios_device_change_notifier for powerpc
Date: Wed, 23 May 2012 12:51:57 -0500	[thread overview]
Message-ID: <4FBD23BD.6050703@linux.vnet.ibm.com> (raw)
In-Reply-To: <4FBC4C92.7080902@jp.fujitsu.com>

On 05/22/2012 09:33 PM, Hiroo Matsumoto wrote:

> +static int pcibios_device_change_notifier(struct notifier_block *nb,
> +					  unsigned long action, void *data)
> +{
> +	struct pci_dev *dev = to_pci_dev(data);
> +



In the general case, we don't know what *data contains until we evaluate
'action'. This conversion should probably be moved inside the case:
statement.

> +	switch (action) {
> +	case BUS_NOTIFY_ADD_DEVICE:
> +		/* Setup OF node pointer in the device */
> +		dev->dev.of_node = pci_device_to_OF_node(dev);
> +
> +		/* Fixup NUMA node as it may not be setup yet by the generic
> +		 * code and is needed by the DMA init
> +		 */
> +		set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
> +
> +		/* Hook up default DMA ops */
> +		set_dma_ops(&dev->dev, pci_dma_ops);
> +		set_dma_offset(&dev->dev, PCI_DRAM_OFFSET);
> +
> +		/* Additional platform DMA/iommu setup */
> +		if (ppc_md.pci_dma_dev_setup)
> +			ppc_md.pci_dma_dev_setup(dev);
> +
> +		/* Read default IRQs and fixup if necessary */
> +		pci_read_irq_line(dev);
> +		if (ppc_md.pci_irq_fixup)
> +			ppc_md.pci_irq_fixup(dev);
> +
> +		break;
> +	}
> +
> +	return 0;
> +}
> +
> +static struct notifier_block device_nb = {
> +	.notifier_call = pcibios_device_change_notifier,
> +};



This is just a nit pick, but I think the naming of
pcibios_device_change_notifier() is a bit misleading. It doesn't
actually notify anything, but instead it *handles* notifications.
Perhaps a better name would be pcibios_device_change_handler() or
pcibios_device_change_callback()?

Sincerely,

Jesse Larrew
Software Engineer, Linux on Power Kernel Team
IBM Linux Technology Center
Phone: (512) 973-2052 (T/L: 363-2052)
jlarrew@linux.vnet.ibm.com

  reply	other threads:[~2012-05-23 17:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-23  2:33 [PATCH v2 1/2] powerpc/PCI: Add pcibios_device_change_notifier for powerpc Hiroo Matsumoto
2012-05-23 17:51 ` Jesse Larrew [this message]
2012-05-23 18:35   ` Bjorn Helgaas

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=4FBD23BD.6050703@linux.vnet.ibm.com \
    --to=jlarrew@linux.vnet.ibm.com \
    --cc=bhelgaas@google.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=matsumoto.hiroo@jp.fujitsu.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).