Skip to content

Commit 4064a52

Browse files
committed
WIP
1 parent 16aadd1 commit 4064a52

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

type-c-service/src/service/mod.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,12 @@ impl<'a> Service<'a> {
163163
}
164164

165165
/// Process external commands
166-
async fn process_external_command(
167-
&self,
168-
controllers: &intrusive_list::IntrusiveList,
169-
command: &external::Command,
170-
) -> external::Response<'static> {
166+
async fn process_external_command(&self, command: &external::Command) -> external::Response<'static> {
171167
match command {
172168
external::Command::Controller(command) => self.process_external_controller_command(command).await,
173-
external::Command::Port(command) => self.process_external_port_command(command, controllers).await,
169+
external::Command::Port(command) => self.process_external_port_command(command, self.controllers).await,
174170
external::Command::Ucsi(command) => {
175-
external::Response::Ucsi(self.process_ucsi_command(controllers, command).await)
171+
external::Response::Ucsi(self.process_ucsi_command(self.controllers, command).await)
176172
}
177173
}
178174
}
@@ -238,7 +234,7 @@ impl<'a> Service<'a> {
238234
}
239235
Event::ExternalCommand(request) => {
240236
trace!("Processing external command");
241-
let response = self.process_external_command(self.controllers, &request.command).await;
237+
let response = self.process_external_command(&request.command).await;
242238
request.respond(response);
243239
Ok(())
244240
}

type-c-service/src/wrapper/backing.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ impl<'a> Registration<'a> {
175175
const MAX_BUFFERED_PD_ALERTS: usize = 4;
176176

177177
/// Base storage
178-
pub struct Storage<const N: usize, M: RawMutex> {
178+
pub struct Storage<'a, const N: usize, M: RawMutex> {
179179
// Registration-related
180-
context: &'static embedded_services::type_c::controller::Context,
180+
context: &'a embedded_services::type_c::controller::Context,
181181
controller_id: ControllerId,
182182
pd_ports: [GlobalPortId; N],
183183
cfu_device: embedded_services::cfu::component::CfuDevice,
@@ -187,9 +187,9 @@ pub struct Storage<const N: usize, M: RawMutex> {
187187
pd_alerts: [PubSubChannel<M, Ado, MAX_BUFFERED_PD_ALERTS, 1, 0>; N],
188188
}
189189

190-
impl<const N: usize, M: RawMutex> Storage<N, M> {
190+
impl<'a, const N: usize, M: RawMutex> Storage<'a, N, M> {
191191
pub fn new(
192-
context: &'static embedded_services::type_c::controller::Context,
192+
context: &'a embedded_services::type_c::controller::Context,
193193
controller_id: ControllerId,
194194
cfu_id: ComponentId,
195195
ports: [(GlobalPortId, power::policy::DeviceId); N],
@@ -215,7 +215,7 @@ impl<const N: usize, M: RawMutex> Storage<N, M> {
215215
/// To simplify usage, we use interior mutability through a ref cell to avoid having to declare the state
216216
/// completely separately.
217217
pub struct ReferencedStorage<'a, const N: usize, M: RawMutex> {
218-
storage: &'a Storage<N, M>,
218+
storage: &'a Storage<'a, N, M>,
219219
state: RefCell<InternalState<'a, N>>,
220220
pd_controller: embedded_services::type_c::controller::Device<'a>,
221221
}

0 commit comments

Comments
 (0)