All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Lubomir Rintel <lkundrak@v3.sk>
Cc: linux-kernel@vger.kernel.org, Matt Mackall <mpm@selenic.com>,
	linux-rpi-kernel@lists.infradead.org
Subject: Re: [PATCH] hw_random: Add Broadcom BCM2835 RNG Driver
Date: Fri, 22 Mar 2013 20:44:41 -0600	[thread overview]
Message-ID: <514D1719.501@wwwdotorg.org> (raw)
In-Reply-To: <1363956930-5717-1-git-send-email-lkundrak@v3.sk>

On 03/22/2013 06:55 AM, Lubomir Rintel wrote:
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

A commit description would be useful.

>  arch/arm/boot/dts/bcm2835.dtsi       |    5 +
>  arch/arm/configs/bcm2835_defconfig   |    3 +-
>  drivers/char/hw_random/Kconfig       |   12 +++
>  drivers/char/hw_random/Makefile      |    1 +
>  drivers/char/hw_random/bcm2835-rng.c |  137 ++++++++++++++++++++++++++++++++++

This should be split into 3 separate patches: (1) The driver itself, (2)
the change to bcm2835.dtsi, and (3) the change to bcm2835_defconfig.

Since you're adding a new device to device tree for the first time, you
should write a binding document for it; most likely
Documentation/devicetree/bindings/rng/brcm,bcm2835.txt (or perhaps
/random/ rather than /rng/?)

Is this driver based on the downstream Raspberry Pi kernel's driver? If
so, some mention of that fact would be appropriate in the commit
description, or even the git author field. I note that in the downstream
kernel, the commit which adds the RNG driver isn't signed off at all.
This probably means you need to get Dom to add his signed-off-by line
for that commit before basing your work on it. See
Documentation/SubmittingPatches for more details.

> diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c

> + * Redistribution and use in source and binary forms, with or without
...
> + * ALTERNATIVELY, this software may be distributed under the terms of the
> + * GNU General Public License ("GPL") version 2, as published by the Free
> + * Software Foundation.

I am not a lawyer, but I'd be tempted to exercise that right, and
distribute this patch solely under the terms of the GPLv2, and hence
remove the other license. It's not a big deal, but it'd simplify the
licensing in the upstream kernel.

> +static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max,
> +			       bool wait)

> +	while ((__raw_readl(rng_base + RNG_STATUS)>>24) == 0) {

You'd usually put spaces around the >>.

> +static int bcm2835_rng_probe(struct platform_device *op)

"pdev" is a more typical name than "op".

> +{
> +	struct device *dev = &op->dev;
> +	struct device_node *np = dev->of_node;
> +	void __iomem *rng_base;
> +	int err;
> +
> +	/* map peripheral */
> +	rng_base = of_iomap(np, 0);
> +	if (WARN(!rng_base, "failed to remap rng regs"))
> +		return -ENODEV;

The WARN() doesn't seem necessary. dev_err() inside the if{} would be
more appropriate,

> +static struct platform_driver bcm2835_rng_driver = {
...
> +};
> +
> +module_platform_driver(bcm2835_rng_driver);

Typically, no blank line there.

> +MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>");
> +MODULE_DESCRIPTION("BCM2835 Random Number Generator (RNG) driver");
> +MODULE_LICENSE("GPL and additional rights");

I think that should be "GPLv2 and ...".

  reply	other threads:[~2013-03-23  2:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 12:55 [PATCH] hw_random: Add Broadcom BCM2835 RNG Driver Lubomir Rintel
2013-03-23  2:44 ` Stephen Warren [this message]
2013-03-24 14:37   ` Lubomir Rintel
2013-03-27  2:52     ` Stephen Warren
2013-03-28  6:15   ` Lubomir Rintel
2013-03-24 14:31 ` [PATCH v2] bcm2835: Add Broadcom BCM2835 RNG to the device tree Lubomir Rintel
2013-03-24 14:39   ` [PATCH v2] hw_random: Add Broadcom BCM2835 RNG driver Lubomir Rintel
2013-03-24 14:41     ` [PATCH v2] arm: Add Broadcom BCM2835 RNG driver to bcm2835_defconfig Lubomir Rintel
2013-04-03  6:28       ` Stephen Warren
2013-03-27  3:00     ` [PATCH v2] hw_random: Add Broadcom BCM2835 RNG driver Stephen Warren
2013-03-27  3:20     ` Stephen Warren
2013-03-28  6:19     ` [PATCH v3] " Lubomir Rintel
2013-04-03  1:53       ` Herbert Xu
2013-03-27  2:55   ` [PATCH v2] bcm2835: Add Broadcom BCM2835 RNG to the device tree Stephen Warren
2013-03-28  6:12   ` [PATCH] " Lubomir Rintel
2013-03-28  6:12     ` Lubomir Rintel
2013-04-02  2:38     ` Stephen Warren
2013-04-02  2:38       ` Stephen Warren
2013-04-03  6:28     ` Stephen Warren
2013-04-03  6:28       ` Stephen Warren

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=514D1719.501@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=lkundrak@v3.sk \
    --cc=mpm@selenic.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.