Thread (42 messages) 42 messages, 7 authors, 2023-10-17

Re: [PATCH net-next v4 1/4] rust: core abstractions for network PHY drivers

From: FUJITA Tomonori <fujita.tomonori@gmail.com>
Date: 2023-10-17 11:32:41
Also in: rust-for-linux

On Tue, 17 Oct 2023 07:41:38 +0000
Benno Lossin [off-list ref] wrote:
quoted
quoted
quoted
read() is reading from hardware register. write() is writing a value
to hardware register. Both updates the object that phy_device points
to?
Indeed, I was just going with the standard way of suggesting `&self`
for reads, there are of course exceptions where `&mut self` would make
sense. That being said in this case both options are sound, since
the C side locks a mutex.
I see. I use &mut self for both read() and write().
I would recommend documenting this somewhere (why `read` is `&mut`), since
that is a bit unusual (why restrict something more than necessary?).
I added such at the top of the file.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help