Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1541141 > unrolled thread

[PATCH v2 1/7] hwrng: core: do not use multiple blank lines

Started byCorentin Labbe <clabbe.montjoie@gmail.com>
First post2016-12-13 16:00 +0100
Last post2016-12-27 11:10 +0100
Articles 9 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Corentin Labbe <clabbe.montjoie@gmail.com> - 2016-12-13 16:00 +0100
    [PATCH v2 5/7] hwrng: core: Move hwrng miscdev minor number to include/linux/miscdevice.h Corentin Labbe <clabbe.montjoie@gmail.com> - 2016-12-13 16:00 +0100
    [PATCH v2 6/7] hwrng: core: remove unused PFX macro Corentin Labbe <clabbe.montjoie@gmail.com> - 2016-12-13 16:00 +0100
    [PATCH v2 7/7] hwrng: core: Remove linux/sched.h from includes Corentin Labbe <clabbe.montjoie@gmail.com> - 2016-12-13 16:00 +0100
      Re: [PATCH v2 7/7] hwrng: core: Remove linux/sched.h from includes Herbert Xu <herbert@gondor.apana.org.au> - 2016-12-27 10:20 +0100
    [PATCH v2 2/7] hwrng: core: rewrite better comparison to NULL Corentin Labbe <clabbe.montjoie@gmail.com> - 2016-12-13 16:00 +0100
    [PATCH v2 4/7] hwrng: core: Replace asm/uaccess.h by linux/uaccess.h Corentin Labbe <clabbe.montjoie@gmail.com> - 2016-12-13 16:00 +0100
    [PATCH v2 3/7] hwrng: core: Rewrite the header Corentin Labbe <clabbe.montjoie@gmail.com> - 2016-12-13 16:00 +0100
    Re: [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Herbert Xu <herbert@gondor.apana.org.au> - 2016-12-27 11:10 +0100

#1541141 — [PATCH v2 1/7] hwrng: core: do not use multiple blank lines

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2016-12-13 16:00 +0100
Subject[PATCH v2 1/7] hwrng: core: do not use multiple blank lines
Message-ID<sNWIF-2q3-1@gated-at.bofh.it>
This patch fix the checkpatch warning "Please don't use multiple blank lines"

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/char/hw_random/core.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index d2d2c89..00cbb81 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -30,7 +30,6 @@
 
  */
 
-
 #include <linux/device.h>
 #include <linux/hw_random.h>
 #include <linux/module.h>
@@ -45,12 +44,10 @@
 #include <linux/err.h>
 #include <asm/uaccess.h>
 
-
 #define RNG_MODULE_NAME		"hw_random"
 #define PFX			RNG_MODULE_NAME ": "
 #define RNG_MISCDEV_MINOR	183 /* official */
 
-
 static struct hwrng *current_rng;
 static struct task_struct *hwrng_fill;
 static LIST_HEAD(rng_list);
@@ -296,7 +293,6 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,
 	goto out;
 }
 
-
 static const struct file_operations rng_chrdev_ops = {
 	.owner		= THIS_MODULE,
 	.open		= rng_dev_open,
@@ -314,7 +310,6 @@ static struct miscdevice rng_miscdev = {
 	.groups		= rng_dev_groups,
 };
 
-
 static ssize_t hwrng_attr_current_store(struct device *dev,
 					struct device_attribute *attr,
 					const char *buf, size_t len)
-- 
2.10.2

[toc] | [next] | [standalone]


#1541142 — [PATCH v2 5/7] hwrng: core: Move hwrng miscdev minor number to include/linux/miscdevice.h

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2016-12-13 16:00 +0100
Subject[PATCH v2 5/7] hwrng: core: Move hwrng miscdev minor number to include/linux/miscdevice.h
Message-ID<sNWIF-2q3-7@gated-at.bofh.it>
In reply to#1541141
This patch move the define for hwrng's miscdev minor number to
include/linux/miscdevice.h.
It's better that all minor number are in the same place.
Rename it to HWRNG_MINOR (from RNG_MISCDEV_MINOR) in he process since
no other miscdev define have MISCDEV in their name.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/char/hw_random/core.c | 3 +--
 include/linux/miscdevice.h    | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 7a2e496..1e1e385 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -26,7 +26,6 @@
 
 #define RNG_MODULE_NAME		"hw_random"
 #define PFX			RNG_MODULE_NAME ": "
-#define RNG_MISCDEV_MINOR	183 /* official */
 
 static struct hwrng *current_rng;
 static struct task_struct *hwrng_fill;
@@ -283,7 +282,7 @@ static const struct file_operations rng_chrdev_ops = {
 static const struct attribute_group *rng_dev_groups[];
 
 static struct miscdevice rng_miscdev = {
-	.minor		= RNG_MISCDEV_MINOR,
+	.minor		= HWRNG_MINOR,
 	.name		= RNG_MODULE_NAME,
 	.nodename	= "hwrng",
 	.fops		= &rng_chrdev_ops,
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 722698a..659f586 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -31,6 +31,7 @@
 #define SGI_MMTIMER		153
 #define STORE_QUEUE_MINOR	155	/* unused */
 #define I2O_MINOR		166
+#define HWRNG_MINOR		183
 #define MICROCODE_MINOR		184
 #define VFIO_MINOR		196
 #define TUN_MINOR		200
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1541143 — [PATCH v2 6/7] hwrng: core: remove unused PFX macro

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2016-12-13 16:00 +0100
Subject[PATCH v2 6/7] hwrng: core: remove unused PFX macro
Message-ID<sNWIF-2q3-3@gated-at.bofh.it>
In reply to#1541141
This patch remove the unused PFX macro.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/char/hw_random/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 1e1e385..5c654b5 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -25,7 +25,6 @@
 #include <linux/uaccess.h>
 
 #define RNG_MODULE_NAME		"hw_random"
-#define PFX			RNG_MODULE_NAME ": "
 
 static struct hwrng *current_rng;
 static struct task_struct *hwrng_fill;
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1541145 — [PATCH v2 7/7] hwrng: core: Remove linux/sched.h from includes

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2016-12-13 16:00 +0100
Subject[PATCH v2 7/7] hwrng: core: Remove linux/sched.h from includes
Message-ID<sNWIG-2q3-17@gated-at.bofh.it>
In reply to#1541141
linux/sched.h is useless for hw_random/core.c.
This patch remove it.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---

Change since v1:
- linux/fs.h was needed, keep it

 drivers/char/hw_random/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 5c654b5..1c5949b 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -20,7 +20,6 @@
 #include <linux/miscdevice.h>
 #include <linux/module.h>
 #include <linux/random.h>
-#include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
 
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1547527 — Re: [PATCH v2 7/7] hwrng: core: Remove linux/sched.h from includes

FromHerbert Xu <herbert@gondor.apana.org.au>
Date2016-12-27 10:20 +0100
SubjectRe: [PATCH v2 7/7] hwrng: core: Remove linux/sched.h from includes
Message-ID<sSW5j-b8-3@gated-at.bofh.it>
In reply to#1541145
On Tue, Dec 13, 2016 at 03:51:15PM +0100, Corentin Labbe wrote:
> linux/sched.h is useless for hw_random/core.c.
> This patch remove it.

I see a schedule_timeout_interruptible call in core.c.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[toc] | [prev] | [next] | [standalone]


#1541146 — [PATCH v2 2/7] hwrng: core: rewrite better comparison to NULL

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2016-12-13 16:00 +0100
Subject[PATCH v2 2/7] hwrng: core: rewrite better comparison to NULL
Message-ID<sNWIF-2q3-9@gated-at.bofh.it>
In reply to#1541141
This patch fix the checkpatch warning "Comparison to NULL could be written "!ptr"

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/char/hw_random/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 00cbb81..7029246 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -439,8 +439,7 @@ int hwrng_register(struct hwrng *rng)
 	int err = -EINVAL;
 	struct hwrng *old_rng, *tmp;
 
-	if (rng->name == NULL ||
-	    (rng->data_read == NULL && rng->read == NULL))
+	if (!rng->name || (!rng->data_read && !rng->read))
 		goto out;
 
 	mutex_lock(&rng_mutex);
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1541149 — [PATCH v2 4/7] hwrng: core: Replace asm/uaccess.h by linux/uaccess.h

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2016-12-13 16:00 +0100
Subject[PATCH v2 4/7] hwrng: core: Replace asm/uaccess.h by linux/uaccess.h
Message-ID<sNWIG-2q3-15@gated-at.bofh.it>
In reply to#1541141
This patch fix the checkpatch warning about asm/uaccess.h.
In the same time, we sort the headers in alphabetical order.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/char/hw_random/core.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index a8e63ae..7a2e496 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -10,19 +10,19 @@
  * of the GNU General Public License, incorporated herein by reference.
  */
 
+#include <linux/delay.h>
 #include <linux/device.h>
+#include <linux/err.h>
+#include <linux/fs.h>
 #include <linux/hw_random.h>
-#include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/fs.h>
-#include <linux/sched.h>
-#include <linux/miscdevice.h>
 #include <linux/kthread.h>
-#include <linux/delay.h>
-#include <linux/slab.h>
+#include <linux/miscdevice.h>
+#include <linux/module.h>
 #include <linux/random.h>
-#include <linux/err.h>
-#include <asm/uaccess.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/uaccess.h>
 
 #define RNG_MODULE_NAME		"hw_random"
 #define PFX			RNG_MODULE_NAME ": "
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1541150 — [PATCH v2 3/7] hwrng: core: Rewrite the header

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2016-12-13 16:00 +0100
Subject[PATCH v2 3/7] hwrng: core: Rewrite the header
Message-ID<sNWIG-2q3-33@gated-at.bofh.it>
In reply to#1541141
checkpatch have lot of complaint about header.
Furthermore, the header have some offtopic/useless information.

This patch rewrite a proper header.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/char/hw_random/core.c | 38 +++++++++-----------------------------
 1 file changed, 9 insertions(+), 29 deletions(-)

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 7029246..a8e63ae 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -1,33 +1,13 @@
 /*
-        Added support for the AMD Geode LX RNG
-	(c) Copyright 2004-2005 Advanced Micro Devices, Inc.
-
-	derived from
-
- 	Hardware driver for the Intel/AMD/VIA Random Number Generators (RNG)
-	(c) Copyright 2003 Red Hat Inc <jgarzik@redhat.com>
-
- 	derived from
-
-        Hardware driver for the AMD 768 Random Number Generator (RNG)
-        (c) Copyright 2001 Red Hat Inc <alan@redhat.com>
-
- 	derived from
-
-	Hardware driver for Intel i810 Random Number Generator (RNG)
-	Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com>
-	Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com>
-
-	Added generic RNG API
-	Copyright 2006 Michael Buesch <m@bues.ch>
-	Copyright 2005 (c) MontaVista Software, Inc.
-
-	Please read Documentation/hw_random.txt for details on use.
-
-	----------------------------------------------------------
-	This software may be used and distributed according to the terms
-        of the GNU General Public License, incorporated herein by reference.
-
+ * hw_random/core.c: HWRNG core API
+ *
+ * Copyright 2006 Michael Buesch <m@bues.ch>
+ * Copyright 2005 (c) MontaVista Software, Inc.
+ *
+ * Please read Documentation/hw_random.txt for details on use.
+ *
+ * This software may be used and distributed according to the terms
+ * of the GNU General Public License, incorporated herein by reference.
  */
 
 #include <linux/device.h>
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1547537

FromHerbert Xu <herbert@gondor.apana.org.au>
Date2016-12-27 11:10 +0100
Message-ID<sSWRH-FY-1@gated-at.bofh.it>
In reply to#1541141
On Tue, Dec 13, 2016 at 03:51:09PM +0100, Corentin Labbe wrote:
> This patch fix the checkpatch warning "Please don't use multiple blank lines"
> 
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Patches 1-6 applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web