lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140701174616.GA10927@leverpostej>
Date:	Tue, 1 Jul 2014 18:46:16 +0100
From:	Mark Rutland <mark.rutland@....com>
To:	Stefan Wahren <stefan.wahren@...e.com>
Cc:	"davem@...emloft.net" <davem@...emloft.net>,
	"robh+dt@...nel.org" <robh+dt@...nel.org>,
	Pawel Moll <Pawel.Moll@....com>,
	"ijc+devicetree@...lion.org.uk" <ijc+devicetree@...lion.org.uk>,
	"galak@...eaurora.org" <galak@...eaurora.org>,
	"f.fainelli@...il.com" <f.fainelli@...il.com>,
	"eric.dumazet@...il.com" <eric.dumazet@...il.com>,
	"dave.taht@...il.com" <dave.taht@...il.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: Re: [PATCH RFC V2 2/2] net: qualcomm: new Ethernet over SPI driver
 for QCA7000

Hi,

On Tue, Jul 01, 2014 at 05:36:49PM +0100, Stefan Wahren wrote:
> This patch adds the Ethernet over SPI driver for the
> Qualcomm QCA7000 HomePlug GreenPHY.
> 
> Signed-off-by: Stefan Wahren <stefan.wahren@...e.com>
> ---
>  drivers/net/ethernet/Kconfig                |    1 +
>  drivers/net/ethernet/Makefile               |    1 +
>  drivers/net/ethernet/qualcomm/Kconfig       |   30 +
>  drivers/net/ethernet/qualcomm/Makefile      |    6 +
>  drivers/net/ethernet/qualcomm/qca_7k.c      |  149 ++++
>  drivers/net/ethernet/qualcomm/qca_7k.h      |   72 ++
>  drivers/net/ethernet/qualcomm/qca_debug.c   |  311 +++++++++
>  drivers/net/ethernet/qualcomm/qca_debug.h   |   34 +
>  drivers/net/ethernet/qualcomm/qca_framing.c |  155 +++++
>  drivers/net/ethernet/qualcomm/qca_framing.h |  134 ++++
>  drivers/net/ethernet/qualcomm/qca_spi.c     | 1001 +++++++++++++++++++++++++++
>  drivers/net/ethernet/qualcomm/qca_spi.h     |  114 +++
>  12 files changed, 2008 insertions(+)
>  create mode 100644 drivers/net/ethernet/qualcomm/Kconfig
>  create mode 100644 drivers/net/ethernet/qualcomm/Makefile
>  create mode 100644 drivers/net/ethernet/qualcomm/qca_7k.c
>  create mode 100644 drivers/net/ethernet/qualcomm/qca_7k.h
>  create mode 100644 drivers/net/ethernet/qualcomm/qca_debug.c
>  create mode 100644 drivers/net/ethernet/qualcomm/qca_debug.h
>  create mode 100644 drivers/net/ethernet/qualcomm/qca_framing.c
>  create mode 100644 drivers/net/ethernet/qualcomm/qca_framing.h
>  create mode 100644 drivers/net/ethernet/qualcomm/qca_spi.c
>  create mode 100644 drivers/net/ethernet/qualcomm/qca_spi.h

[...]

> +       if (of_find_property(spi_device->dev.of_node,
> +               "qca,legacy-mode", NULL)) {
> +               legacy_mode = 1;
> +       }

Please use of_property_read bool for boolean properties. Here you can
have:

	legacy_mode = of_property_read_bool(spi_device->dev.of_node,
					    "qca,legacy-mode")

[...]

> +
> +       if (qcaspi_clkspeed == 0) {
> +               if (of_find_property(spi_device->dev.of_node,
> +                                       "spi-max-frequency", NULL)) {
> +                       qcaspi_clkspeed = spi_device->max_speed_hz;
> +               } else {
> +                       qcaspi_clkspeed = QCASPI_CLK_SPEED;
> +               }
> +       }

As far as I can see, of_register_spi_devices leaves
spi_device->max_speed_hz zeroed if there's no spi-max-speed property, so
here you could have:

	qcaspi_clkspeed = spi_device->max_speed_hz ?: QCASPI_CLK_SPEED;

Which avoids redundant DT parsing.

[...]

> +               memcpy(qca->net_dev->dev_addr, mac, ETH_ALEN);

I believe that it is preferred to write:

	ether_addr_copy(qca->net_dev->dev_addr, mac);

I believe checkpatch has a warning for this.

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ