mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
Merge bde2043174 ("usb: gadget: f_tcm: Don't prepare BOT write request twice") into android14-6.1-lts
Steps on the way to 6.1.129 Change-Id: Ia424f0eb75a7bd8824d1c3a4cf5453e190ebe82a Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -728,23 +728,30 @@ err_stop_hw:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sensor_hub_finalize_pending_fn(struct device *dev, void *data)
|
||||
{
|
||||
struct hid_sensor_hub_device *hsdev = dev->platform_data;
|
||||
|
||||
if (hsdev->pending.status)
|
||||
complete(&hsdev->pending.ready);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sensor_hub_remove(struct hid_device *hdev)
|
||||
{
|
||||
struct sensor_hub_data *data = hid_get_drvdata(hdev);
|
||||
unsigned long flags;
|
||||
int i;
|
||||
|
||||
hid_dbg(hdev, " hardware removed\n");
|
||||
hid_hw_close(hdev);
|
||||
hid_hw_stop(hdev);
|
||||
|
||||
spin_lock_irqsave(&data->lock, flags);
|
||||
for (i = 0; i < data->hid_sensor_client_cnt; ++i) {
|
||||
struct hid_sensor_hub_device *hsdev =
|
||||
data->hid_sensor_hub_client_devs[i].platform_data;
|
||||
if (hsdev->pending.status)
|
||||
complete(&hsdev->pending.ready);
|
||||
}
|
||||
device_for_each_child(&hdev->dev, NULL,
|
||||
sensor_hub_finalize_pending_fn);
|
||||
spin_unlock_irqrestore(&data->lock, flags);
|
||||
|
||||
mfd_remove_devices(&hdev->dev);
|
||||
mutex_destroy(&data->mutex);
|
||||
}
|
||||
|
||||
@@ -539,6 +539,11 @@ void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
|
||||
struct ethhdr *eh;
|
||||
u16 type;
|
||||
|
||||
if (!ifp) {
|
||||
brcmu_pkt_buf_free_skb(txp);
|
||||
return;
|
||||
}
|
||||
|
||||
eh = (struct ethhdr *)(txp->data);
|
||||
type = ntohs(eh->h_proto);
|
||||
|
||||
|
||||
@@ -197,9 +197,9 @@ enum rtl8821a_h2c_cmd {
|
||||
|
||||
/* _MEDIA_STATUS_RPT_PARM_CMD1 */
|
||||
#define SET_H2CCMD_MSRRPT_PARM_OPMODE(__cmd, __value) \
|
||||
u8p_replace_bits(__cmd + 1, __value, BIT(0))
|
||||
u8p_replace_bits(__cmd, __value, BIT(0))
|
||||
#define SET_H2CCMD_MSRRPT_PARM_MACID_IND(__cmd, __value) \
|
||||
u8p_replace_bits(__cmd + 1, __value, BIT(1))
|
||||
u8p_replace_bits(__cmd, __value, BIT(1))
|
||||
|
||||
/* AP_OFFLOAD */
|
||||
#define SET_H2CCMD_AP_OFFLOAD_ON(__cmd, __value) \
|
||||
|
||||
@@ -974,10 +974,10 @@ struct device_node *of_find_node_opts_by_path(const char *path, const char **opt
|
||||
/* The path could begin with an alias */
|
||||
if (*path != '/') {
|
||||
int len;
|
||||
const char *p = separator;
|
||||
const char *p = strchrnul(path, '/');
|
||||
|
||||
if (!p)
|
||||
p = strchrnul(path, '/');
|
||||
if (separator && separator < p)
|
||||
p = separator;
|
||||
len = p - path;
|
||||
|
||||
/* of_aliases must not be NULL */
|
||||
|
||||
@@ -105,12 +105,12 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
|
||||
|
||||
prop = of_get_flat_dt_prop(node, "alignment", &len);
|
||||
if (prop) {
|
||||
if (len != dt_root_addr_cells * sizeof(__be32)) {
|
||||
if (len != dt_root_size_cells * sizeof(__be32)) {
|
||||
pr_err("invalid alignment property in '%s' node.\n",
|
||||
uname);
|
||||
return -EINVAL;
|
||||
}
|
||||
align = dt_mem_next_cell(dt_root_addr_cells, &prop);
|
||||
align = dt_mem_next_cell(dt_root_size_cells, &prop);
|
||||
}
|
||||
|
||||
nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
|
||||
|
||||
@@ -245,7 +245,6 @@ static int bot_send_write_request(struct usbg_cmd *cmd)
|
||||
{
|
||||
struct f_uas *fu = cmd->fu;
|
||||
struct se_cmd *se_cmd = &cmd->se_cmd;
|
||||
struct usb_gadget *gadget = fuas_to_gadget(fu);
|
||||
int ret;
|
||||
|
||||
init_completion(&cmd->write_complete);
|
||||
@@ -256,22 +255,6 @@ static int bot_send_write_request(struct usbg_cmd *cmd)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!gadget->sg_supported) {
|
||||
cmd->data_buf = kmalloc(se_cmd->data_length, GFP_KERNEL);
|
||||
if (!cmd->data_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
fu->bot_req_out->buf = cmd->data_buf;
|
||||
} else {
|
||||
fu->bot_req_out->buf = NULL;
|
||||
fu->bot_req_out->num_sgs = se_cmd->t_data_nents;
|
||||
fu->bot_req_out->sg = se_cmd->t_data_sg;
|
||||
}
|
||||
|
||||
fu->bot_req_out->complete = usbg_data_write_cmpl;
|
||||
fu->bot_req_out->length = se_cmd->data_length;
|
||||
fu->bot_req_out->context = cmd;
|
||||
|
||||
ret = usbg_prepare_w_request(cmd, fu->bot_req_out);
|
||||
if (ret)
|
||||
goto cleanup;
|
||||
@@ -973,6 +956,7 @@ static void usbg_data_write_cmpl(struct usb_ep *ep, struct usb_request *req)
|
||||
return;
|
||||
|
||||
cleanup:
|
||||
target_put_sess_cmd(se_cmd);
|
||||
transport_generic_free_cmd(&cmd->se_cmd, 0);
|
||||
}
|
||||
|
||||
@@ -1065,7 +1049,7 @@ static void usbg_cmd_work(struct work_struct *work)
|
||||
|
||||
out:
|
||||
transport_send_check_condition_and_sense(se_cmd,
|
||||
TCM_UNSUPPORTED_SCSI_OPCODE, 1);
|
||||
TCM_UNSUPPORTED_SCSI_OPCODE, 0);
|
||||
}
|
||||
|
||||
static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu,
|
||||
@@ -1193,7 +1177,7 @@ static void bot_cmd_work(struct work_struct *work)
|
||||
|
||||
out:
|
||||
transport_send_check_condition_and_sense(se_cmd,
|
||||
TCM_UNSUPPORTED_SCSI_OPCODE, 1);
|
||||
TCM_UNSUPPORTED_SCSI_OPCODE, 0);
|
||||
}
|
||||
|
||||
static int bot_submit_command(struct f_uas *fu,
|
||||
@@ -1997,43 +1981,39 @@ static int tcm_bind(struct usb_configuration *c, struct usb_function *f)
|
||||
bot_intf_desc.bInterfaceNumber = iface;
|
||||
uasp_intf_desc.bInterfaceNumber = iface;
|
||||
fu->iface = iface;
|
||||
ep = usb_ep_autoconfig_ss(gadget, &uasp_ss_bi_desc,
|
||||
&uasp_bi_ep_comp_desc);
|
||||
ep = usb_ep_autoconfig(gadget, &uasp_fs_bi_desc);
|
||||
if (!ep)
|
||||
goto ep_fail;
|
||||
|
||||
fu->ep_in = ep;
|
||||
|
||||
ep = usb_ep_autoconfig_ss(gadget, &uasp_ss_bo_desc,
|
||||
&uasp_bo_ep_comp_desc);
|
||||
ep = usb_ep_autoconfig(gadget, &uasp_fs_bo_desc);
|
||||
if (!ep)
|
||||
goto ep_fail;
|
||||
fu->ep_out = ep;
|
||||
|
||||
ep = usb_ep_autoconfig_ss(gadget, &uasp_ss_status_desc,
|
||||
&uasp_status_in_ep_comp_desc);
|
||||
ep = usb_ep_autoconfig(gadget, &uasp_fs_status_desc);
|
||||
if (!ep)
|
||||
goto ep_fail;
|
||||
fu->ep_status = ep;
|
||||
|
||||
ep = usb_ep_autoconfig_ss(gadget, &uasp_ss_cmd_desc,
|
||||
&uasp_cmd_comp_desc);
|
||||
ep = usb_ep_autoconfig(gadget, &uasp_fs_cmd_desc);
|
||||
if (!ep)
|
||||
goto ep_fail;
|
||||
fu->ep_cmd = ep;
|
||||
|
||||
/* Assume endpoint addresses are the same for both speeds */
|
||||
uasp_bi_desc.bEndpointAddress = uasp_ss_bi_desc.bEndpointAddress;
|
||||
uasp_bo_desc.bEndpointAddress = uasp_ss_bo_desc.bEndpointAddress;
|
||||
uasp_bi_desc.bEndpointAddress = uasp_fs_bi_desc.bEndpointAddress;
|
||||
uasp_bo_desc.bEndpointAddress = uasp_fs_bo_desc.bEndpointAddress;
|
||||
uasp_status_desc.bEndpointAddress =
|
||||
uasp_ss_status_desc.bEndpointAddress;
|
||||
uasp_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress;
|
||||
uasp_fs_status_desc.bEndpointAddress;
|
||||
uasp_cmd_desc.bEndpointAddress = uasp_fs_cmd_desc.bEndpointAddress;
|
||||
|
||||
uasp_fs_bi_desc.bEndpointAddress = uasp_ss_bi_desc.bEndpointAddress;
|
||||
uasp_fs_bo_desc.bEndpointAddress = uasp_ss_bo_desc.bEndpointAddress;
|
||||
uasp_fs_status_desc.bEndpointAddress =
|
||||
uasp_ss_status_desc.bEndpointAddress;
|
||||
uasp_fs_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress;
|
||||
uasp_ss_bi_desc.bEndpointAddress = uasp_fs_bi_desc.bEndpointAddress;
|
||||
uasp_ss_bo_desc.bEndpointAddress = uasp_fs_bo_desc.bEndpointAddress;
|
||||
uasp_ss_status_desc.bEndpointAddress =
|
||||
uasp_fs_status_desc.bEndpointAddress;
|
||||
uasp_ss_cmd_desc.bEndpointAddress = uasp_fs_cmd_desc.bEndpointAddress;
|
||||
|
||||
ret = usb_assign_descriptors(f, uasp_fs_function_desc,
|
||||
uasp_hs_function_desc, uasp_ss_function_desc,
|
||||
|
||||
Reference in New Issue
Block a user