driver: espi: npcx: prevent changing data content in host write func.
This CL prevents changing data content in the write function of host interface by declaring it as constant pointer. Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
This commit is contained in:
parent
b6ad85cdd9
commit
0012ba5a38
2 changed files with 4 additions and 6 deletions
|
@ -780,7 +780,7 @@ int npcx_host_periph_read_request(enum lpc_peripheral_opcode op,
|
||||||
}
|
}
|
||||||
|
|
||||||
int npcx_host_periph_write_request(enum lpc_peripheral_opcode op,
|
int npcx_host_periph_write_request(enum lpc_peripheral_opcode op,
|
||||||
uint32_t *data)
|
const uint32_t *data)
|
||||||
{
|
{
|
||||||
volatile uint32_t __attribute__((unused)) dummy;
|
volatile uint32_t __attribute__((unused)) dummy;
|
||||||
struct kbc_reg *const inst_kbc = host_sub_cfg.inst_kbc;
|
struct kbc_reg *const inst_kbc = host_sub_cfg.inst_kbc;
|
||||||
|
@ -827,13 +827,11 @@ int npcx_host_periph_write_request(enum lpc_peripheral_opcode op,
|
||||||
break;
|
break;
|
||||||
case E8042_SET_FLAG:
|
case E8042_SET_FLAG:
|
||||||
/* FW shouldn't modify these flags directly */
|
/* FW shouldn't modify these flags directly */
|
||||||
*data &= ~NPCX_KBC_STS_MASK;
|
inst_kbc->HIKMST |= *data & ~NPCX_KBC_STS_MASK;
|
||||||
inst_kbc->HIKMST |= *data;
|
|
||||||
break;
|
break;
|
||||||
case E8042_CLEAR_FLAG:
|
case E8042_CLEAR_FLAG:
|
||||||
/* FW shouldn't modify these flags directly */
|
/* FW shouldn't modify these flags directly */
|
||||||
*data &= ~NPCX_KBC_STS_MASK;
|
inst_kbc->HIKMST &= ~(*data | NPCX_KBC_STS_MASK);
|
||||||
inst_kbc->HIKMST &= ~(*data);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -66,7 +66,7 @@ int npcx_host_periph_read_request(enum lpc_peripheral_opcode op,
|
||||||
* @retval -EINVAL for unimplemented lpc opcode, but in range.
|
* @retval -EINVAL for unimplemented lpc opcode, but in range.
|
||||||
*/
|
*/
|
||||||
int npcx_host_periph_write_request(enum lpc_peripheral_opcode op,
|
int npcx_host_periph_write_request(enum lpc_peripheral_opcode op,
|
||||||
uint32_t *data);
|
const uint32_t *data);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue