From 09430fe59ead446115e8fb675876cf4d9117de71 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 19 Aug 2019 13:04:14 -0700 Subject: arch: fdt: replace byteorder with to_be_bytes() Use the standard library u32 and u64 byteorder conversion functions (now that they are stabilized) rather than the byteorder crate. BUG=None TEST=./build_test Change-Id: I7d2b523c2df5f7cdf1cd7d5b760ede8e827e0517 Signed-off-by: Daniel Verkamp Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1761150 Tested-by: kokoro Reviewed-by: Zach Reizner --- arch/Cargo.toml | 1 - arch/src/fdt.rs | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'arch') diff --git a/arch/Cargo.toml b/arch/Cargo.toml index f562fca..bf28560 100644 --- a/arch/Cargo.toml +++ b/arch/Cargo.toml @@ -5,7 +5,6 @@ authors = ["The Chromium OS Authors"] edition = "2018" [dependencies] -byteorder = "*" devices = { path = "../devices" } io_jail = { path = "../io_jail" } kernel_cmdline = { path = "../kernel_cmdline" } diff --git a/arch/src/fdt.rs b/arch/src/fdt.rs index 71c791d..a3861d5 100644 --- a/arch/src/fdt.rs +++ b/arch/src/fdt.rs @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use byteorder::{BigEndian, ByteOrder}; use libc::{c_char, c_int, c_void}; use std::ffi::{CStr, CString}; use std::fmt::{self, Display}; @@ -106,15 +105,11 @@ pub fn property(fdt: &mut Vec, name: &str, val: &[u8]) -> Result<()> { } fn cpu_to_fdt32(input: u32) -> [u8; 4] { - let mut buf = [0; 4]; - BigEndian::write_u32(&mut buf, input); - buf + input.to_be_bytes() } fn cpu_to_fdt64(input: u64) -> [u8; 8] { - let mut buf = [0; 8]; - BigEndian::write_u64(&mut buf, input); - buf + input.to_be_bytes() } pub fn property_u32(fdt: &mut Vec, name: &str, val: u32) -> Result<()> { -- cgit 1.4.1