Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1855256c authored by Jeff Garzik's avatar Jeff Garzik
Browse files

drivers/firmware: const-ify DMI API and internals



Three main sets of changes:

1) dmi_get_system_info() return value should have been marked const,
   since callers should not be changing that data.

2) const-ify DMI internals, since DMI firmware tables should,
   whenever possible, be marked const to ensure we never ever write to
   that data area.

3) const-ify DMI API, to enable marking tables const where possible
   in low-level drivers.

And if we're really lucky, this might enable some additional
optimizations on the part of the compiler.

The bulk of the changes are #2 and #3, which are interrelated.  #1 could
have been a separate patch, but it was so small compared to the others,
it was easier to roll it into this changeset.

Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent bbf25010
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -907,7 +907,7 @@ static void __init acpi_process_madt(void)

#ifdef __i386__

static int __init disable_acpi_irq(struct dmi_system_id *d)
static int __init disable_acpi_irq(const struct dmi_system_id *d)
{
	if (!acpi_force) {
		printk(KERN_NOTICE "%s detected: force use of acpi=noirq\n",
@@ -917,7 +917,7 @@ static int __init disable_acpi_irq(struct dmi_system_id *d)
	return 0;
}

static int __init disable_acpi_pci(struct dmi_system_id *d)
static int __init disable_acpi_pci(const struct dmi_system_id *d)
{
	if (!acpi_force) {
		printk(KERN_NOTICE "%s detected: force use of pci=noacpi\n",
@@ -927,7 +927,7 @@ static int __init disable_acpi_pci(struct dmi_system_id *d)
	return 0;
}

static int __init dmi_disable_acpi(struct dmi_system_id *d)
static int __init dmi_disable_acpi(const struct dmi_system_id *d)
{
	if (!acpi_force) {
		printk(KERN_NOTICE "%s detected: acpi off\n", d->ident);
@@ -942,7 +942,7 @@ static int __init dmi_disable_acpi(struct dmi_system_id *d)
/*
 * Limit ACPI to CPU enumeration for HT
 */
static int __init force_acpi_ht(struct dmi_system_id *d)
static int __init force_acpi_ht(const struct dmi_system_id *d)
{
	if (!acpi_force) {
		printk(KERN_NOTICE "%s detected: force use of acpi=ht\n",
+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ __setup("acpi_sleep=", acpi_sleep_setup);

/* Ouch, we want to delete this. We already have better version in userspace, in
   s2ram from suspend.sf.net project */
static __init int reset_videomode_after_s3(struct dmi_system_id *d)
static __init int reset_videomode_after_s3(const struct dmi_system_id *d)
{
	acpi_realmode_flags |= 2;
	return 0;
+9 −9
Original line number Diff line number Diff line
@@ -1869,7 +1869,7 @@ static struct miscdevice apm_device = {


/* Simple "print if true" callback */
static int __init print_if_true(struct dmi_system_id *d)
static int __init print_if_true(const struct dmi_system_id *d)
{
	printk("%s\n", d->ident);
	return 0;
@@ -1879,14 +1879,14 @@ static int __init print_if_true(struct dmi_system_id *d)
 * Some Bioses enable the PS/2 mouse (touchpad) at resume, even if it was
 * disabled before the suspend. Linux used to get terribly confused by that.
 */
static int __init broken_ps2_resume(struct dmi_system_id *d)
static int __init broken_ps2_resume(const struct dmi_system_id *d)
{
	printk(KERN_INFO "%s machine detected. Mousepad Resume Bug workaround hopefully not needed.\n", d->ident);
	return 0;
}

/* Some bioses have a broken protected mode poweroff and need to use realmode */
static int __init set_realmode_power_off(struct dmi_system_id *d)
static int __init set_realmode_power_off(const struct dmi_system_id *d)
{
	if (apm_info.realmode_power_off == 0) {
		apm_info.realmode_power_off = 1;
@@ -1896,7 +1896,7 @@ static int __init set_realmode_power_off(struct dmi_system_id *d)
}

/* Some laptops require interrupts to be enabled during APM calls */
static int __init set_apm_ints(struct dmi_system_id *d)
static int __init set_apm_ints(const struct dmi_system_id *d)
{
	if (apm_info.allow_ints == 0) {
		apm_info.allow_ints = 1;
@@ -1906,7 +1906,7 @@ static int __init set_apm_ints(struct dmi_system_id *d)
}

/* Some APM bioses corrupt memory or just plain do not work */
static int __init apm_is_horked(struct dmi_system_id *d)
static int __init apm_is_horked(const struct dmi_system_id *d)
{
	if (apm_info.disabled == 0) {
		apm_info.disabled = 1;
@@ -1915,7 +1915,7 @@ static int __init apm_is_horked(struct dmi_system_id *d)
	return 0;
}

static int __init apm_is_horked_d850md(struct dmi_system_id *d)
static int __init apm_is_horked_d850md(const struct dmi_system_id *d)
{
	if (apm_info.disabled == 0) {
		apm_info.disabled = 1;
@@ -1927,7 +1927,7 @@ static int __init apm_is_horked_d850md(struct dmi_system_id *d)
}

/* Some APM bioses hang on APM idle calls */
static int __init apm_likes_to_melt(struct dmi_system_id *d)
static int __init apm_likes_to_melt(const struct dmi_system_id *d)
{
	if (apm_info.forbid_idle == 0) {
		apm_info.forbid_idle = 1;
@@ -1951,7 +1951,7 @@ static int __init apm_likes_to_melt(struct dmi_system_id *d)
 *	Phoenix A04  08/24/2000 is known bad (Dell Inspiron 5000e)
 *	Phoenix A07  09/29/2000 is known good (Dell Inspiron 5000)
 */
static int __init broken_apm_power(struct dmi_system_id *d)
static int __init broken_apm_power(const struct dmi_system_id *d)
{
	apm_info.get_power_status_broken = 1;
	printk(KERN_WARNING "BIOS strings suggest APM bugs, disabling power status reporting.\n");
@@ -1962,7 +1962,7 @@ static int __init broken_apm_power(struct dmi_system_id *d)
 * This bios swaps the APM minute reporting bytes over (Many sony laptops
 * have this problem).
 */
static int __init swab_apm_power_in_minutes(struct dmi_system_id *d)
static int __init swab_apm_power_in_minutes(const struct dmi_system_id *d)
{
	apm_info.get_power_status_swabinminutes = 1;
	printk(KERN_WARNING "BIOS strings suggest APM reports battery life in minutes and wrong byte order.\n");
+2 −2
Original line number Diff line number Diff line
@@ -533,13 +533,13 @@ static int __init acpi_cpufreq_early_init(void)
 */
static int bios_with_sw_any_bug;

static int sw_any_bug_found(struct dmi_system_id *d)
static int sw_any_bug_found(const struct dmi_system_id *d)
{
	bios_with_sw_any_bug = 1;
	return 0;
}

static struct dmi_system_id sw_any_bug_dmi_table[] = {
static const struct dmi_system_id sw_any_bug_dmi_table[] = {
	{
		.callback = sw_any_bug_found,
		.ident = "Supermicro Server X6DLP",
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ __setup("reboot=", reboot_setup);
/*
 * Some machines require the "reboot=b"  commandline option, this quirk makes that automatic.
 */
static int __init set_bios_reboot(struct dmi_system_id *d)
static int __init set_bios_reboot(const struct dmi_system_id *d)
{
	if (!reboot_thru_bios) {
		reboot_thru_bios = 1;
Loading