From b7b74e62a0c0f59df9d56632e33987caa84eeed2 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 27 Oct 2023 16:33:25 +0200 Subject: [PATCH] platform driver: don't copy list-model elements Issue #4317 --- repos/os/src/drivers/platform/pci.cc | 4 ++-- repos/os/src/drivers/platform/pci_ehci.h | 10 +++++----- repos/os/src/drivers/platform/pci_hd_audio.h | 6 ++---- .../src/drivers/platform/pci_intel_graphics.h | 18 +++++++++--------- repos/os/src/drivers/platform/pci_uhci.h | 10 +++++----- repos/os/src/drivers/platform/pci_virtio.h | 14 ++++++-------- 6 files changed, 29 insertions(+), 33 deletions(-) diff --git a/repos/os/src/drivers/platform/pci.cc b/repos/os/src/drivers/platform/pci.cc index ee8f34f6af..deabdb8d2e 100644 --- a/repos/os/src/drivers/platform/pci.cc +++ b/repos/os/src/drivers/platform/pci.cc @@ -300,7 +300,7 @@ bool Driver::pci_device_matches(Session_policy const & policy, vendor_t vendor_id = node.attribute_value("vendor_id", 0); device_t device_id = node.attribute_value("device_id", 0); - dev.for_pci_config([&] (Device::Pci_config const cfg) + dev.for_pci_config([&] (Device::Pci_config const & cfg) { if ((pci_class_code_alias(cfg.class_code) == class_code) || (vendor_id == cfg.vendor_id && device_id == cfg.device_id)) @@ -317,7 +317,7 @@ void Driver::pci_device_specific_info(Device const & dev, Device_model & model, Xml_generator & xml) { - dev.for_pci_config([&] (Device::Pci_config const cfg) + dev.for_pci_config([&] (Device::Pci_config const & cfg) { Driver::pci_intel_graphics_info(cfg, env, model, xml); Driver::pci_virtio_info(dev, cfg, env, xml); diff --git a/repos/os/src/drivers/platform/pci_ehci.h b/repos/os/src/drivers/platform/pci_ehci.h index 49b14314cb..59b1294a9b 100644 --- a/repos/os/src/drivers/platform/pci_ehci.h +++ b/repos/os/src/drivers/platform/pci_ehci.h @@ -16,14 +16,14 @@ namespace Driver { static void pci_ehci_quirks(Env &, Device const &, - Device::Pci_config, addr_t); + Device::Pci_config const &, addr_t); } -void Driver::pci_ehci_quirks(Env & env, - Device const & dev, - Device::Pci_config cfg, - addr_t base) +void Driver::pci_ehci_quirks(Env & env, + Device const & dev, + Device::Pci_config const & cfg, + addr_t base) { enum { EHCI_CLASS_CODE = 0xc0320 }; diff --git a/repos/os/src/drivers/platform/pci_hd_audio.h b/repos/os/src/drivers/platform/pci_hd_audio.h index 616cb5f14a..baa72a91ef 100644 --- a/repos/os/src/drivers/platform/pci_hd_audio.h +++ b/repos/os/src/drivers/platform/pci_hd_audio.h @@ -15,13 +15,11 @@ #include namespace Driver { - static void pci_hd_audio_quirks(Device::Pci_config cfg, - Pci::Config & config); + static void pci_hd_audio_quirks(Device::Pci_config const &, Pci::Config &); } -void Driver::pci_hd_audio_quirks(Device::Pci_config cfg, - Pci::Config & config) +void Driver::pci_hd_audio_quirks(Device::Pci_config const & cfg, Pci::Config & config) { enum { HDAUDIO_CLASS_CODE = 0x40300 }; diff --git a/repos/os/src/drivers/platform/pci_intel_graphics.h b/repos/os/src/drivers/platform/pci_intel_graphics.h index fffabac758..6b6ff66b06 100644 --- a/repos/os/src/drivers/platform/pci_intel_graphics.h +++ b/repos/os/src/drivers/platform/pci_intel_graphics.h @@ -16,10 +16,10 @@ #include namespace Driver { - void pci_intel_graphics_info(Device::Pci_config cfg, - Env & env, - Device_model & model, - Xml_generator & xml); + void pci_intel_graphics_info(Device::Pci_config const & cfg, + Env & env, + Device_model & model, + Xml_generator & xml); } @@ -75,10 +75,10 @@ static inline unsigned pci_intel_graphics_generation(Pci::device_t id) }; -void Driver::pci_intel_graphics_info(Device::Pci_config cfg, - Env & env, - Device_model & model, - Xml_generator & xml) +void Driver::pci_intel_graphics_info(Device::Pci_config const & cfg, + Env & env, + Device_model & model, + Xml_generator & xml) { enum { GPU_CLASS_MASK = 0xff0000, @@ -101,7 +101,7 @@ void Driver::pci_intel_graphics_info(Device::Pci_config cfg, /* find host bridge */ model.for_each([&] (Device const & dev) { - dev.for_pci_config([&] (Device::Pci_config const cfg) { + dev.for_pci_config([&] (Device::Pci_config const &cfg) { if (cfg.bus_num || cfg.dev_num || cfg.func_num) return; diff --git a/repos/os/src/drivers/platform/pci_uhci.h b/repos/os/src/drivers/platform/pci_uhci.h index 1a4ae82247..9be2abdbd5 100644 --- a/repos/os/src/drivers/platform/pci_uhci.h +++ b/repos/os/src/drivers/platform/pci_uhci.h @@ -17,14 +17,14 @@ namespace Driver { static void pci_uhci_quirks(Env &, Device const &, - Device::Pci_config, addr_t); + Device::Pci_config const &, addr_t); } -void Driver::pci_uhci_quirks(Env & env, - Device const & dev, - Device::Pci_config cfg, - addr_t base) +void Driver::pci_uhci_quirks(Env & env, + Device const & dev, + Device::Pci_config const & cfg, + addr_t base) { enum { UHCI_CLASS_CODE = 0xc0300 }; diff --git a/repos/os/src/drivers/platform/pci_virtio.h b/repos/os/src/drivers/platform/pci_virtio.h index 19d7ccff8b..19c34c2d54 100644 --- a/repos/os/src/drivers/platform/pci_virtio.h +++ b/repos/os/src/drivers/platform/pci_virtio.h @@ -16,17 +16,15 @@ #include namespace Driver { - void pci_virtio_info(Device const & dev, - Device::Pci_config cfg, - Env & env, - Xml_generator & xml); + void pci_virtio_info(Device const &, Device::Pci_config const &, Env &, + Xml_generator &); } -void Driver::pci_virtio_info(Device const & dev, - Device::Pci_config cfg, - Env & env, - Xml_generator & xml) +void Driver::pci_virtio_info(Device const & dev, + Device::Pci_config const & cfg, + Env & env, + Xml_generator & xml) { enum { VENDOR_RED_HAT = 0x1af4 };