linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use AB3100 MFD core IRQ for interrupt randomness
@ 2010-01-09  0:38 Linus Walleij
  2010-01-11 22:47 ` Matt Mackall
  0 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2010-01-09  0:38 UTC (permalink / raw)
  To: Samuel Ortiz, linux-kernel; +Cc: Linus Walleij, Robin Getz, Matt Mackall

This reintroduces the entropy sampling of the AB3100 IRQ as the
IRQF_SAMPLE_RANDOM is going out according to the feature removal
schedule. I'm trying to do this the right way then, so CC:ing some
random people for a quick review. We add entropy for interrupt
events in the AB3100 which are truly random in nature, like
external cables being connected, voltages on batteries dropping
below certain ranges, ADC triggers or overheating.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Cc: Robin Getz <rgetz@blackfin.uclinux.org>
Cc: Matt Mackall <mpm@selenic.com>
---
 drivers/mfd/ab3100-core.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
index aa3824a..a2ce3b6 100644
--- a/drivers/mfd/ab3100-core.c
+++ b/drivers/mfd/ab3100-core.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 ST-Ericsson
+ * Copyright (C) 2007-2010 ST-Ericsson
  * License terms: GNU General Public License (GPL) version 2
  * Low-level core for exclusive access to the AB3100 IC on the I2C bus
  * and some basic chip-configuration.
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/device.h>
 #include <linux/interrupt.h>
+#include <linux/random.h>
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 #include <linux/uaccess.h>
@@ -376,6 +377,8 @@ static irqreturn_t ab3100_irq_handler(int irq, void *data)
 	u32 fatevent;
 	int err;
 
+	add_interrupt_randomness(irq);
+
 	err = ab3100_get_register_page_interruptible(ab3100, AB3100_EVENTA1,
 				       event_regs, 3);
 	if (err)
@@ -720,10 +723,7 @@ static struct platform_device ab3100_##devname##_device = {	\
 	.id		= -1,					\
 }
 
-/*
- * This lists all the subdevices and corresponding register
- * ranges.
- */
+/* This lists all the subdevices */
 AB3100_DEVICE(dac, "ab3100-dac");
 AB3100_DEVICE(leds, "ab3100-leds");
 AB3100_DEVICE(power, "ab3100-power");
@@ -889,10 +889,11 @@ static int __init ab3100_probe(struct i2c_client *client,
 	if (err)
 		goto exit_no_setup;
 
-	/* This real unpredictable IRQ is of course sampled for entropy */
 	err = request_threaded_irq(client->irq, NULL, ab3100_irq_handler,
-			  IRQF_ONESHOT,
-			  "ab3100-core", ab3100);
+				IRQF_ONESHOT, "ab3100-core", ab3100);
+	/* This real unpredictable IRQ is of course sampled for entropy */
+	rand_initialize_irq(client->irq);
+
 	if (err)
 		goto exit_no_irq;
 
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use AB3100 MFD core IRQ for interrupt randomness
  2010-01-09  0:38 [PATCH] Use AB3100 MFD core IRQ for interrupt randomness Linus Walleij
@ 2010-01-11 22:47 ` Matt Mackall
  2010-01-17 19:18   ` Linus Walleij
  0 siblings, 1 reply; 7+ messages in thread
From: Matt Mackall @ 2010-01-11 22:47 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Samuel Ortiz, linux-kernel, Robin Getz

On Sat, 2010-01-09 at 01:38 +0100, Linus Walleij wrote:
> This reintroduces the entropy sampling of the AB3100 IRQ as the
> IRQF_SAMPLE_RANDOM is going out according to the feature removal
> schedule. I'm trying to do this the right way then, so CC:ing some
> random people for a quick review. We add entropy for interrupt
> events in the AB3100 which are truly random in nature, like
> external cables being connected, voltages on batteries dropping
> below certain ranges, ADC triggers or overheating.
> 
> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
> Cc: Robin Getz <rgetz@blackfin.uclinux.org>
> Cc: Matt Mackall <mpm@selenic.com>
> ---
>  drivers/mfd/ab3100-core.c |   17 +++++++++--------
>  1 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
> index aa3824a..a2ce3b6 100644
> --- a/drivers/mfd/ab3100-core.c
> +++ b/drivers/mfd/ab3100-core.c
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (C) 2007-2009 ST-Ericsson
> + * Copyright (C) 2007-2010 ST-Ericsson
>   * License terms: GNU General Public License (GPL) version 2
>   * Low-level core for exclusive access to the AB3100 IC on the I2C bus
>   * and some basic chip-configuration.
> @@ -14,6 +14,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/device.h>
>  #include <linux/interrupt.h>
> +#include <linux/random.h>
>  #include <linux/debugfs.h>
>  #include <linux/seq_file.h>
>  #include <linux/uaccess.h>
> @@ -376,6 +377,8 @@ static irqreturn_t ab3100_irq_handler(int irq, void *data)
>  	u32 fatevent;
>  	int err;
>  
> +	add_interrupt_randomness(irq);
> +
>  	err = ab3100_get_register_page_interruptible(ab3100, AB3100_EVENTA1,
>  				       event_regs, 3);
>  	if (err)
> @@ -720,10 +723,7 @@ static struct platform_device ab3100_##devname##_device = {	\
>  	.id		= -1,					\
>  }
>  
> -/*
> - * This lists all the subdevices and corresponding register
> - * ranges.
> - */
> +/* This lists all the subdevices */
>  AB3100_DEVICE(dac, "ab3100-dac");
>  AB3100_DEVICE(leds, "ab3100-leds");
>  AB3100_DEVICE(power, "ab3100-power");
> @@ -889,10 +889,11 @@ static int __init ab3100_probe(struct i2c_client *client,
>  	if (err)
>  		goto exit_no_setup;
>  
> -	/* This real unpredictable IRQ is of course sampled for entropy */
>  	err = request_threaded_irq(client->irq, NULL, ab3100_irq_handler,
> -			  IRQF_ONESHOT,
> -			  "ab3100-core", ab3100);
> +				IRQF_ONESHOT, "ab3100-core", ab3100);
> +	/* This real unpredictable IRQ is of course sampled for entropy */
> +	rand_initialize_irq(client->irq);
> +
>  	if (err)
>  		goto exit_no_irq;

Acked-by: Matt Mackall <mpm@selenic.com>

-- 
http://selenic.com : development and support for Mercurial and Linux



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use AB3100 MFD core IRQ for interrupt randomness
  2010-01-11 22:47 ` Matt Mackall
@ 2010-01-17 19:18   ` Linus Walleij
  2010-01-18 12:52     ` Samuel Ortiz
  2010-01-19 11:12     ` Samuel Ortiz
  0 siblings, 2 replies; 7+ messages in thread
From: Linus Walleij @ 2010-01-17 19:18 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: Linus Walleij, linux-kernel, Robin Getz, Matt Mackall

2010/1/11 Matt Mackall <mpm@selenic.com>:

> Acked-by: Matt Mackall <mpm@selenic.com>

Sam will you take this patch then?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use AB3100 MFD core IRQ for interrupt randomness
  2010-01-17 19:18   ` Linus Walleij
@ 2010-01-18 12:52     ` Samuel Ortiz
  2010-01-19 11:12     ` Samuel Ortiz
  1 sibling, 0 replies; 7+ messages in thread
From: Samuel Ortiz @ 2010-01-18 12:52 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Linus Walleij, linux-kernel, Robin Getz, Matt Mackall

Hi Linus,

On Sun, Jan 17, 2010 at 08:18:58PM +0100, Linus Walleij wrote:
> 2010/1/11 Matt Mackall <mpm@selenic.com>:
> 
> > Acked-by: Matt Mackall <mpm@selenic.com>
> 
> Sam will you take this patch then?
Applied, thanks a lot.

Cheers,
Samuel.


> Yours,
> Linus Walleij

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use AB3100 MFD core IRQ for interrupt randomness
  2010-01-17 19:18   ` Linus Walleij
  2010-01-18 12:52     ` Samuel Ortiz
@ 2010-01-19 11:12     ` Samuel Ortiz
  2010-01-19 12:42       ` Linus Walleij
  2010-01-19 19:02       ` Matt Mackall
  1 sibling, 2 replies; 7+ messages in thread
From: Samuel Ortiz @ 2010-01-19 11:12 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Linus Walleij, linux-kernel, Robin Getz, Matt Mackall

Hi Linus,

On Sun, Jan 17, 2010 at 08:18:58PM +0100, Linus Walleij wrote:
> 2010/1/11 Matt Mackall <mpm@selenic.com>:
> 
> > Acked-by: Matt Mackall <mpm@selenic.com>
> 
> Sam will you take this patch then?
I had to change the ab3100 Kconfig entry as those random.c symbols are not
exported. The ab3100 driver is now a bool, depending on I2C=y.

Matt, would it make sense to export those symbols ?

Cheers,
Samuel.


> Yours,
> Linus Walleij

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use AB3100 MFD core IRQ for interrupt randomness
  2010-01-19 11:12     ` Samuel Ortiz
@ 2010-01-19 12:42       ` Linus Walleij
  2010-01-19 19:02       ` Matt Mackall
  1 sibling, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2010-01-19 12:42 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: Linus Walleij, linux-kernel, Robin Getz, Matt Mackall

2010/1/19 Samuel Ortiz <sameo@linux.intel.com>:

> I had to change the ab3100 Kconfig entry as those random.c symbols are not
> exported. The ab3100 driver is now a bool, depending on I2C=y.

Fine with me. We mainly need it to be a module when developing initial
support anyway. If you activate stuff like regulators it will be required to
compile in.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>

Linus Walleij

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use AB3100 MFD core IRQ for interrupt randomness
  2010-01-19 11:12     ` Samuel Ortiz
  2010-01-19 12:42       ` Linus Walleij
@ 2010-01-19 19:02       ` Matt Mackall
  1 sibling, 0 replies; 7+ messages in thread
From: Matt Mackall @ 2010-01-19 19:02 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: Linus Walleij, Linus Walleij, linux-kernel, Robin Getz

On Tue, 2010-01-19 at 12:12 +0100, Samuel Ortiz wrote:
> Hi Linus,
> 
> On Sun, Jan 17, 2010 at 08:18:58PM +0100, Linus Walleij wrote:
> > 2010/1/11 Matt Mackall <mpm@selenic.com>:
> > 
> > > Acked-by: Matt Mackall <mpm@selenic.com>
> > 
> > Sam will you take this patch then?
> I had to change the ab3100 Kconfig entry as those random.c symbols are not
> exported. The ab3100 driver is now a bool, depending on I2C=y.
> 
> Matt, would it make sense to export those symbols ?

Let's not for now, I plan to change this API.

-- 
http://selenic.com : development and support for Mercurial and Linux



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-01-19 19:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-09  0:38 [PATCH] Use AB3100 MFD core IRQ for interrupt randomness Linus Walleij
2010-01-11 22:47 ` Matt Mackall
2010-01-17 19:18   ` Linus Walleij
2010-01-18 12:52     ` Samuel Ortiz
2010-01-19 11:12     ` Samuel Ortiz
2010-01-19 12:42       ` Linus Walleij
2010-01-19 19:02       ` Matt Mackall

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).