* [PATCH v2 1/7] hwrng: core: do not use multiple blank lines
@ 2016-12-13 14:51 Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 2/7] hwrng: core: rewrite better comparison to NULL Corentin Labbe
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: Corentin Labbe @ 2016-12-13 14:51 UTC (permalink / raw)
To: mpm, herbert, arnd, gregkh; +Cc: linux-crypto, linux-kernel, Corentin Labbe
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/7] hwrng: core: rewrite better comparison to NULL
2016-12-13 14:51 [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Corentin Labbe
@ 2016-12-13 14:51 ` Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 3/7] hwrng: core: Rewrite the header Corentin Labbe
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2016-12-13 14:51 UTC (permalink / raw)
To: mpm, herbert, arnd, gregkh; +Cc: linux-crypto, linux-kernel, Corentin Labbe
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 3/7] hwrng: core: Rewrite the header
2016-12-13 14:51 [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 2/7] hwrng: core: rewrite better comparison to NULL Corentin Labbe
@ 2016-12-13 14:51 ` Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 4/7] hwrng: core: Replace asm/uaccess.h by linux/uaccess.h Corentin Labbe
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2016-12-13 14:51 UTC (permalink / raw)
To: mpm, herbert, arnd, gregkh; +Cc: linux-crypto, linux-kernel, Corentin Labbe
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 4/7] hwrng: core: Replace asm/uaccess.h by linux/uaccess.h
2016-12-13 14:51 [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 2/7] hwrng: core: rewrite better comparison to NULL Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 3/7] hwrng: core: Rewrite the header Corentin Labbe
@ 2016-12-13 14:51 ` Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 5/7] hwrng: core: Move hwrng miscdev minor number to include/linux/miscdevice.h Corentin Labbe
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2016-12-13 14:51 UTC (permalink / raw)
To: mpm, herbert, arnd, gregkh; +Cc: linux-crypto, linux-kernel, Corentin Labbe
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 5/7] hwrng: core: Move hwrng miscdev minor number to include/linux/miscdevice.h
2016-12-13 14:51 [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Corentin Labbe
` (2 preceding siblings ...)
2016-12-13 14:51 ` [PATCH v2 4/7] hwrng: core: Replace asm/uaccess.h by linux/uaccess.h Corentin Labbe
@ 2016-12-13 14:51 ` Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 6/7] hwrng: core: remove unused PFX macro Corentin Labbe
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2016-12-13 14:51 UTC (permalink / raw)
To: mpm, herbert, arnd, gregkh; +Cc: linux-crypto, linux-kernel, Corentin Labbe
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 6/7] hwrng: core: remove unused PFX macro
2016-12-13 14:51 [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Corentin Labbe
` (3 preceding siblings ...)
2016-12-13 14:51 ` [PATCH v2 5/7] hwrng: core: Move hwrng miscdev minor number to include/linux/miscdevice.h Corentin Labbe
@ 2016-12-13 14:51 ` Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 7/7] hwrng: core: Remove linux/sched.h from includes Corentin Labbe
2016-12-27 10:05 ` [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Herbert Xu
6 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2016-12-13 14:51 UTC (permalink / raw)
To: mpm, herbert, arnd, gregkh; +Cc: linux-crypto, linux-kernel, Corentin Labbe
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 7/7] hwrng: core: Remove linux/sched.h from includes
2016-12-13 14:51 [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Corentin Labbe
` (4 preceding siblings ...)
2016-12-13 14:51 ` [PATCH v2 6/7] hwrng: core: remove unused PFX macro Corentin Labbe
@ 2016-12-13 14:51 ` Corentin Labbe
2016-12-27 9:14 ` Herbert Xu
2016-12-27 10:05 ` [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Herbert Xu
6 siblings, 1 reply; 9+ messages in thread
From: Corentin Labbe @ 2016-12-13 14:51 UTC (permalink / raw)
To: mpm, herbert, arnd, gregkh; +Cc: linux-crypto, linux-kernel, Corentin Labbe
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 7/7] hwrng: core: Remove linux/sched.h from includes
2016-12-13 14:51 ` [PATCH v2 7/7] hwrng: core: Remove linux/sched.h from includes Corentin Labbe
@ 2016-12-27 9:14 ` Herbert Xu
0 siblings, 0 replies; 9+ messages in thread
From: Herbert Xu @ 2016-12-27 9:14 UTC (permalink / raw)
To: Corentin Labbe; +Cc: mpm, arnd, gregkh, linux-crypto, linux-kernel
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/7] hwrng: core: do not use multiple blank lines
2016-12-13 14:51 [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Corentin Labbe
` (5 preceding siblings ...)
2016-12-13 14:51 ` [PATCH v2 7/7] hwrng: core: Remove linux/sched.h from includes Corentin Labbe
@ 2016-12-27 10:05 ` Herbert Xu
6 siblings, 0 replies; 9+ messages in thread
From: Herbert Xu @ 2016-12-27 10:05 UTC (permalink / raw)
To: Corentin Labbe; +Cc: mpm, arnd, gregkh, linux-crypto, linux-kernel
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
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-12-27 10:06 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-13 14:51 [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 2/7] hwrng: core: rewrite better comparison to NULL Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 3/7] hwrng: core: Rewrite the header Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 4/7] hwrng: core: Replace asm/uaccess.h by linux/uaccess.h Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 5/7] hwrng: core: Move hwrng miscdev minor number to include/linux/miscdevice.h Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 6/7] hwrng: core: remove unused PFX macro Corentin Labbe
2016-12-13 14:51 ` [PATCH v2 7/7] hwrng: core: Remove linux/sched.h from includes Corentin Labbe
2016-12-27 9:14 ` Herbert Xu
2016-12-27 10:05 ` [PATCH v2 1/7] hwrng: core: do not use multiple blank lines Herbert Xu
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).