mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 21:47:04 +07:00
ac3167257b
At over 4000 #includes, <linux/platform_device.h> is the 9th most #included header file in the Linux kernel. It does not need <linux/mod_devicetable.h>, so drop that header and explicitly add <linux/mod_devicetable.h> to source files that need it. 4146 #include <linux/platform_device.h> After this patch, there are 225 files that use <linux/mod_devicetable.h>, for a reduction of around 3900 times that <linux/mod_devicetable.h> does not have to be read & parsed. 225 #include <linux/mod_devicetable.h> This patch was build-tested on 20 different arch-es. It also makes these drivers SubmitChecklist#1 compliant. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: kbuild test robot <lkp@intel.com> # drivers/media/platform/vimc/ Reported-by: kbuild test robot <lkp@intel.com> # drivers/pinctrl/pinctrl-u300.c Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
83 lines
1.8 KiB
C
83 lines
1.8 KiB
C
/*
|
|
* Copyright 2013 Michael Ellerman, Guo Chao, IBM Corp.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version
|
|
* 2 of the License, or (at your option) any later version.
|
|
*/
|
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/mod_devicetable.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/random.h>
|
|
#include <linux/hw_random.h>
|
|
|
|
static int powernv_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
|
|
{
|
|
unsigned long *buf;
|
|
int i, len;
|
|
|
|
/* We rely on rng_buffer_size() being >= sizeof(unsigned long) */
|
|
len = max / sizeof(unsigned long);
|
|
|
|
buf = (unsigned long *)data;
|
|
|
|
for (i = 0; i < len; i++)
|
|
powernv_get_random_long(buf++);
|
|
|
|
return len * sizeof(unsigned long);
|
|
}
|
|
|
|
static struct hwrng powernv_hwrng = {
|
|
.name = "powernv-rng",
|
|
.read = powernv_rng_read,
|
|
};
|
|
|
|
static int powernv_rng_remove(struct platform_device *pdev)
|
|
{
|
|
hwrng_unregister(&powernv_hwrng);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int powernv_rng_probe(struct platform_device *pdev)
|
|
{
|
|
int rc;
|
|
|
|
rc = hwrng_register(&powernv_hwrng);
|
|
if (rc) {
|
|
/* We only register one device, ignore any others */
|
|
if (rc == -EEXIST)
|
|
rc = -ENODEV;
|
|
|
|
return rc;
|
|
}
|
|
|
|
pr_info("Registered powernv hwrng.\n");
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct of_device_id powernv_rng_match[] = {
|
|
{ .compatible = "ibm,power-rng",},
|
|
{},
|
|
};
|
|
MODULE_DEVICE_TABLE(of, powernv_rng_match);
|
|
|
|
static struct platform_driver powernv_rng_driver = {
|
|
.driver = {
|
|
.name = "powernv_rng",
|
|
.of_match_table = powernv_rng_match,
|
|
},
|
|
.probe = powernv_rng_probe,
|
|
.remove = powernv_rng_remove,
|
|
};
|
|
module_platform_driver(powernv_rng_driver);
|
|
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_DESCRIPTION("Bare metal HWRNG driver for POWER7+ and above");
|