Merge tag 'for-linus-5.12-1' of git://github.com/cminyard/linux-ipmi

Pull IPMI update from Corey Minyard:
 "Only one change, but it's required for other things, so it needs to go
  in"

* tag 'for-linus-5.12-1' of git://github.com/cminyard/linux-ipmi:
  ipmi: remove open coded version of SMBus block write
This commit is contained in:
Linus Torvalds
2021-02-22 18:35:18 -08:00

View File

@@ -137,7 +137,7 @@ static ssize_t ipmb_write(struct file *file, const char __user *buf,
{ {
struct ipmb_dev *ipmb_dev = to_ipmb_dev(file); struct ipmb_dev *ipmb_dev = to_ipmb_dev(file);
u8 rq_sa, netf_rq_lun, msg_len; u8 rq_sa, netf_rq_lun, msg_len;
union i2c_smbus_data data; struct i2c_client *temp_client;
u8 msg[MAX_MSG_LEN]; u8 msg[MAX_MSG_LEN];
ssize_t ret; ssize_t ret;
@@ -160,21 +160,21 @@ static ssize_t ipmb_write(struct file *file, const char __user *buf,
} }
/* /*
* subtract rq_sa and netf_rq_lun from the length of the msg passed to * subtract rq_sa and netf_rq_lun from the length of the msg. Fill the
* i2c_smbus_xfer * temporary client. Note that its use is an exception for IPMI.
*/ */
msg_len = msg[IPMB_MSG_LEN_IDX] - SMBUS_MSG_HEADER_LENGTH; msg_len = msg[IPMB_MSG_LEN_IDX] - SMBUS_MSG_HEADER_LENGTH;
if (msg_len > I2C_SMBUS_BLOCK_MAX) temp_client = kmemdup(ipmb_dev->client, sizeof(*temp_client), GFP_KERNEL);
msg_len = I2C_SMBUS_BLOCK_MAX; if (!temp_client)
return -ENOMEM;
data.block[0] = msg_len; temp_client->addr = rq_sa;
memcpy(&data.block[1], msg + SMBUS_MSG_IDX_OFFSET, msg_len);
ret = i2c_smbus_xfer(ipmb_dev->client->adapter, rq_sa,
ipmb_dev->client->flags,
I2C_SMBUS_WRITE, netf_rq_lun,
I2C_SMBUS_BLOCK_DATA, &data);
return ret ? : count; ret = i2c_smbus_write_block_data(temp_client, netf_rq_lun, msg_len,
msg + SMBUS_MSG_IDX_OFFSET);
kfree(temp_client);
return ret < 0 ? ret : count;
} }
static __poll_t ipmb_poll(struct file *file, poll_table *wait) static __poll_t ipmb_poll(struct file *file, poll_table *wait)