70 lines
1.7 KiB
Diff
70 lines
1.7 KiB
Diff
From 478099cf46e577c91c9a932d07e4fd6eb83f14d2 Mon Sep 17 00:00:00 2001
|
|
From: Richard Hughes <richard@hughsie.com>
|
|
Date: Wed, 6 Oct 2021 16:50:24 +0100
|
|
Subject: [PATCH] Fix build error when sys/io.h is ot available
|
|
|
|
---
|
|
meson.build | 3 +++
|
|
plugins/flashrom/fu-flashrom-cmos.c | 10 +++++++++-
|
|
2 files changed, 12 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/meson.build b/meson.build
|
|
index 547eb64a..7557cd4a 100644
|
|
--- a/meson.build
|
|
+++ b/meson.build
|
|
@@ -314,6 +314,9 @@ endif
|
|
if cc.has_header('sys/socket.h')
|
|
conf.set('HAVE_SOCKET_H', '1')
|
|
endif
|
|
+if cc.has_header('sys/io.h')
|
|
+ conf.set('HAVE_IO_H', '1')
|
|
+endif
|
|
if cc.has_header('linux/ethtool.h')
|
|
conf.set('HAVE_ETHTOOL_H', '1')
|
|
endif
|
|
diff --git a/plugins/flashrom/fu-flashrom-cmos.c b/plugins/flashrom/fu-flashrom-cmos.c
|
|
index 490f0240..77f2cc65 100644
|
|
--- a/plugins/flashrom/fu-flashrom-cmos.c
|
|
+++ b/plugins/flashrom/fu-flashrom-cmos.c
|
|
@@ -5,10 +5,13 @@
|
|
*/
|
|
#include "config.h"
|
|
|
|
+#ifdef HAVE_IO_H
|
|
#include <sys/io.h>
|
|
+#endif
|
|
|
|
#include "fu-flashrom-cmos.h"
|
|
|
|
+#ifdef HAVE_IO_H
|
|
static gboolean
|
|
fu_flashrom_cmos_write(guint8 addr, guint8 val)
|
|
{
|
|
@@ -29,10 +32,12 @@ fu_flashrom_cmos_write(guint8 addr, guint8 val)
|
|
/* Check the read value against the written */
|
|
return (tmp == val);
|
|
}
|
|
+#endif
|
|
|
|
gboolean
|
|
fu_flashrom_cmos_reset(GError **error)
|
|
{
|
|
+#ifdef HAVE_IO_H
|
|
/* Call ioperm() to grant us access to ports 0x70 and 0x71 */
|
|
if (ioperm(RTC_BASE_PORT, 2, TRUE) < 0) {
|
|
g_set_error_literal(error,
|
|
@@ -50,6 +55,9 @@ fu_flashrom_cmos_reset(GError **error)
|
|
}
|
|
|
|
/* success */
|
|
-
|
|
return TRUE;
|
|
+#else
|
|
+ g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "no <sys/io.h> support");
|
|
+ return FALSE;
|
|
+#endif
|
|
}
|
|
--
|
|
2.32.0
|
|
|