Re: [PATCH v7 08/11] misc: rp1: RaspberryPi RP1 misc driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Even though this is not for the PCI sub-system directly, I had a very brief
look over the code.  I hope you don't mind.

As such, a few nit picks, nothing blocking.

> +# RaspberryPi RP1 misc device

Would this be better if it matched the "tristate" description below?

> +config MISC_RP1
> +	tristate "RaspberryPi RP1 PCIe support"
> +	depends on OF_IRQ && OF_OVERLAY && PCI_MSI && PCI_QUIRKS
> +	select PCI_DYNAMIC_OF_NODES
> +	help
> +	  Support the RP1 peripheral chip found on Raspberry Pi 5 board.
> +
> +	  This device supports several sub-devices including e.g. Ethernet
> +	  controller, USB controller, I2C, SPI and UART.
> +
> +	  The driver is responsible for enabling the DT node once the PCIe
> +	  endpoint has been configured, and handling interrupts.
> +
> +	  This driver uses an overlay to load other drivers to support for
> +	  RP1 internal sub-devices.

> +/* the dts overlay is included from the dts directory so

  /*
   * The dts overlay is included from the dts directory so

To make the code comment match rest of the style.

> +/*
> + * Copyright (c) 2018-24 Raspberry Pi Ltd.
> + * All rights reserved.

  Copyright (c) 2018-2025 Raspberry Pi Ltd.

To spell the current year fully, plus update it to 2025 already.

I would also add an extra newline here to split the two apart a bit.

> +	if (pci_resource_len(pdev, 1) <= 0x10000) {
> +		dev_err(&pdev->dev,
> +			"Not initialised - is the firmware running?\n");
> +		return -EINVAL;
> +	}

The American spelling in the above might be better.  But I don't have
strong opinions here.  It seems more popular in error messages.

> +	err = pci_alloc_irq_vectors(pdev, RP1_INT_END, RP1_INT_END,
> +				    PCI_IRQ_MSIX);
> +	if (err < 0) {
> +		return dev_err_probe(&pdev->dev, err,
> +				     "pci_alloc_irq_vectors failed");

Missing a new line at the end, but also...

  return dev_err_probe(&pdev->dev, err,
		       "Failed to allocate MSI-X vectors\n");

Or, something like this over this the function name.  Perhaps exposing
error code could be useful to the end user? If so then something like this:

  return dev_err_probe(&pdev->dev, err,
		       "Failed to allocate MSI-X vectors, err=%d\n", err);

Here and other errors where appropriate.

> +	for (i = 0; i < RP1_INT_END; i++) {
> +		unsigned int irq = irq_create_mapping(rp1->domain, i);
> +
> +		if (!irq) {
> +			dev_err(&pdev->dev, "failed to create irq mapping\n");

  dev_err(&pdev->dev, "Failed to create IRQ mapping\n");

To make the error message capitalisation consistent.

> +static const struct pci_device_id dev_id_table[] = {
> +	{ PCI_DEVICE(PCI_VENDOR_ID_RPI, PCI_DEVICE_ID_RPI_RP1_C0), },
> +	{ 0, }

  { }

Would probably be sufficient.

> +MODULE_AUTHOR("Phil Elwell <phil@xxxxxxxxxxxxxxx>");
> +MODULE_AUTHOR("Andrea della Porta <andrea.porta@xxxxxxxx>");
> +MODULE_DESCRIPTION("RP1 wrapper");

  RaspberryPi RP1 misc device

To match the Kconfig comment in the above description or the one from the
"tristate" also in Kconfig.

Thank you for all the work here!

	Krzysztof




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux