diff options
author | Linus Walleij <linus.walleij@stericsson.com> | 2010-01-19 05:41:52 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-03-07 16:17:10 -0500 |
commit | 2071db4848ea809887e97248dd3dec02a2e3dd6b (patch) | |
tree | 6af9118a691d9d68da42004e29e834fa3d2508d5 /drivers/mfd/ab3100-core.c | |
parent | 6048a3dd2371c58611ea0ab8b306f8f1469399ae (diff) |
mfd: Use AB3100 MFD core IRQ for interrupt randomness
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>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/ab3100-core.c')
-rw-r--r-- | 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 aa3824a1b4f2..a2ce3b6af4a2 100644 --- a/drivers/mfd/ab3100-core.c +++ b/drivers/mfd/ab3100-core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2009 ST-Ericsson | 2 | * Copyright (C) 2007-2010 ST-Ericsson |
3 | * License terms: GNU General Public License (GPL) version 2 | 3 | * License terms: GNU General Public License (GPL) version 2 |
4 | * Low-level core for exclusive access to the AB3100 IC on the I2C bus | 4 | * Low-level core for exclusive access to the AB3100 IC on the I2C bus |
5 | * and some basic chip-configuration. | 5 | * and some basic chip-configuration. |
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/random.h> | ||
17 | #include <linux/debugfs.h> | 18 | #include <linux/debugfs.h> |
18 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
19 | #include <linux/uaccess.h> | 20 | #include <linux/uaccess.h> |
@@ -376,6 +377,8 @@ static irqreturn_t ab3100_irq_handler(int irq, void *data) | |||
376 | u32 fatevent; | 377 | u32 fatevent; |
377 | int err; | 378 | int err; |
378 | 379 | ||
380 | add_interrupt_randomness(irq); | ||
381 | |||
379 | err = ab3100_get_register_page_interruptible(ab3100, AB3100_EVENTA1, | 382 | err = ab3100_get_register_page_interruptible(ab3100, AB3100_EVENTA1, |
380 | event_regs, 3); | 383 | event_regs, 3); |
381 | if (err) | 384 | if (err) |
@@ -720,10 +723,7 @@ static struct platform_device ab3100_##devname##_device = { \ | |||
720 | .id = -1, \ | 723 | .id = -1, \ |
721 | } | 724 | } |
722 | 725 | ||
723 | /* | 726 | /* This lists all the subdevices */ |
724 | * This lists all the subdevices and corresponding register | ||
725 | * ranges. | ||
726 | */ | ||
727 | AB3100_DEVICE(dac, "ab3100-dac"); | 727 | AB3100_DEVICE(dac, "ab3100-dac"); |
728 | AB3100_DEVICE(leds, "ab3100-leds"); | 728 | AB3100_DEVICE(leds, "ab3100-leds"); |
729 | AB3100_DEVICE(power, "ab3100-power"); | 729 | AB3100_DEVICE(power, "ab3100-power"); |
@@ -889,10 +889,11 @@ static int __init ab3100_probe(struct i2c_client *client, | |||
889 | if (err) | 889 | if (err) |
890 | goto exit_no_setup; | 890 | goto exit_no_setup; |
891 | 891 | ||
892 | /* This real unpredictable IRQ is of course sampled for entropy */ | ||
893 | err = request_threaded_irq(client->irq, NULL, ab3100_irq_handler, | 892 | err = request_threaded_irq(client->irq, NULL, ab3100_irq_handler, |
894 | IRQF_ONESHOT, | 893 | IRQF_ONESHOT, "ab3100-core", ab3100); |
895 | "ab3100-core", ab3100); | 894 | /* This real unpredictable IRQ is of course sampled for entropy */ |
895 | rand_initialize_irq(client->irq); | ||
896 | |||
896 | if (err) | 897 | if (err) |
897 | goto exit_no_irq; | 898 | goto exit_no_irq; |
898 | 899 | ||