From 481ff6ff967fefdbfb967f7251e40c22a312d244 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Sun, 25 Jan 2015 12:30:41 -0800 Subject: power/reset: at91: Register with kernel restart handler Register with kernel restart handler instead of setting arm_pm_restart directly. Register with high priority since the driver unconditionally overwrites other restart handlers if instantiated. Signed-off-by: Guenter Roeck Signed-off-by: Sebastian Reichel --- drivers/power/reset/at91-reset.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'drivers/power') diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c index 69a75d99ae92..13584e24736a 100644 --- a/drivers/power/reset/at91-reset.c +++ b/drivers/power/reset/at91-reset.c @@ -17,8 +17,6 @@ #include #include -#include - #include #include @@ -54,7 +52,8 @@ static void __iomem *at91_ramc_base[2], *at91_rstc_base; * reset register it can be left driving the data bus and * killing the chance of a subsequent boot from NAND */ -static void at91sam9260_restart(enum reboot_mode mode, const char *cmd) +static int at91sam9260_restart(struct notifier_block *this, unsigned long mode, + void *cmd) { asm volatile( /* Align to cache lines */ @@ -76,9 +75,12 @@ static void at91sam9260_restart(enum reboot_mode mode, const char *cmd) "r" (1), "r" (AT91_SDRAMC_LPCB_POWER_DOWN), "r" (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST)); + + return NOTIFY_DONE; } -static void at91sam9g45_restart(enum reboot_mode mode, const char *cmd) +static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode, + void *cmd) { asm volatile( /* @@ -117,6 +119,8 @@ static void at91sam9g45_restart(enum reboot_mode mode, const char *cmd) "r" (AT91_DDRSDRC_LPCB_POWER_DOWN), "r" (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST) : "r0"); + + return NOTIFY_DONE; } static void __init at91_reset_status(struct platform_device *pdev) @@ -161,6 +165,10 @@ static struct of_device_id at91_reset_of_match[] = { { /* sentinel */ } }; +static struct notifier_block at91_restart_nb = { + .priority = 192, +}; + static int at91_reset_of_probe(struct platform_device *pdev) { const struct of_device_id *match; @@ -183,9 +191,8 @@ static int at91_reset_of_probe(struct platform_device *pdev) } match = of_match_node(at91_reset_of_match, pdev->dev.of_node); - arm_pm_restart = match->data; - - return 0; + at91_restart_nb.notifier_call = match->data; + return register_restart_handler(&at91_restart_nb); } static int at91_reset_platform_probe(struct platform_device *pdev) @@ -212,10 +219,11 @@ static int at91_reset_platform_probe(struct platform_device *pdev) } match = platform_get_device_id(pdev); - arm_pm_restart = (void (*)(enum reboot_mode, const char*)) - match->driver_data; + at91_restart_nb.notifier_call = + (int (*)(struct notifier_block *, + unsigned long, void *)) match->driver_data; - return 0; + return register_restart_handler(&at91_restart_nb); } static int at91_reset_probe(struct platform_device *pdev) -- cgit v1.2.3 17db2c003eba8ffd87'>treecommitdiffstats
blob: 5822d511d958acdec63842a33071ff9e134c0b93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the Apache License 2.0 (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */

/* This file contains deprecated functions as wrappers to the new ones */

/*
 * DH low level APIs are deprecated for public use, but still ok for
 * internal use.
 */
#include "internal/deprecated.h"

#include <openssl/opensslconf.h>

#include <stdio.h>
#include "internal/cryptlib.h"
#include <openssl/bn.h>
#include <openssl/dh.h>

DH *DH_generate_parameters(int prime_len, int generator,
                           void (*callback) (int, int, void *), void *cb_arg)
{
    BN_GENCB *cb;
    DH *ret = NULL;

    if ((ret = DH_new()) == NULL)
        return NULL;
    cb = BN_GENCB_new();
    if (cb == NULL) {
        DH_free(ret);
        return NULL;
    }

    BN_GENCB_set_old(cb, callback, cb_arg);

    if (DH_generate_parameters_ex(ret, prime_len, generator, cb)) {
        BN_GENCB_free(cb);
        return ret;
    }
    BN_GENCB_free(cb);
    DH_free(ret);
    return NULL;
}