mobx: Remove unnessecary mut

pull/4/head
Andre Richter 6 years ago
parent cb216785b3
commit a584fa4dfa

@ -88,7 +88,7 @@ impl Mbox {
}
/// Make a mailbox call. Returns Err(MboxError) on failure, Ok(()) success
pub fn call(&mut self, channel: u32) -> Result<()> {
pub fn call(&self, channel: u32) -> Result<()> {
// wait until we can write to the mailbox
loop {
unsafe {
@ -103,7 +103,7 @@ impl Mbox {
unsafe {
(*self.registers)
.WRITE
.write(((self.buffer.as_mut_ptr() as u32) & !0xF) | (channel & 0xF));
.write(((self.buffer.as_ptr() as u32) & !0xF) | (channel & 0xF));
}
// now wait for the response
@ -121,7 +121,7 @@ impl Mbox {
let resp: u32 = unsafe { (*self.registers).READ.read() };
// is it a response to our message?
if ((resp & 0xF) == channel) && ((resp & !0xF) == (self.buffer.as_mut_ptr() as u32)) {
if ((resp & 0xF) == channel) && ((resp & !0xF) == (self.buffer.as_ptr() as u32)) {
// is it a valid successful response?
return match self.buffer[1] {
response::SUCCESS => Ok(()),

@ -94,7 +94,7 @@ impl Mbox {
}
/// Make a mailbox call. Returns Err(MboxError) on failure, Ok(()) success
pub fn call(&mut self, channel: u32) -> Result<()> {
pub fn call(&self, channel: u32) -> Result<()> {
// wait until we can write to the mailbox
loop {
unsafe {
@ -109,7 +109,7 @@ impl Mbox {
unsafe {
(*self.registers)
.WRITE
.write(((self.buffer.as_mut_ptr() as u32) & !0xF) | (channel & 0xF));
.write(((self.buffer.as_ptr() as u32) & !0xF) | (channel & 0xF));
}
// now wait for the response
@ -127,7 +127,7 @@ impl Mbox {
let resp: u32 = unsafe { (*self.registers).READ.read() };
// is it a response to our message?
if ((resp & 0xF) == channel) && ((resp & !0xF) == (self.buffer.as_mut_ptr() as u32)) {
if ((resp & 0xF) == channel) && ((resp & !0xF) == (self.buffer.as_ptr() as u32)) {
// is it a valid successful response?
return match self.buffer[1] {
response::SUCCESS => Ok(()),

@ -93,7 +93,7 @@ impl Mbox {
}
/// Make a mailbox call. Returns Err(MboxError) on failure, Ok(()) success
pub fn call(&mut self, channel: u32) -> Result<()> {
pub fn call(&self, channel: u32) -> Result<()> {
// wait until we can write to the mailbox
loop {
unsafe {
@ -108,7 +108,7 @@ impl Mbox {
unsafe {
(*self.registers)
.WRITE
.write(((self.buffer.as_mut_ptr() as u32) & !0xF) | (channel & 0xF));
.write(((self.buffer.as_ptr() as u32) & !0xF) | (channel & 0xF));
}
// now wait for the response
@ -126,7 +126,7 @@ impl Mbox {
let resp: u32 = unsafe { (*self.registers).READ.read() };
// is it a response to our message?
if ((resp & 0xF) == channel) && ((resp & !0xF) == (self.buffer.as_mut_ptr() as u32)) {
if ((resp & 0xF) == channel) && ((resp & !0xF) == (self.buffer.as_ptr() as u32)) {
// is it a valid successful response?
return match self.buffer[1] {
response::SUCCESS => Ok(()),

@ -95,7 +95,7 @@ impl Mbox {
}
/// Make a mailbox call. Returns Err(MboxError) on failure, Ok(()) success
pub fn call(&mut self, channel: u32) -> Result<()> {
pub fn call(&self, channel: u32) -> Result<()> {
// wait until we can write to the mailbox
loop {
if (unsafe { (*self.registers).STATUS.read() } & FULL) != FULL {
@ -109,7 +109,7 @@ impl Mbox {
unsafe {
(*self.registers)
.WRITE
.write(((self.buffer.as_mut_ptr() as u32) & !0xF) | (channel & 0xF));
.write(((self.buffer.as_ptr() as u32) & !0xF) | (channel & 0xF));
}
// now wait for the response
@ -126,7 +126,7 @@ impl Mbox {
let resp: u32 = unsafe { (*self.registers).READ.read() };
// is it a response to our message?
if ((resp & 0xF) == channel) && ((resp & !0xF) == (self.buffer.as_mut_ptr() as u32)) {
if ((resp & 0xF) == channel) && ((resp & !0xF) == (self.buffer.as_ptr() as u32)) {
// is it a valid successful response?
return match self.buffer[1] {
response::SUCCESS => Ok(()),

@ -94,7 +94,7 @@ impl Mbox {
}
/// Make a mailbox call. Returns Err(MboxError) on failure, Ok(()) success
pub fn call(&mut self, channel: u32) -> Result<()> {
pub fn call(&self, channel: u32) -> Result<()> {
// wait until we can write to the mailbox
loop {
if (unsafe { (*self.registers).STATUS.read() } & FULL) != FULL {
@ -108,7 +108,7 @@ impl Mbox {
unsafe {
(*self.registers)
.WRITE
.write(((self.buffer.as_mut_ptr() as u32) & !0xF) | (channel & 0xF));
.write(((self.buffer.as_ptr() as u32) & !0xF) | (channel & 0xF));
}
// now wait for the response
@ -125,7 +125,7 @@ impl Mbox {
let resp: u32 = unsafe { (*self.registers).READ.read() };
// is it a response to our message?
if ((resp & 0xF) == channel) && ((resp & !0xF) == (self.buffer.as_mut_ptr() as u32)) {
if ((resp & 0xF) == channel) && ((resp & !0xF) == (self.buffer.as_ptr() as u32)) {
// is it a valid successful response?
return match self.buffer[1] {
response::SUCCESS => Ok(()),

Loading…
Cancel
Save