Reverting incrementalfs, power,usb and scheduler changes

Reverting below changes from android-4.19-stable.113

	8794e1e ANDROID: Incremental fs: Fix four resource bugs
	05cf04f ANDROID: Incremental fs: Add INCFS_IOC_GET_FILLED_BLOCKS
	f2e257e ANDROID: Incremental fs: Fix two typos
	5635d76 ANDROID: GKI: power_supply: add more soc properties
	363ef6d ANDROID: GKI: google_battery: return string type for serial_number property
	0de5e99 ANDROID: GKI: power: supply: Add APSD based power-supply properties
	c5bdb84 ANDROID: GKI: power: supply: Remove "Wipower" PSY type
	8eb8836 ANDROID: GKI: power: supply: Add support for HVDCP_3P5
	4c6b35a ANDROID: GKI: power_supply: Define Debug Accessory Mode
	f022b12 ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_AICL_*
	caaeb5f ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_ALIGNMENT
	63ea9d3 ANDROID: GKI: power_supply: Add CP_ISNS_SLAVE power supply property
	cb77fe7 ANDROID: GKI: power_supply: add properties to report parallel connection topology
	f7b1631 ANDROID: GKI: power_supply: add POWER_SUPPLY_PROP_IRQ_STATUS property
	3eef557 ANDROID: GKI: power: supply: add CHARGE_CHARGER_STATE property
	aadbdee ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_PTMC_ID
	4f70929 ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_OTG_FASTROLESWAP
	d46562a ANDROID: GKI: power: supply: Add VOLTAGE_STEP property
	abcee9a ANDROID: GKI: power: supply: Add AICL_DONE parameter
	c4bb7e5 ANDROID: GKI: power_supply: Add operating frequency property
	958192f ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_CC_UAH
	c4b94d4 ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_VOLTAGE_FIFO
	d8fb4a9 ANDROID: GKI: power: supply: Add capacity and resistance estimates
	cd5c0c7 ANDROID: GKI: power_supply: Add vendor specific dead battery property
	6c9a854 ANDROID: GKI: power-supply: add ADAPTER_DETAILS power supply property
	e90672c ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_CHARGE_DISABLE
	554dd9d ANDROID: GKI: power: power_supply: Add property to display skin thermal status
	55d9887 ANDROID: GKI: power_supply: Add properties to support PPS constant current(CC) mode
	954e48c ANDROID: GKI: power: power_supply: Add REAL_CAPACITY property
	913ef30 ANDROID: GKI: power_supply: Add VOLTAGE_MAX_LIMIT power supply property
	1b3d52f ANDROID: GKI: power_supply: Add DC_RESET power-supply property
	1dbd6b4 ANDROID: GKI: power_supply: Add "THERM_ICL_LIMIT" property
	8b94d07 ANDROID: GKI: power_supply: add CHIP_VERSION property
	d4ce1e6 ANDROID: GKI: power-supply: Add VOLTAGE_VPH power supply property
	2193e75 ANDROID: GKI: power_supply: Add SCALE_MODE_EN power-supply property
	e419098 ANDROID: GKI: power_supply: Add local extensions of string property names properly
	e58a053 ANDROID: GKI: power_supply: add batt_age_level property
	eecc3db ANDROID: GKI: power-supply: Add CC_SOC power supply property
	48c932a ANDROID: GKI: power_supply: add property to disable QC userspace optimizations
	2c0ee0e ANDROID: GKI: power: power_supply: Add FG_RESET power supply property
	ab63e51 ANDROID: GKI: power_supply: Add power supply type "Charge Pump"
	7c08ec15 ANDROID: GKI: power: supply: Add snapshot of power supply framework files
	8e68102 ANDROID: GKI: power: power_supply: Add property CHARGE_COUNTER_EXT and 64-bit precision properties
	1d4485a ANDROID: GKI: power: power_supply: add POWER_SUPPLY_PROP_CHARGE_ENABLED
	d50f384 ANDROID: GKI: power: power_supply: add POWER_SUPPLY_PROP_USB_OTG
	76daf69 ANDROID: GKI: power: power_supply: Add custom property for USB High Current mode
	b582ef5b ANDROID: GKI: drivers: usb: Add functions usb_func_ep_queue/usb_func_wakeup
	34f6bfd ANDROID: GKI: Add API usb_ep_autoconfig_by_name
	7ff8c34 ANDROID: GKI: usb: core: Add helper function to return controller id
	b38208f FROMGIT: sched/rt: cpupri_find: Trigger a full search as fallback
	32061ff FROMGIT: sched/rt: Remove unnecessary push for unfit tasks
	8efce17 BACKPORT: FROMGIT: sched/rt: Allow pulling unfitting task
	2bf4a52 FROMGIT: sched/rt: Optimize cpupri_find() on non-heterogenous systems
	27d84b6 FROMGIT: sched/rt: Re-instate old behavior in select_task_rq_rt()
	ca79ac3 BACKPORT: FROMGIT: sched/rt: cpupri_find: Implement fallback mechanism for !fit case

Change-Id: Ifa8ee358e5b368f18e04cb762cf594c7c240bbf6
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
This commit is contained in:
Srinivasarao P 2020-05-28 17:20:38 +05:30
parent 2b82910d12
commit de3445c0b9
22 changed files with 126 additions and 1514 deletions

View File

@ -43,10 +43,7 @@ static struct device_attribute power_supply_attrs[];
static const char * const power_supply_type_text[] = {
"Unknown", "Battery", "UPS", "Mains", "USB",
"USB_DCP", "USB_CDP", "USB_ACA", "USB_C",
"USB_PD", "USB_PD_DRP", "BrickID",
"USB_HVDCP", "USB_HVDCP_3", "USB_HVDCP_3P5", "Wireless", "USB_FLOAT",
"BMS", "Parallel", "Main", "USB_C_UFP", "USB_C_DFP",
"Charge_Pump",
"USB_PD", "USB_PD_DRP", "BrickID"
};
static const char * const power_supply_usb_type_text[] = {
@ -59,14 +56,13 @@ static const char * const power_supply_status_text[] = {
};
static const char * const power_supply_charge_type_text[] = {
"Unknown", "N/A", "Trickle", "Fast", "Taper"
"Unknown", "N/A", "Trickle", "Fast"
};
static const char * const power_supply_health_text[] = {
"Unknown", "Good", "Overheat", "Dead", "Over voltage",
"Unspecified failure", "Cold", "Watchdog timer expire",
"Safety timer expire",
"Warm", "Cool", "Hot"
"Safety timer expire"
};
static const char * const power_supply_technology_text[] = {
@ -82,29 +78,6 @@ static const char * const power_supply_scope_text[] = {
"Unknown", "System", "Device"
};
static const char * const power_supply_usbc_text[] = {
"Nothing attached", "Sink attached", "Powered cable w/ sink",
"Debug Accessory", "Audio Adapter", "Powered cable w/o sink",
"Source attached (default current)",
"Source attached (medium current)",
"Source attached (high current)",
"Debug Accessory Mode (default current)",
"Debug Accessory Mode (medium current)",
"Debug Accessory Mode (high current)",
"Non compliant",
"Non compliant (Rp-Default/Rp-Default)",
"Non compliant (Rp-1.5A/Rp-1.5A)",
"Non compliant (Rp-3A/Rp-3A)"
};
static const char * const power_supply_usbc_pr_text[] = {
"none", "dual power role", "sink", "source"
};
static const char * const power_supply_typec_src_rp_text[] = {
"Rp-Default", "Rp-1.5A", "Rp-3A"
};
static ssize_t power_supply_show_usb_type(struct device *dev,
enum power_supply_usb_type *usb_types,
ssize_t num_usb_types,
@ -187,7 +160,6 @@ static ssize_t power_supply_show_property(struct device *dev,
power_supply_capacity_level_text[value.intval]);
break;
case POWER_SUPPLY_PROP_TYPE:
case POWER_SUPPLY_PROP_REAL_TYPE:
ret = sprintf(buf, "%s\n",
power_supply_type_text[value.intval]);
break;
@ -200,27 +172,6 @@ static ssize_t power_supply_show_property(struct device *dev,
ret = sprintf(buf, "%s\n",
power_supply_scope_text[value.intval]);
break;
case POWER_SUPPLY_PROP_TYPEC_MODE:
ret = sprintf(buf, "%s\n",
power_supply_usbc_text[value.intval]);
break;
case POWER_SUPPLY_PROP_TYPEC_POWER_ROLE:
ret = sprintf(buf, "%s\n",
power_supply_usbc_pr_text[value.intval]);
break;
case POWER_SUPPLY_PROP_TYPEC_SRC_RP:
ret = sprintf(buf, "%s\n",
power_supply_typec_src_rp_text[value.intval]);
break;
case POWER_SUPPLY_PROP_DIE_HEALTH:
case POWER_SUPPLY_PROP_SKIN_HEALTH:
case POWER_SUPPLY_PROP_CONNECTOR_HEALTH:
ret = sprintf(buf, "%s\n",
power_supply_health_text[value.intval]);
break;
case POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT:
ret = sprintf(buf, "%lld\n", value.int64val);
break;
case POWER_SUPPLY_PROP_MODEL_NAME ... POWER_SUPPLY_PROP_SERIAL_NUMBER:
ret = sprintf(buf, "%s\n", value.strval);
break;
@ -352,169 +303,9 @@ static struct device_attribute power_supply_attrs[] = {
POWER_SUPPLY_ATTR(precharge_current),
POWER_SUPPLY_ATTR(charge_term_current),
POWER_SUPPLY_ATTR(calibrate),
/* Local extensions */
POWER_SUPPLY_ATTR(usb_hc),
POWER_SUPPLY_ATTR(usb_otg),
POWER_SUPPLY_ATTR(charge_enabled),
POWER_SUPPLY_ATTR(set_ship_mode),
POWER_SUPPLY_ATTR(real_type),
POWER_SUPPLY_ATTR(charge_now_raw),
POWER_SUPPLY_ATTR(charge_now_error),
POWER_SUPPLY_ATTR(capacity_raw),
POWER_SUPPLY_ATTR(battery_charging_enabled),
POWER_SUPPLY_ATTR(charging_enabled),
POWER_SUPPLY_ATTR(step_charging_enabled),
POWER_SUPPLY_ATTR(step_charging_step),
POWER_SUPPLY_ATTR(pin_enabled),
POWER_SUPPLY_ATTR(input_suspend),
POWER_SUPPLY_ATTR(input_voltage_regulation),
POWER_SUPPLY_ATTR(input_current_max),
POWER_SUPPLY_ATTR(input_current_trim),
POWER_SUPPLY_ATTR(input_current_settled),
POWER_SUPPLY_ATTR(input_voltage_settled),
POWER_SUPPLY_ATTR(bypass_vchg_loop_debouncer),
POWER_SUPPLY_ATTR(charge_counter_shadow),
POWER_SUPPLY_ATTR(hi_power),
POWER_SUPPLY_ATTR(low_power),
POWER_SUPPLY_ATTR(temp_cool),
POWER_SUPPLY_ATTR(temp_warm),
POWER_SUPPLY_ATTR(temp_cold),
POWER_SUPPLY_ATTR(temp_hot),
POWER_SUPPLY_ATTR(system_temp_level),
POWER_SUPPLY_ATTR(resistance),
POWER_SUPPLY_ATTR(resistance_capacitive),
POWER_SUPPLY_ATTR(resistance_id),
POWER_SUPPLY_ATTR(resistance_now),
POWER_SUPPLY_ATTR(flash_current_max),
POWER_SUPPLY_ATTR(update_now),
POWER_SUPPLY_ATTR(esr_count),
POWER_SUPPLY_ATTR(buck_freq),
POWER_SUPPLY_ATTR(boost_current),
POWER_SUPPLY_ATTR(safety_timer_enabled),
POWER_SUPPLY_ATTR(charge_done),
POWER_SUPPLY_ATTR(flash_active),
POWER_SUPPLY_ATTR(flash_trigger),
POWER_SUPPLY_ATTR(force_tlim),
POWER_SUPPLY_ATTR(dp_dm),
POWER_SUPPLY_ATTR(input_current_limited),
POWER_SUPPLY_ATTR(input_current_now),
POWER_SUPPLY_ATTR(charge_qnovo_enable),
POWER_SUPPLY_ATTR(current_qnovo),
POWER_SUPPLY_ATTR(voltage_qnovo),
POWER_SUPPLY_ATTR(rerun_aicl),
POWER_SUPPLY_ATTR(cycle_count_id),
POWER_SUPPLY_ATTR(safety_timer_expired),
POWER_SUPPLY_ATTR(restricted_charging),
POWER_SUPPLY_ATTR(current_capability),
POWER_SUPPLY_ATTR(typec_mode),
POWER_SUPPLY_ATTR(typec_cc_orientation),
POWER_SUPPLY_ATTR(typec_power_role),
POWER_SUPPLY_ATTR(typec_src_rp),
POWER_SUPPLY_ATTR(pd_allowed),
POWER_SUPPLY_ATTR(pd_active),
POWER_SUPPLY_ATTR(pd_in_hard_reset),
POWER_SUPPLY_ATTR(pd_current_max),
POWER_SUPPLY_ATTR(pd_usb_suspend_supported),
POWER_SUPPLY_ATTR(charger_temp),
POWER_SUPPLY_ATTR(charger_temp_max),
POWER_SUPPLY_ATTR(parallel_disable),
POWER_SUPPLY_ATTR(pe_start),
POWER_SUPPLY_ATTR(soc_reporting_ready),
POWER_SUPPLY_ATTR(debug_battery),
POWER_SUPPLY_ATTR(fcc_delta),
POWER_SUPPLY_ATTR(icl_reduction),
POWER_SUPPLY_ATTR(parallel_mode),
POWER_SUPPLY_ATTR(die_health),
POWER_SUPPLY_ATTR(connector_health),
POWER_SUPPLY_ATTR(ctm_current_max),
POWER_SUPPLY_ATTR(hw_current_max),
POWER_SUPPLY_ATTR(pr_swap),
POWER_SUPPLY_ATTR(cc_step),
POWER_SUPPLY_ATTR(cc_step_sel),
POWER_SUPPLY_ATTR(sw_jeita_enabled),
POWER_SUPPLY_ATTR(pd_voltage_max),
POWER_SUPPLY_ATTR(pd_voltage_min),
POWER_SUPPLY_ATTR(sdp_current_max),
POWER_SUPPLY_ATTR(connector_type),
POWER_SUPPLY_ATTR(parallel_batfet_mode),
POWER_SUPPLY_ATTR(parallel_fcc_max),
POWER_SUPPLY_ATTR(min_icl),
POWER_SUPPLY_ATTR(moisture_detected),
POWER_SUPPLY_ATTR(batt_profile_version),
POWER_SUPPLY_ATTR(batt_full_current),
POWER_SUPPLY_ATTR(recharge_soc),
POWER_SUPPLY_ATTR(hvdcp_opti_allowed),
POWER_SUPPLY_ATTR(smb_en_mode),
POWER_SUPPLY_ATTR(smb_en_reason),
POWER_SUPPLY_ATTR(esr_actual),
POWER_SUPPLY_ATTR(esr_nominal),
POWER_SUPPLY_ATTR(soh),
POWER_SUPPLY_ATTR(clear_soh),
POWER_SUPPLY_ATTR(force_recharge),
POWER_SUPPLY_ATTR(fcc_stepper_enable),
POWER_SUPPLY_ATTR(toggle_stat),
POWER_SUPPLY_ATTR(main_fcc_max),
POWER_SUPPLY_ATTR(fg_reset),
POWER_SUPPLY_ATTR(qc_opti_disable),
POWER_SUPPLY_ATTR(cc_soc),
POWER_SUPPLY_ATTR(batt_age_level),
POWER_SUPPLY_ATTR(scale_mode_en),
POWER_SUPPLY_ATTR(voltage_vph),
POWER_SUPPLY_ATTR(chip_version),
POWER_SUPPLY_ATTR(therm_icl_limit),
POWER_SUPPLY_ATTR(dc_reset),
POWER_SUPPLY_ATTR(voltage_max_limit),
POWER_SUPPLY_ATTR(real_capacity),
POWER_SUPPLY_ATTR(force_main_icl),
POWER_SUPPLY_ATTR(force_main_fcc),
POWER_SUPPLY_ATTR(comp_clamp_level),
POWER_SUPPLY_ATTR(adapter_cc_mode),
POWER_SUPPLY_ATTR(skin_health),
POWER_SUPPLY_ATTR(charge_disable),
POWER_SUPPLY_ATTR(adapter_details),
POWER_SUPPLY_ATTR(dead_battery),
POWER_SUPPLY_ATTR(voltage_fifo),
POWER_SUPPLY_ATTR(cc_uah),
POWER_SUPPLY_ATTR(operating_freq),
POWER_SUPPLY_ATTR(aicl_delay),
POWER_SUPPLY_ATTR(aicl_icl),
POWER_SUPPLY_ATTR(cutoff_soc),
POWER_SUPPLY_ATTR(sys_soc),
POWER_SUPPLY_ATTR(batt_soc),
/* Capacity Estimation */
POWER_SUPPLY_ATTR(batt_ce_ctrl),
POWER_SUPPLY_ATTR(batt_ce_full),
/* Resistance Estimaton */
POWER_SUPPLY_ATTR(resistance_avg),
POWER_SUPPLY_ATTR(batt_res_filt_cnts),
POWER_SUPPLY_ATTR(aicl_done),
POWER_SUPPLY_ATTR(voltage_step),
POWER_SUPPLY_ATTR(otg_fastroleswap),
POWER_SUPPLY_ATTR(apsd_rerun),
POWER_SUPPLY_ATTR(apsd_timeout),
/* Charge pump properties */
POWER_SUPPLY_ATTR(cp_status1),
POWER_SUPPLY_ATTR(cp_status2),
POWER_SUPPLY_ATTR(cp_enable),
POWER_SUPPLY_ATTR(cp_switcher_en),
POWER_SUPPLY_ATTR(cp_die_temp),
POWER_SUPPLY_ATTR(cp_isns),
POWER_SUPPLY_ATTR(cp_isns_slave),
POWER_SUPPLY_ATTR(cp_toggle_switcher),
POWER_SUPPLY_ATTR(cp_irq_status),
POWER_SUPPLY_ATTR(cp_ilim),
POWER_SUPPLY_ATTR(irq_status),
POWER_SUPPLY_ATTR(parallel_output_mode),
POWER_SUPPLY_ATTR(alignment),
/* Local extensions of type int64_t */
POWER_SUPPLY_ATTR(charge_counter_ext),
POWER_SUPPLY_ATTR(charge_charger_state),
/* Properties of type `const char *' */
POWER_SUPPLY_ATTR(model_name),
POWER_SUPPLY_ATTR(ptmc_id),
POWER_SUPPLY_ATTR(manufacturer),
POWER_SUPPLY_ATTR(battery_type),
POWER_SUPPLY_ATTR(cycle_counts),
POWER_SUPPLY_ATTR(serial_number),
};
@ -611,12 +402,6 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
attr = &power_supply_attrs[psy->desc->properties[j]];
if (!attr->attr.name) {
dev_info(dev, "%s:%d FAKE attr.name=NULL skip\n",
__FILE__, __LINE__, __func__);
continue;
}
ret = power_supply_show_property(dev, attr, prop_buf);
if (ret == -ENODEV || ret == -ENODATA) {
/* When a battery is absent, we expect -ENODEV. Don't abort;

View File

@ -2235,16 +2235,6 @@ int usb_hcd_get_frame_number (struct usb_device *udev)
/*-------------------------------------------------------------------------*/
int usb_hcd_get_controller_id(struct usb_device *udev)
{
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
if (!HCD_RH_RUNNING(hcd))
return -EINVAL;
return hcd->driver->get_core_id(hcd);
}
#ifdef CONFIG_PM
int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg)

View File

@ -825,19 +825,6 @@ int usb_get_current_frame_number(struct usb_device *dev)
}
EXPORT_SYMBOL_GPL(usb_get_current_frame_number);
/**
* usb_get_controller_id - returns the host controller id.
* @dev: the device whose host controller id is being queried.
*/
int usb_get_controller_id(struct usb_device *dev)
{
if (dev->state == USB_STATE_NOTATTACHED)
return -EINVAL;
return usb_hcd_get_controller_id(dev);
}
EXPORT_SYMBOL_GPL(usb_get_controller_id);
/*-------------------------------------------------------------------*/
/*
* __usb_get_extra_descriptor() finds a descriptor of specific type in the

View File

@ -426,122 +426,6 @@ int usb_interface_id(struct usb_configuration *config,
}
EXPORT_SYMBOL_GPL(usb_interface_id);
static int usb_func_wakeup_int(struct usb_function *func)
{
int ret;
struct usb_gadget *gadget;
if (!func || !func->config || !func->config->cdev ||
!func->config->cdev->gadget)
return -EINVAL;
pr_debug("%s - %s function wakeup\n",
__func__, func->name ? func->name : "");
gadget = func->config->cdev->gadget;
if ((gadget->speed != USB_SPEED_SUPER) || !func->func_wakeup_allowed) {
DBG(func->config->cdev,
"Function Wakeup is not possible. speed=%u, func_wakeup_allowed=%u\n",
gadget->speed,
func->func_wakeup_allowed);
return -ENOTSUPP;
}
ret = usb_gadget_func_wakeup(gadget, func->intf_id);
return ret;
}
/**
* usb_func_wakeup - wakes up a composite device function.
* @func: composite device function to wake up.
*
* Returns 0 on success or a negative error value.
*/
int usb_func_wakeup(struct usb_function *func)
{
int ret;
unsigned long flags;
if (!func || !func->config || !func->config->cdev)
return -EINVAL;
pr_debug("%s function wakeup\n",
func->name ? func->name : "");
spin_lock_irqsave(&func->config->cdev->lock, flags);
ret = usb_func_wakeup_int(func);
if (ret == -EAGAIN) {
DBG(func->config->cdev,
"Function wakeup for %s could not complete due to suspend state. Delayed until after bus resume.\n",
func->name ? func->name : "");
ret = 0;
} else if (ret < 0 && ret != -ENOTSUPP) {
ERROR(func->config->cdev,
"Failed to wake function %s from suspend state. ret=%d. Canceling USB request.\n",
func->name ? func->name : "", ret);
}
spin_unlock_irqrestore(&func->config->cdev->lock, flags);
return ret;
}
EXPORT_SYMBOL_GPL(usb_func_wakeup);
/**
* usb_func_ep_queue - queues (submits) an I/O request to a function endpoint.
* This function is similar to the usb_ep_queue function, but in addition it
* also checks whether the function is in Super Speed USB Function Suspend
* state, and if so a Function Wake notification is sent to the host
* (USB 3.0 spec, section 9.2.5.2).
* @func: the function which issues the USB I/O request.
* @ep:the endpoint associated with the request
* @req:the request being submitted
* @gfp_flags: GFP_* flags to use in case the lower level driver couldn't
* pre-allocate all necessary memory with the request.
*/
int usb_func_ep_queue(struct usb_function *func, struct usb_ep *ep,
struct usb_request *req, gfp_t gfp_flags)
{
int ret;
struct usb_gadget *gadget;
if (!func || !func->config || !func->config->cdev ||
!func->config->cdev->gadget || !ep || !req) {
ret = -EINVAL;
goto done;
}
pr_debug("Function %s queueing new data into ep %u\n",
func->name ? func->name : "", ep->address);
gadget = func->config->cdev->gadget;
if (func->func_is_suspended && func->func_wakeup_allowed) {
ret = usb_gadget_func_wakeup(gadget, func->intf_id);
if (ret == -EAGAIN) {
pr_debug("bus suspended func wakeup for %s delayed until bus resume.\n",
func->name ? func->name : "");
} else if (ret < 0 && ret != -ENOTSUPP) {
pr_err("Failed to wake function %s from suspend state. ret=%d.\n",
func->name ? func->name : "", ret);
}
goto done;
}
if (!func->func_is_suspended)
ret = 0;
if (func->func_is_suspended && !func->func_wakeup_allowed) {
ret = -ENOTSUPP;
goto done;
}
ret = usb_ep_queue(ep, req, gfp_flags);
done:
return ret;
}
EXPORT_SYMBOL_GPL(usb_func_ep_queue);
static u8 encode_bMaxPower(enum usb_device_speed speed,
struct usb_configuration *c)
{

View File

@ -205,41 +205,3 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget)
gadget->out_epnum = 0;
}
EXPORT_SYMBOL_GPL(usb_ep_autoconfig_reset);
/**
* usb_ep_autoconfig_by_name - Used to pick the endpoint by name. eg ep1in-gsi
* @gadget: The device to which the endpoint must belong.
* @desc: Endpoint descriptor, with endpoint direction and transfer mode
* initialized.
* @ep_name: EP name that is to be searched.
*
*/
struct usb_ep *usb_ep_autoconfig_by_name(
struct usb_gadget *gadget,
struct usb_endpoint_descriptor *desc,
const char *ep_name
)
{
struct usb_ep *ep;
bool ep_found = false;
list_for_each_entry(ep, &gadget->ep_list, ep_list)
if (strcmp(ep->name, ep_name) == 0 && !ep->driver_data) {
ep_found = true;
break;
}
if (ep_found) {
desc->bEndpointAddress &= USB_DIR_IN;
desc->bEndpointAddress |= ep->ep_num;
ep->address = desc->bEndpointAddress;
pr_debug("Allocating ep address:%x\n", ep->address);
ep->desc = NULL;
ep->comp_desc = NULL;
return ep;
}
pr_err("%s:error finding ep %s\n", __func__, ep_name);
return NULL;
}
EXPORT_SYMBOL_GPL(usb_ep_autoconfig_by_name);

View File

@ -506,27 +506,6 @@ out:
}
EXPORT_SYMBOL_GPL(usb_gadget_wakeup);
/**
* usb_gadget_func_wakeup - send a function remote wakeup up notification
* to the host connected to this gadget
* @gadget: controller used to wake up the host
* @interface_id: the interface which triggered the remote wakeup event
*
* Returns zero on success. Otherwise, negative error code is returned.
*/
int usb_gadget_func_wakeup(struct usb_gadget *gadget,
int interface_id)
{
if (!gadget || (gadget->speed != USB_SPEED_SUPER))
return -EOPNOTSUPP;
if (!gadget->ops || !gadget->ops->func_wakeup)
return -EOPNOTSUPP;
return gadget->ops->func_wakeup(gadget, interface_id);
}
EXPORT_SYMBOL_GPL(usb_gadget_func_wakeup);
/**
* usb_gadget_set_selfpowered - sets the device selfpowered feature.
* @gadget:the device being declared as self-powered

View File

@ -118,8 +118,8 @@ struct data_file *incfs_open_data_file(struct mount_info *mi, struct file *bf)
error = mutex_lock_interruptible(&bfc->bc_mutex);
if (error)
goto out;
error = incfs_read_file_header(bfc, &df->df_metadata_off, &df->df_id,
&size, &df->df_header_flags);
error = incfs_read_file_header(bfc, &df->df_metadata_off,
&df->df_id, &size);
mutex_unlock(&bfc->bc_mutex);
if (error)
@ -127,7 +127,7 @@ struct data_file *incfs_open_data_file(struct mount_info *mi, struct file *bf)
df->df_size = size;
if (size > 0)
df->df_data_block_count = get_blocks_count_for_size(size);
df->df_block_count = get_blocks_count_for_size(size);
md_records = incfs_scan_metadata_chain(df);
if (md_records < 0)
@ -351,7 +351,7 @@ static int get_data_file_block(struct data_file *df, int index,
blockmap_off = df->df_blockmap_off;
bfc = df->df_backing_file_context;
if (index < 0 || blockmap_off == 0)
if (index < 0 || index >= df->df_block_count || blockmap_off == 0)
return -EINVAL;
error = incfs_read_blockmap_entry(bfc, index, blockmap_off, &bme);
@ -371,96 +371,6 @@ static int get_data_file_block(struct data_file *df, int index,
return 0;
}
static int copy_one_range(struct incfs_filled_range *range, void __user *buffer,
u32 size, u32 *size_out)
{
if (*size_out + sizeof(*range) > size)
return -ERANGE;
if (copy_to_user(((char *)buffer) + *size_out, range, sizeof(*range)))
return -EFAULT;
*size_out += sizeof(*range);
return 0;
}
int incfs_get_filled_blocks(struct data_file *df,
struct incfs_get_filled_blocks_args *arg)
{
int error = 0;
bool in_range = false;
struct incfs_filled_range range;
void *buffer = u64_to_user_ptr(arg->range_buffer);
u32 size = arg->range_buffer_size;
u32 end_index =
arg->end_index ? arg->end_index : df->df_total_block_count;
u32 *size_out = &arg->range_buffer_size_out;
*size_out = 0;
if (end_index > df->df_total_block_count)
end_index = df->df_total_block_count;
arg->total_blocks_out = df->df_total_block_count;
if (df->df_header_flags & INCFS_FILE_COMPLETE) {
pr_debug("File marked full, fast get_filled_blocks");
if (arg->start_index > end_index) {
arg->index_out = arg->start_index;
return 0;
}
range = (struct incfs_filled_range){
.begin = arg->start_index,
.end = end_index,
};
arg->index_out = end_index;
return copy_one_range(&range, buffer, size, size_out);
}
for (arg->index_out = arg->start_index; arg->index_out < end_index;
++arg->index_out) {
struct data_file_block dfb;
error = get_data_file_block(df, arg->index_out, &dfb);
if (error)
break;
if (is_data_block_present(&dfb) == in_range)
continue;
if (!in_range) {
in_range = true;
range.begin = arg->index_out;
} else {
range.end = arg->index_out;
error = copy_one_range(&range, buffer, size, size_out);
if (error)
break;
in_range = false;
}
}
if (in_range) {
range.end = arg->index_out;
error = copy_one_range(&range, buffer, size, size_out);
}
if (!error && in_range && arg->start_index == 0 &&
end_index == df->df_total_block_count &&
*size_out == sizeof(struct incfs_filled_range)) {
int result;
df->df_header_flags |= INCFS_FILE_COMPLETE;
result = incfs_update_file_header_flags(
df->df_backing_file_context, df->df_header_flags);
/* Log failure only, since it's just a failed optimization */
pr_debug("Marked file full with result %d", result);
}
return error;
}
static bool is_read_done(struct pending_read *read)
{
return atomic_read_acquire(&read->done) != 0;
@ -560,7 +470,7 @@ static int wait_for_data_block(struct data_file *df, int block_index,
if (!df || !res_block)
return -EFAULT;
if (block_index < 0 || block_index >= df->df_data_block_count)
if (block_index < 0 || block_index >= df->df_block_count)
return -EINVAL;
if (df->df_blockmap_off <= 0)
@ -730,7 +640,7 @@ int incfs_process_new_data_block(struct data_file *df,
bfc = df->df_backing_file_context;
mi = df->df_mount_info;
if (block->block_index >= df->df_data_block_count)
if (block->block_index >= df->df_block_count)
return -ERANGE;
segment = get_file_segment(df, block->block_index);
@ -836,7 +746,7 @@ int incfs_process_new_hash_block(struct data_file *df,
if (!error)
error = incfs_write_hash_block_to_backing_file(
bfc, range(data, block->data_len), block->block_index,
hash_area_base, df->df_blockmap_off, df->df_size);
hash_area_base);
mutex_unlock(&bfc->bc_mutex);
return error;
}
@ -852,10 +762,9 @@ static int process_blockmap_md(struct incfs_blockmap *bm,
if (!df)
return -EFAULT;
if (df->df_data_block_count > block_count)
if (df->df_block_count != block_count)
return -EBADMSG;
df->df_total_block_count = block_count;
df->df_blockmap_off = base_off;
return error;
}
@ -887,7 +796,7 @@ static int process_file_signature_md(struct incfs_file_signature *sg,
int error = 0;
struct incfs_df_signature *signature =
kzalloc(sizeof(*signature), GFP_NOFS);
void *buf = NULL;
void *buf = 0;
ssize_t read;
if (!df || !df->df_backing_file_context ||
@ -920,7 +829,7 @@ static int process_file_signature_md(struct incfs_file_signature *sg,
}
hash_tree = incfs_alloc_mtree(range(buf, signature->sig_size),
df->df_data_block_count);
df->df_block_count);
if (IS_ERR(hash_tree)) {
error = PTR_ERR(hash_tree);
hash_tree = NULL;
@ -1002,17 +911,6 @@ int incfs_scan_metadata_chain(struct data_file *df)
result = records_count;
}
mutex_unlock(&bfc->bc_mutex);
if (df->df_hash_tree) {
int hash_block_count = get_blocks_count_for_size(
df->df_hash_tree->hash_tree_area_size);
if (df->df_data_block_count + hash_block_count !=
df->df_total_block_count)
result = -EINVAL;
} else if (df->df_data_block_count != df->df_total_block_count)
result = -EINVAL;
out:
kfree(handler);
return result;

View File

@ -183,14 +183,7 @@ struct data_file {
/* File size in bytes */
loff_t df_size;
/* File header flags */
u32 df_header_flags;
/* File size in DATA_FILE_BLOCK_SIZE blocks */
int df_data_block_count;
/* Total number of blocks, data + hash */
int df_total_block_count;
int df_block_count; /* File size in DATA_FILE_BLOCK_SIZE blocks */
struct file_attr n_attr;
@ -237,9 +230,6 @@ ssize_t incfs_read_data_file_block(struct mem_range dst, struct data_file *df,
int index, int timeout_ms,
struct mem_range tmp);
int incfs_get_filled_blocks(struct data_file *df,
struct incfs_get_filled_blocks_args *arg);
int incfs_read_file_signature(struct data_file *df, struct mem_range dst);
int incfs_process_new_data_block(struct data_file *df,

View File

@ -13,7 +13,6 @@
#include <linux/kernel.h>
#include "format.h"
#include "data_mgmt.h"
struct backing_file_context *incfs_alloc_bfc(struct file *backing_file)
{
@ -215,23 +214,12 @@ static int append_md_to_backing_file(struct backing_file_context *bfc,
return result;
}
int incfs_update_file_header_flags(struct backing_file_context *bfc, u32 flags)
{
if (!bfc)
return -EFAULT;
return write_to_bf(bfc, &flags, sizeof(flags),
offsetof(struct incfs_file_header,
fh_file_header_flags),
false);
}
/*
* Reserve 0-filled space for the blockmap body, and append
* incfs_blockmap metadata record pointing to it.
*/
int incfs_write_blockmap_to_backing_file(struct backing_file_context *bfc,
u32 block_count)
u32 block_count, loff_t *map_base_off)
{
struct incfs_blockmap blockmap = {};
int result = 0;
@ -257,9 +245,12 @@ int incfs_write_blockmap_to_backing_file(struct backing_file_context *bfc,
/* Write blockmap metadata record pointing to the body written above. */
blockmap.m_base_offset = cpu_to_le64(file_end);
result = append_md_to_backing_file(bfc, &blockmap.m_header);
if (result)
if (result) {
/* Error, rollback file changes */
truncate_backing_file(bfc, file_end);
} else if (map_base_off) {
*map_base_off = file_end;
}
return result;
}
@ -447,19 +438,12 @@ int incfs_write_data_block_to_backing_file(struct backing_file_context *bfc,
}
int incfs_write_hash_block_to_backing_file(struct backing_file_context *bfc,
struct mem_range block,
int block_index,
loff_t hash_area_off,
loff_t bm_base_off, int file_size)
struct mem_range block,
int block_index, loff_t hash_area_off)
{
struct incfs_blockmap_entry bm_entry = {};
int result;
loff_t data_offset = 0;
loff_t file_end = 0;
loff_t bm_entry_off =
bm_base_off +
sizeof(struct incfs_blockmap_entry) *
(block_index + get_blocks_count_for_size(file_size));
if (!bfc)
return -EFAULT;
@ -473,17 +457,7 @@ int incfs_write_hash_block_to_backing_file(struct backing_file_context *bfc,
return -EINVAL;
}
result = write_to_bf(bfc, block.data, block.len, data_offset, false);
if (result)
return result;
bm_entry.me_data_offset_lo = cpu_to_le32((u32)data_offset);
bm_entry.me_data_offset_hi = cpu_to_le16((u16)(data_offset >> 32));
bm_entry.me_data_size = cpu_to_le16(INCFS_DATA_FILE_BLOCK_SIZE);
bm_entry.me_flags = cpu_to_le16(INCFS_BLOCK_HASH);
return write_to_bf(bfc, &bm_entry, sizeof(bm_entry), bm_entry_off,
false);
return write_to_bf(bfc, block.data, block.len, data_offset, false);
}
/* Initialize a new image in a given backing file. */
@ -543,9 +517,10 @@ int incfs_read_blockmap_entries(struct backing_file_context *bfc,
return 0;
}
int incfs_read_file_header(struct backing_file_context *bfc,
loff_t *first_md_off, incfs_uuid_t *uuid,
u64 *file_size, u32 *flags)
u64 *file_size)
{
ssize_t bytes_read = 0;
struct incfs_file_header fh = {};
@ -579,8 +554,6 @@ int incfs_read_file_header(struct backing_file_context *bfc,
*uuid = fh.fh_uuid;
if (file_size)
*file_size = le64_to_cpu(fh.fh_file_size);
if (flags)
*flags = le32_to_cpu(fh.fh_file_header_flags);
return 0;
}

View File

@ -121,10 +121,6 @@ enum incfs_metadata_type {
INCFS_MD_SIGNATURE = 3
};
enum incfs_file_header_flags {
INCFS_FILE_COMPLETE = 1 << 0,
};
/* Header included at the beginning of all metadata records on the disk. */
struct incfs_md_header {
__u8 h_md_entry_type;
@ -163,8 +159,8 @@ struct incfs_file_header {
/* INCFS_DATA_FILE_BLOCK_SIZE */
__le16 fh_data_block_size;
/* File flags, from incfs_file_header_flags */
__le32 fh_file_header_flags;
/* Padding, also reserved for future use. */
__le32 fh_dummy;
/* Offset of the first metadata record */
__le64 fh_first_md_offset;
@ -182,7 +178,6 @@ struct incfs_file_header {
enum incfs_block_map_entry_flags {
INCFS_BLOCK_COMPRESSED_LZ4 = (1 << 0),
INCFS_BLOCK_HASH = (1 << 1),
};
/* Block map entry pointing to an actual location of the data block. */
@ -289,7 +284,7 @@ void incfs_free_bfc(struct backing_file_context *bfc);
/* Writing stuff */
int incfs_write_blockmap_to_backing_file(struct backing_file_context *bfc,
u32 block_count);
u32 block_count, loff_t *map_base_off);
int incfs_write_fh_to_backing_file(struct backing_file_context *bfc,
incfs_uuid_t *uuid, u64 file_size);
@ -300,10 +295,8 @@ int incfs_write_data_block_to_backing_file(struct backing_file_context *bfc,
u16 flags);
int incfs_write_hash_block_to_backing_file(struct backing_file_context *bfc,
struct mem_range block,
int block_index,
loff_t hash_area_off,
loff_t bm_base_off, int file_size);
struct mem_range block,
int block_index, loff_t hash_area_off);
int incfs_write_file_attr_to_backing_file(struct backing_file_context *bfc,
struct mem_range value, struct incfs_file_attr *attr);
@ -311,15 +304,13 @@ int incfs_write_file_attr_to_backing_file(struct backing_file_context *bfc,
int incfs_write_signature_to_backing_file(struct backing_file_context *bfc,
struct mem_range sig, u32 tree_size);
int incfs_update_file_header_flags(struct backing_file_context *bfc, u32 flags);
int incfs_make_empty_backing_file(struct backing_file_context *bfc,
incfs_uuid_t *uuid, u64 file_size);
/* Reading stuff */
int incfs_read_file_header(struct backing_file_context *bfc,
loff_t *first_md_off, incfs_uuid_t *uuid,
u64 *file_size, u32 *flags);
u64 *file_size);
int incfs_read_blockmap_entry(struct backing_file_context *bfc, int block_index,
loff_t bm_base_off,

View File

@ -57,7 +57,7 @@ struct signature_info {
struct mem_range root_hash;
};
static bool read_u32(u8 **p, u8 *top, u32 *result)
static u32 read_u32(u8 **p, u8 *top, u32 *result)
{
if (*p + sizeof(u32) > top)
return false;

View File

@ -346,8 +346,8 @@ static int inode_test(struct inode *inode, void *opaque)
return (node->n_backing_inode == backing_inode) &&
inode->i_ino == search->ino;
} else
return inode->i_ino == search->ino;
}
return 1;
}
static int inode_set(struct inode *inode, void *opaque)
@ -893,7 +893,6 @@ static int init_new_file(struct mount_info *mi, struct dentry *dentry,
}
bfc = incfs_alloc_bfc(new_file);
fput(new_file);
if (IS_ERR(bfc)) {
error = PTR_ERR(bfc);
bfc = NULL;
@ -905,6 +904,19 @@ static int init_new_file(struct mount_info *mi, struct dentry *dentry,
if (error)
goto out;
block_count = (u32)get_blocks_count_for_size(size);
error = incfs_write_blockmap_to_backing_file(bfc, block_count, NULL);
if (error)
goto out;
/* This fill has data, reserve space for the block map. */
if (block_count > 0) {
error = incfs_write_blockmap_to_backing_file(
bfc, block_count, NULL);
if (error)
goto out;
}
if (attr.data && attr.len) {
error = incfs_write_file_attr_to_backing_file(bfc,
attr, NULL);
@ -912,8 +924,6 @@ static int init_new_file(struct mount_info *mi, struct dentry *dentry,
goto out;
}
block_count = (u32)get_blocks_count_for_size(size);
if (user_signature_info) {
raw_signature = incfs_copy_signature_info_from_user(
user_signature_info, signature_size);
@ -935,16 +945,8 @@ static int init_new_file(struct mount_info *mi, struct dentry *dentry,
bfc, raw_signature, hash_tree->hash_tree_area_size);
if (error)
goto out;
block_count += get_blocks_count_for_size(
hash_tree->hash_tree_area_size);
}
if (block_count)
error = incfs_write_blockmap_to_backing_file(bfc, block_count);
if (error)
goto out;
out:
if (bfc) {
mutex_unlock(&bfc->bc_mutex);
@ -1434,27 +1436,6 @@ out:
return error;
}
static long ioctl_get_filled_blocks(struct file *f, void __user *arg)
{
struct incfs_get_filled_blocks_args __user *args_usr_ptr = arg;
struct incfs_get_filled_blocks_args args = {};
struct data_file *df = get_incfs_data_file(f);
int error;
if (!df)
return -EINVAL;
if (copy_from_user(&args, args_usr_ptr, sizeof(args)) > 0)
return -EINVAL;
error = incfs_get_filled_blocks(df, &args);
if (copy_to_user(args_usr_ptr, &args, sizeof(args)))
return -EFAULT;
return error;
}
static long dispatch_ioctl(struct file *f, unsigned int req, unsigned long arg)
{
struct mount_info *mi = get_mount_info(file_superblock(f));
@ -1468,8 +1449,6 @@ static long dispatch_ioctl(struct file *f, unsigned int req, unsigned long arg)
return ioctl_permit_fill(f, (void __user *)arg);
case INCFS_IOC_READ_FILE_SIGNATURE:
return ioctl_read_file_signature(f, (void __user *)arg);
case INCFS_IOC_GET_FILLED_BLOCKS:
return ioctl_get_filled_blocks(f, (void __user *)arg);
default:
return -EINVAL;
}
@ -1676,7 +1655,6 @@ static int final_file_delete(struct mount_info *mi,
if (d_really_is_positive(index_file_dentry))
error = incfs_unlink(index_file_dentry);
out:
dput(index_file_dentry);
if (error)
pr_debug("incfs: delete_file_from_index err:%d\n", error);
return error;
@ -1979,7 +1957,6 @@ static void dentry_release(struct dentry *d)
if (di)
path_put(&di->backing_path);
kfree(d->d_fsdata);
d->d_fsdata = NULL;
}
@ -2191,7 +2168,7 @@ struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
path_put(&backing_dir_path);
sb->s_flags |= SB_ACTIVE;
pr_debug("incfs: mount\n");
pr_debug("infs: mount\n");
return dget(sb->s_root);
err:
sb->s_fs_info = NULL;
@ -2217,7 +2194,7 @@ static int incfs_remount_fs(struct super_block *sb, int *flags, char *data)
pr_debug("incfs: new timeout_ms=%d", options.read_timeout_ms);
}
pr_debug("incfs: remount\n");
pr_debug("infs: remount\n");
return 0;
}
@ -2225,7 +2202,7 @@ void incfs_kill_sb(struct super_block *sb)
{
struct mount_info *mi = sb->s_fs_info;
pr_debug("incfs: unmount\n");
pr_debug("infs: unmount\n");
incfs_free_mount_info(mi);
generic_shutdown_super(sb);
}

View File

@ -18,7 +18,6 @@
#include <linux/leds.h>
#include <linux/spinlock.h>
#include <linux/notifier.h>
#include <linux/types.h>
/*
* All voltages, currents, charges, energies, time and temperatures in uV,
@ -46,7 +45,6 @@ enum {
POWER_SUPPLY_CHARGE_TYPE_NONE,
POWER_SUPPLY_CHARGE_TYPE_TRICKLE,
POWER_SUPPLY_CHARGE_TYPE_FAST,
POWER_SUPPLY_CHARGE_TYPE_TAPER,
};
enum {
@ -59,9 +57,6 @@ enum {
POWER_SUPPLY_HEALTH_COLD,
POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE,
POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE,
POWER_SUPPLY_HEALTH_WARM,
POWER_SUPPLY_HEALTH_COOL,
POWER_SUPPLY_HEALTH_HOT,
};
enum {
@ -89,84 +84,6 @@ enum {
POWER_SUPPLY_SCOPE_DEVICE,
};
enum {
POWER_SUPPLY_DP_DM_UNKNOWN = 0,
POWER_SUPPLY_DP_DM_PREPARE = 1,
POWER_SUPPLY_DP_DM_UNPREPARE = 2,
POWER_SUPPLY_DP_DM_CONFIRMED_HVDCP3 = 3,
POWER_SUPPLY_DP_DM_DP_PULSE = 4,
POWER_SUPPLY_DP_DM_DM_PULSE = 5,
POWER_SUPPLY_DP_DM_DP0P6_DMF = 6,
POWER_SUPPLY_DP_DM_DP0P6_DM3P3 = 7,
POWER_SUPPLY_DP_DM_DPF_DMF = 8,
POWER_SUPPLY_DP_DM_DPR_DMR = 9,
POWER_SUPPLY_DP_DM_HVDCP3_SUPPORTED = 10,
POWER_SUPPLY_DP_DM_ICL_DOWN = 11,
POWER_SUPPLY_DP_DM_ICL_UP = 12,
POWER_SUPPLY_DP_DM_FORCE_5V = 13,
POWER_SUPPLY_DP_DM_FORCE_9V = 14,
POWER_SUPPLY_DP_DM_FORCE_12V = 15,
POWER_SUPPLY_DP_DM_CONFIRMED_HVDCP3P5 = 16,
};
enum {
POWER_SUPPLY_PL_NONE,
POWER_SUPPLY_PL_USBIN_USBIN,
POWER_SUPPLY_PL_USBIN_USBIN_EXT,
POWER_SUPPLY_PL_USBMID_USBMID,
};
enum {
POWER_SUPPLY_CHARGER_SEC_NONE = 0,
POWER_SUPPLY_CHARGER_SEC_CP,
POWER_SUPPLY_CHARGER_SEC_PL,
POWER_SUPPLY_CHARGER_SEC_CP_PL,
};
enum {
POWER_SUPPLY_CP_NONE = 0,
POWER_SUPPLY_CP_HVDCP3,
POWER_SUPPLY_CP_HVDCP3P5,
POWER_SUPPLY_CP_PPS,
POWER_SUPPLY_CP_WIRELESS,
};
enum {
POWER_SUPPLY_CONNECTOR_TYPEC,
POWER_SUPPLY_CONNECTOR_MICRO_USB,
};
enum {
POWER_SUPPLY_PL_STACKED_BATFET,
POWER_SUPPLY_PL_NON_STACKED_BATFET,
};
/* Parallel output connection topology */
enum {
POWER_SUPPLY_PL_OUTPUT_NONE,
POWER_SUPPLY_PL_OUTPUT_VPH,
POWER_SUPPLY_PL_OUTPUT_VBAT,
};
enum {
POWER_SUPPLY_PD_INACTIVE = 0,
POWER_SUPPLY_PD_ACTIVE,
POWER_SUPPLY_PD_PPS_ACTIVE,
};
enum {
POWER_SUPPLY_QC_CTM_DISABLE = BIT(0),
POWER_SUPPLY_QC_THERMAL_BALANCE_DISABLE = BIT(1),
POWER_SUPPLY_QC_INOV_THERMAL_DISABLE = BIT(2),
};
enum {
POWER_SUPPLY_ALIGN_CHECKING = 0,
POWER_SUPPLY_ALIGN_MOVE,
POWER_SUPPLY_ALIGN_CENTERED,
POWER_SUPPLY_ALIGN_ERROR,
};
enum power_supply_property {
/* Properties of type `int' */
POWER_SUPPLY_PROP_STATUS = 0,
@ -233,173 +150,9 @@ enum power_supply_property {
POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
POWER_SUPPLY_PROP_CALIBRATE,
/* Local extensions */
POWER_SUPPLY_PROP_USB_HC,
POWER_SUPPLY_PROP_USB_OTG,
POWER_SUPPLY_PROP_CHARGE_ENABLED,
POWER_SUPPLY_PROP_SET_SHIP_MODE,
POWER_SUPPLY_PROP_REAL_TYPE,
POWER_SUPPLY_PROP_CHARGE_NOW_RAW,
POWER_SUPPLY_PROP_CHARGE_NOW_ERROR,
POWER_SUPPLY_PROP_CAPACITY_RAW,
POWER_SUPPLY_PROP_BATTERY_CHARGING_ENABLED,
POWER_SUPPLY_PROP_CHARGING_ENABLED,
POWER_SUPPLY_PROP_STEP_CHARGING_ENABLED,
POWER_SUPPLY_PROP_STEP_CHARGING_STEP,
POWER_SUPPLY_PROP_PIN_ENABLED,
POWER_SUPPLY_PROP_INPUT_SUSPEND,
POWER_SUPPLY_PROP_INPUT_VOLTAGE_REGULATION,
POWER_SUPPLY_PROP_INPUT_CURRENT_MAX,
POWER_SUPPLY_PROP_INPUT_CURRENT_TRIM,
POWER_SUPPLY_PROP_INPUT_CURRENT_SETTLED,
POWER_SUPPLY_PROP_INPUT_VOLTAGE_SETTLED,
POWER_SUPPLY_PROP_VCHG_LOOP_DBC_BYPASS,
POWER_SUPPLY_PROP_CHARGE_COUNTER_SHADOW,
POWER_SUPPLY_PROP_HI_POWER,
POWER_SUPPLY_PROP_LOW_POWER,
POWER_SUPPLY_PROP_COOL_TEMP,
POWER_SUPPLY_PROP_WARM_TEMP,
POWER_SUPPLY_PROP_COLD_TEMP,
POWER_SUPPLY_PROP_HOT_TEMP,
POWER_SUPPLY_PROP_SYSTEM_TEMP_LEVEL,
POWER_SUPPLY_PROP_RESISTANCE,
POWER_SUPPLY_PROP_RESISTANCE_CAPACITIVE,
POWER_SUPPLY_PROP_RESISTANCE_ID, /* in Ohms */
POWER_SUPPLY_PROP_RESISTANCE_NOW,
POWER_SUPPLY_PROP_FLASH_CURRENT_MAX,
POWER_SUPPLY_PROP_UPDATE_NOW,
POWER_SUPPLY_PROP_ESR_COUNT,
POWER_SUPPLY_PROP_BUCK_FREQ,
POWER_SUPPLY_PROP_BOOST_CURRENT,
POWER_SUPPLY_PROP_SAFETY_TIMER_ENABLE,
POWER_SUPPLY_PROP_CHARGE_DONE,
POWER_SUPPLY_PROP_FLASH_ACTIVE,
POWER_SUPPLY_PROP_FLASH_TRIGGER,
POWER_SUPPLY_PROP_FORCE_TLIM,
POWER_SUPPLY_PROP_DP_DM,
POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED,
POWER_SUPPLY_PROP_INPUT_CURRENT_NOW,
POWER_SUPPLY_PROP_CHARGE_QNOVO_ENABLE,
POWER_SUPPLY_PROP_CURRENT_QNOVO,
POWER_SUPPLY_PROP_VOLTAGE_QNOVO,
POWER_SUPPLY_PROP_RERUN_AICL,
POWER_SUPPLY_PROP_CYCLE_COUNT_ID,
POWER_SUPPLY_PROP_SAFETY_TIMER_EXPIRED,
POWER_SUPPLY_PROP_RESTRICTED_CHARGING,
POWER_SUPPLY_PROP_CURRENT_CAPABILITY,
POWER_SUPPLY_PROP_TYPEC_MODE,
POWER_SUPPLY_PROP_TYPEC_CC_ORIENTATION, /* 0: N/C, 1: CC1, 2: CC2 */
POWER_SUPPLY_PROP_TYPEC_POWER_ROLE,
POWER_SUPPLY_PROP_TYPEC_SRC_RP,
POWER_SUPPLY_PROP_PD_ALLOWED,
POWER_SUPPLY_PROP_PD_ACTIVE,
POWER_SUPPLY_PROP_PD_IN_HARD_RESET,
POWER_SUPPLY_PROP_PD_CURRENT_MAX,
POWER_SUPPLY_PROP_PD_USB_SUSPEND_SUPPORTED,
POWER_SUPPLY_PROP_CHARGER_TEMP,
POWER_SUPPLY_PROP_CHARGER_TEMP_MAX,
POWER_SUPPLY_PROP_PARALLEL_DISABLE,
POWER_SUPPLY_PROP_PE_START,
POWER_SUPPLY_PROP_SOC_REPORTING_READY,
POWER_SUPPLY_PROP_DEBUG_BATTERY,
POWER_SUPPLY_PROP_FCC_DELTA,
POWER_SUPPLY_PROP_ICL_REDUCTION,
POWER_SUPPLY_PROP_PARALLEL_MODE,
POWER_SUPPLY_PROP_DIE_HEALTH,
POWER_SUPPLY_PROP_CONNECTOR_HEALTH,
POWER_SUPPLY_PROP_CTM_CURRENT_MAX,
POWER_SUPPLY_PROP_HW_CURRENT_MAX,
POWER_SUPPLY_PROP_PR_SWAP,
POWER_SUPPLY_PROP_CC_STEP,
POWER_SUPPLY_PROP_CC_STEP_SEL,
POWER_SUPPLY_PROP_SW_JEITA_ENABLED,
POWER_SUPPLY_PROP_PD_VOLTAGE_MAX,
POWER_SUPPLY_PROP_PD_VOLTAGE_MIN,
POWER_SUPPLY_PROP_SDP_CURRENT_MAX,
POWER_SUPPLY_PROP_CONNECTOR_TYPE,
POWER_SUPPLY_PROP_PARALLEL_BATFET_MODE,
POWER_SUPPLY_PROP_PARALLEL_FCC_MAX,
POWER_SUPPLY_PROP_MIN_ICL,
POWER_SUPPLY_PROP_MOISTURE_DETECTED,
POWER_SUPPLY_PROP_BATT_PROFILE_VERSION,
POWER_SUPPLY_PROP_BATT_FULL_CURRENT,
POWER_SUPPLY_PROP_RECHARGE_SOC,
POWER_SUPPLY_PROP_HVDCP_OPTI_ALLOWED,
POWER_SUPPLY_PROP_SMB_EN_MODE,
POWER_SUPPLY_PROP_SMB_EN_REASON,
POWER_SUPPLY_PROP_ESR_ACTUAL,
POWER_SUPPLY_PROP_ESR_NOMINAL,
POWER_SUPPLY_PROP_SOH,
POWER_SUPPLY_PROP_CLEAR_SOH,
POWER_SUPPLY_PROP_FORCE_RECHARGE,
POWER_SUPPLY_PROP_FCC_STEPPER_ENABLE,
POWER_SUPPLY_PROP_TOGGLE_STAT,
POWER_SUPPLY_PROP_MAIN_FCC_MAX,
POWER_SUPPLY_PROP_FG_RESET,
POWER_SUPPLY_PROP_QC_OPTI_DISABLE,
POWER_SUPPLY_PROP_CC_SOC,
POWER_SUPPLY_PROP_BATT_AGE_LEVEL,
POWER_SUPPLY_PROP_SCALE_MODE_EN,
POWER_SUPPLY_PROP_VOLTAGE_VPH,
POWER_SUPPLY_PROP_CHIP_VERSION,
POWER_SUPPLY_PROP_THERM_ICL_LIMIT,
POWER_SUPPLY_PROP_DC_RESET,
POWER_SUPPLY_PROP_VOLTAGE_MAX_LIMIT,
POWER_SUPPLY_PROP_REAL_CAPACITY,
POWER_SUPPLY_PROP_FORCE_MAIN_ICL,
POWER_SUPPLY_PROP_FORCE_MAIN_FCC,
POWER_SUPPLY_PROP_COMP_CLAMP_LEVEL,
POWER_SUPPLY_PROP_ADAPTER_CC_MODE,
POWER_SUPPLY_PROP_SKIN_HEALTH,
POWER_SUPPLY_PROP_CHARGE_DISABLE,
POWER_SUPPLY_PROP_ADAPTER_DETAILS,
POWER_SUPPLY_PROP_DEAD_BATTERY,
POWER_SUPPLY_PROP_VOLTAGE_FIFO,
POWER_SUPPLY_PROP_CC_UAH,
POWER_SUPPLY_PROP_OPERATING_FREQ,
POWER_SUPPLY_PROP_AICL_DELAY,
POWER_SUPPLY_PROP_AICL_ICL,
POWER_SUPPLY_PROP_CUTOFF_SOC,
POWER_SUPPLY_PROP_SYS_SOC,
POWER_SUPPLY_PROP_BATT_SOC,
/* Capacity Estimation */
POWER_SUPPLY_PROP_BATT_CE_CTRL,
POWER_SUPPLY_PROP_CHARGE_FULL_ESTIMATE,
/* Resistance Estimaton */
POWER_SUPPLY_PROP_RESISTANCE_AVG,
POWER_SUPPLY_PROP_RES_FILTER_COUNT,
POWER_SUPPLY_PROP_AICL_DONE,
POWER_SUPPLY_PROP_VOLTAGE_STEP,
POWER_SUPPLY_PROP_OTG_FASTROLESWAP,
POWER_SUPPLY_PROP_APSD_RERUN,
POWER_SUPPLY_PROP_APSD_TIMEOUT,
/* Charge pump properties */
POWER_SUPPLY_PROP_CP_STATUS1,
POWER_SUPPLY_PROP_CP_STATUS2,
POWER_SUPPLY_PROP_CP_ENABLE,
POWER_SUPPLY_PROP_CP_SWITCHER_EN,
POWER_SUPPLY_PROP_CP_DIE_TEMP,
POWER_SUPPLY_PROP_CP_ISNS,
POWER_SUPPLY_PROP_CP_ISNS_SLAVE,
POWER_SUPPLY_PROP_CP_TOGGLE_SWITCHER,
POWER_SUPPLY_PROP_CP_IRQ_STATUS,
POWER_SUPPLY_PROP_CP_ILIM,
POWER_SUPPLY_PROP_IRQ_STATUS,
POWER_SUPPLY_PROP_PARALLEL_OUTPUT_MODE,
POWER_SUPPLY_PROP_ALIGNMENT,
/* Local extensions of type int64_t */
POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT,
POWER_SUPPLY_PROP_CHARGE_CHARGER_STATE,
/* Properties of type `const char *' */
POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_PTMC_ID,
POWER_SUPPLY_PROP_MANUFACTURER,
POWER_SUPPLY_PROP_BATTERY_TYPE,
POWER_SUPPLY_PROP_CYCLE_COUNTS,
/*
* Add local extensions for properties with string values between
* MODEL_NAME and SERIAL_NUMBER. Don't add below SERIAL_NUMBER.
*/
POWER_SUPPLY_PROP_SERIAL_NUMBER,
};
@ -416,17 +169,6 @@ enum power_supply_type {
POWER_SUPPLY_TYPE_USB_PD, /* Power Delivery Port */
POWER_SUPPLY_TYPE_USB_PD_DRP, /* PD Dual Role Port */
POWER_SUPPLY_TYPE_APPLE_BRICK_ID, /* Apple Charging Method */
POWER_SUPPLY_TYPE_USB_HVDCP, /* High Voltage DCP */
POWER_SUPPLY_TYPE_USB_HVDCP_3, /* Efficient High Voltage DCP */
POWER_SUPPLY_TYPE_USB_HVDCP_3P5, /* Efficient High Voltage DCP */
POWER_SUPPLY_TYPE_WIRELESS, /* Accessory Charger Adapters */
POWER_SUPPLY_TYPE_USB_FLOAT, /* Floating charger */
POWER_SUPPLY_TYPE_BMS, /* Battery Monitor System */
POWER_SUPPLY_TYPE_PARALLEL, /* Parallel Path */
POWER_SUPPLY_TYPE_MAIN, /* Main Path */
POWER_SUPPLY_TYPE_UFP, /* Type-C UFP */
POWER_SUPPLY_TYPE_DFP, /* Type-C DFP */
POWER_SUPPLY_TYPE_CHARGE_PUMP, /* Charge Pump */
};
enum power_supply_usb_type {
@ -442,45 +184,6 @@ enum power_supply_usb_type {
POWER_SUPPLY_USB_TYPE_APPLE_BRICK_ID, /* Apple Charging Method */
};
/* Indicates USB Type-C CC connection status */
enum power_supply_typec_mode {
POWER_SUPPLY_TYPEC_NONE,
/* Acting as source */
POWER_SUPPLY_TYPEC_SINK, /* Rd only */
POWER_SUPPLY_TYPEC_SINK_POWERED_CABLE, /* Rd/Ra */
POWER_SUPPLY_TYPEC_SINK_DEBUG_ACCESSORY,/* Rd/Rd */
POWER_SUPPLY_TYPEC_SINK_AUDIO_ADAPTER, /* Ra/Ra */
POWER_SUPPLY_TYPEC_POWERED_CABLE_ONLY, /* Ra only */
/* Acting as sink */
POWER_SUPPLY_TYPEC_SOURCE_DEFAULT, /* Rp default */
POWER_SUPPLY_TYPEC_SOURCE_MEDIUM, /* Rp 1.5A */
POWER_SUPPLY_TYPEC_SOURCE_HIGH, /* Rp 3A */
POWER_SUPPLY_TYPEC_DAM_DEFAULT, /* Rp-1.5A/Rp-3A */
POWER_SUPPLY_TYPEC_DAM_MEDIUM, /* Rp-Default/Rp-1.5A */
POWER_SUPPLY_TYPEC_DAM_HIGH, /* Rp-Default/Rp-3A */
/* Non Compliant */
POWER_SUPPLY_TYPEC_NON_COMPLIANT,
POWER_SUPPLY_TYPEC_RP_STD_STD, /* Rp-Default/Rp-Default */
POWER_SUPPLY_TYPEC_RP_MED_MED, /* Rp-1.5A/Rp-1.5A */
POWER_SUPPLY_TYPEC_RP_HIGH_HIGH, /* Rp-3A/Rp-3A */
};
enum power_supply_typec_src_rp {
POWER_SUPPLY_TYPEC_SRC_RP_STD,
POWER_SUPPLY_TYPEC_SRC_RP_1P5A,
POWER_SUPPLY_TYPEC_SRC_RP_3A
};
enum power_supply_typec_power_role {
POWER_SUPPLY_TYPEC_PR_NONE, /* CC lines in high-Z */
POWER_SUPPLY_TYPEC_PR_DUAL,
POWER_SUPPLY_TYPEC_PR_SINK,
POWER_SUPPLY_TYPEC_PR_SOURCE,
};
enum power_supply_notifier_events {
PSY_EVENT_PROP_CHANGED,
};
@ -488,7 +191,6 @@ enum power_supply_notifier_events {
union power_supply_propval {
int intval;
const char *strval;
int64_t int64val;
};
struct device_node;

View File

@ -824,7 +824,6 @@ static inline bool usb_device_no_sg_constraint(struct usb_device *udev)
/* for drivers using iso endpoints */
extern int usb_get_current_frame_number(struct usb_device *usb_dev);
extern int usb_get_controller_id(struct usb_device *dev);
/* Sets up a group of bulk endpoints to support multiple stream IDs. */
extern int usb_alloc_streams(struct usb_interface *interface,

View File

@ -118,7 +118,6 @@ struct usb_os_desc_table {
/**
* struct usb_function - describes one function of a configuration
* @name: For diagnostics, identifies the function.
* @intf_id: Interface ID
* @strings: tables of strings, keyed by identifiers assigned during bind()
* and by language IDs provided in control requests
* @fs_descriptors: Table of full (or low) speed descriptors, using interface and
@ -164,13 +163,6 @@ struct usb_os_desc_table {
* GetStatus() request when the recipient is Interface.
* @func_suspend: callback to be called when
* SetFeature(FUNCTION_SUSPEND) is reseived
* @func_is_suspended: Tells whether the function is currently in
* Function Suspend state (used in Super Speed mode only).
* @func_wakeup_allowed: Tells whether Function Remote Wakeup has been allowed
* by the USB host (used in Super Speed mode only).
* @func_wakeup_pending: Marks that the function has issued a Function Wakeup
* while the USB bus was suspended and therefore a Function Wakeup
* notification needs to be sent once the USB bus is resumed.
*
* A single USB function uses one or more interfaces, and should in most
* cases support operation at both full and high speeds. Each function is
@ -198,7 +190,6 @@ struct usb_os_desc_table {
struct usb_function {
const char *name;
int intf_id;
struct usb_gadget_strings **strings;
struct usb_descriptor_header **fs_descriptors;
struct usb_descriptor_header **hs_descriptors;
@ -242,9 +233,6 @@ struct usb_function {
int (*get_status)(struct usb_function *);
int (*func_suspend)(struct usb_function *,
u8 suspend_opt);
unsigned func_is_suspended:1;
unsigned func_wakeup_allowed:1;
unsigned func_wakeup_pending:1;
/* private: */
/* internals */
struct list_head list;
@ -260,9 +248,6 @@ int usb_function_deactivate(struct usb_function *);
int usb_function_activate(struct usb_function *);
int usb_interface_id(struct usb_configuration *, struct usb_function *);
int usb_func_wakeup(struct usb_function *func);
int usb_get_func_interface_id(struct usb_function *func);
int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f,
struct usb_ep *_ep);

View File

@ -184,11 +184,6 @@ struct usb_ep_caps {
.dir_out = !!(_dir & USB_EP_CAPS_DIR_OUT), \
}
enum ep_type {
EP_TYPE_NORMAL = 0,
EP_TYPE_GSI,
};
/**
* struct usb_ep - device side representation of USB endpoint
* @name:identifier for the endpoint, such as "ep-a" or "ep9in-bulk"
@ -214,11 +209,6 @@ enum ep_type {
* enabled and remains valid until the endpoint is disabled.
* @comp_desc: In case of SuperSpeed support, this is the endpoint companion
* descriptor that is used to configure the endpoint
* @ep_type: Used to specify type of EP eg. normal vs h/w accelerated.
* @ep_num: Used EP number
* @ep_intr_num: Interrupter number for EP.
* @endless: In case where endless transfer is being initiated, this is set
* to disable usb event interrupt for few events.
*
* the bus controller driver lists all the general purpose endpoints in
* gadget->ep_list. the control endpoint (gadget->ep0) is not in that list,
@ -242,10 +232,6 @@ struct usb_ep {
u8 address;
const struct usb_endpoint_descriptor *desc;
const struct usb_ss_ep_comp_descriptor *comp_desc;
enum ep_type ep_type;
u8 ep_num;
u8 ep_intr_num;
bool endless;
};
/*-------------------------------------------------------------------------*/
@ -314,7 +300,6 @@ struct usb_udc;
struct usb_gadget_ops {
int (*get_frame)(struct usb_gadget *);
int (*wakeup)(struct usb_gadget *);
int (*func_wakeup)(struct usb_gadget *g, int interface_id);
int (*set_selfpowered) (struct usb_gadget *, int is_selfpowered);
int (*vbus_session) (struct usb_gadget *, int is_active);
int (*vbus_draw) (struct usb_gadget *, unsigned mA);
@ -567,7 +552,6 @@ static inline int gadget_is_otg(struct usb_gadget *g)
#if IS_ENABLED(CONFIG_USB_GADGET)
int usb_gadget_frame_number(struct usb_gadget *gadget);
int usb_gadget_wakeup(struct usb_gadget *gadget);
int usb_gadget_func_wakeup(struct usb_gadget *gadget, int interface_id);
int usb_gadget_set_selfpowered(struct usb_gadget *gadget);
int usb_gadget_clear_selfpowered(struct usb_gadget *gadget);
int usb_gadget_vbus_connect(struct usb_gadget *gadget);
@ -582,8 +566,6 @@ static inline int usb_gadget_frame_number(struct usb_gadget *gadget)
{ return 0; }
static inline int usb_gadget_wakeup(struct usb_gadget *gadget)
{ return 0; }
static int usb_gadget_func_wakeup(struct usb_gadget *gadget, int interface_id)
{ return 0; }
static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget)
{ return 0; }
static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
@ -822,11 +804,6 @@ int usb_otg_descriptor_init(struct usb_gadget *gadget,
struct usb_descriptor_header *otg_desc);
/*-------------------------------------------------------------------------*/
int usb_func_ep_queue(struct usb_function *func, struct usb_ep *ep,
struct usb_request *req, gfp_t gfp_flags);
/*-------------------------------------------------------------------------*/
/* utility to simplify map/unmap of usb_requests to/from DMA */
#ifdef CONFIG_HAS_DMA
@ -906,8 +883,5 @@ extern struct usb_ep *usb_ep_autoconfig_ss(struct usb_gadget *,
extern void usb_ep_autoconfig_release(struct usb_ep *);
extern void usb_ep_autoconfig_reset(struct usb_gadget *);
extern struct usb_ep *usb_ep_autoconfig_by_name(struct usb_gadget *gadget,
struct usb_endpoint_descriptor *desc,
const char *ep_name);
#endif /* __LINUX_USB_GADGET_H */

View File

@ -406,7 +406,6 @@ struct hc_driver {
int (*find_raw_port_number)(struct usb_hcd *, int);
/* Call for power on/off the port if necessary */
int (*port_power)(struct usb_hcd *hcd, int portnum, bool enable);
int (*get_core_id)(struct usb_hcd *hcd);
};
@ -446,7 +445,6 @@ extern int usb_hcd_alloc_bandwidth(struct usb_device *udev,
struct usb_host_interface *old_alt,
struct usb_host_interface *new_alt);
extern int usb_hcd_get_frame_number(struct usb_device *udev);
extern int usb_hcd_get_controller_id(struct usb_device *udev);
struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver,
struct device *sysdev, struct device *dev, const char *bus_name,

View File

@ -68,30 +68,6 @@
#define INCFS_IOC_PERMIT_FILL \
_IOW(INCFS_IOCTL_BASE_CODE, 33, struct incfs_permit_fill)
/*
* Fills buffer with ranges of populated blocks
*
* Returns 0 if all ranges written
* error otherwise
*
* Either way, range_buffer_size_out is set to the number
* of bytes written. Should be set to 0 by caller. The ranges
* filled are valid, but if an error was returned there might
* be more ranges to come.
*
* Ranges are ranges of filled blocks:
*
* 1 2 7 9
*
* means blocks 1, 2, 7, 8, 9 are filled, 0, 3, 4, 5, 6 and 10 on
* are not
*
* If hashing is enabled for the file, the hash blocks are simply
* treated as though they immediately followed the data blocks.
*/
#define INCFS_IOC_GET_FILLED_BLOCKS \
_IOR(INCFS_IOCTL_BASE_CODE, 34, struct incfs_get_filled_blocks_args)
enum incfs_compression_alg {
COMPRESSION_NONE = 0,
COMPRESSION_LZ4 = 1
@ -289,43 +265,4 @@ struct incfs_get_file_sig_args {
__u32 file_signature_len_out;
};
struct incfs_filled_range {
__u32 begin;
__u32 end;
};
/*
* Request ranges of filled blocks
* Argument for INCFS_IOC_GET_FILLED_BLOCKS
*/
struct incfs_get_filled_blocks_args {
/*
* A buffer to populate with ranges of filled blocks
*
* Equivalent to struct incfs_filled_ranges *range_buffer
*/
__aligned_u64 range_buffer;
/* Size of range_buffer */
__u32 range_buffer_size;
/* Start index to read from */
__u32 start_index;
/*
* End index to read to. 0 means read to end. This is a range,
* so incfs will read from start_index to end_index - 1
*/
__u32 end_index;
/* Actual number of blocks in file */
__u32 total_blocks_out;
/* Number of bytes written to range buffer */
__u32 range_buffer_size_out;
/* Sector scanned up to, if the call was interrupted */
__u32 index_out;
};
#endif /* _UAPI_LINUX_INCREMENTALFS_H */

View File

@ -45,67 +45,8 @@ static int convert_prio(int prio)
return cpupri;
}
static inline int __cpupri_find(struct cpupri *cp, struct task_struct *p,
struct cpumask *lowest_mask, int idx)
{
struct cpupri_vec *vec = &cp->pri_to_cpu[idx];
int skip = 0;
if (!atomic_read(&(vec)->count))
skip = 1;
/*
* When looking at the vector, we need to read the counter,
* do a memory barrier, then read the mask.
*
* Note: This is still all racey, but we can deal with it.
* Ideally, we only want to look at masks that are set.
*
* If a mask is not set, then the only thing wrong is that we
* did a little more work than necessary.
*
* If we read a zero count but the mask is set, because of the
* memory barriers, that can only happen when the highest prio
* task for a run queue has left the run queue, in which case,
* it will be followed by a pull. If the task we are processing
* fails to find a proper place to go, that pull request will
* pull this task if the run queue is running at a lower
* priority.
*/
smp_rmb();
/* Need to do the rmb for every iteration */
if (skip)
return 0;
if (cpumask_any_and(&p->cpus_allowed, vec->mask) >= nr_cpu_ids)
return 0;
if (lowest_mask) {
cpumask_and(lowest_mask, &p->cpus_allowed, vec->mask);
/*
* We have to ensure that we have at least one bit
* still set in the array, since the map could have
* been concurrently emptied between the first and
* second reads of vec->mask. If we hit this
* condition, simply act as though we never hit this
* priority level and continue on.
*/
if (cpumask_empty(lowest_mask))
return 0;
}
return 1;
}
int cpupri_find(struct cpupri *cp, struct task_struct *p,
struct cpumask *lowest_mask)
{
return cpupri_find_fitness(cp, p, lowest_mask, NULL);
}
/**
* cpupri_find_fitness - find the best (lowest-pri) CPU in the system
* cpupri_find - find the best (lowest-pri) CPU in the system
* @cp: The cpupri context
* @p: The task
* @lowest_mask: A mask to fill in with selected CPUs (or NULL)
@ -121,59 +62,84 @@ int cpupri_find(struct cpupri *cp, struct task_struct *p,
*
* Return: (int)bool - CPUs were found
*/
int cpupri_find_fitness(struct cpupri *cp, struct task_struct *p,
int cpupri_find(struct cpupri *cp, struct task_struct *p,
struct cpumask *lowest_mask,
bool (*fitness_fn)(struct task_struct *p, int cpu))
{
int idx = 0;
int task_pri = convert_prio(p->prio);
int idx, cpu;
BUG_ON(task_pri >= CPUPRI_NR_PRIORITIES);
for (idx = 0; idx < task_pri; idx++) {
struct cpupri_vec *vec = &cp->pri_to_cpu[idx];
int skip = 0;
if (!__cpupri_find(cp, p, lowest_mask, idx))
continue;
if (!lowest_mask || !fitness_fn)
return 1;
/* Ensure the capacity of the CPUs fit the task */
for_each_cpu(cpu, lowest_mask) {
if (!fitness_fn(p, cpu))
cpumask_clear_cpu(cpu, lowest_mask);
}
if (!atomic_read(&(vec)->count))
skip = 1;
/*
* If no CPU at the current priority can fit the task
* continue looking
* When looking at the vector, we need to read the counter,
* do a memory barrier, then read the mask.
*
* Note: This is still all racey, but we can deal with it.
* Ideally, we only want to look at masks that are set.
*
* If a mask is not set, then the only thing wrong is that we
* did a little more work than necessary.
*
* If we read a zero count but the mask is set, because of the
* memory barriers, that can only happen when the highest prio
* task for a run queue has left the run queue, in which case,
* it will be followed by a pull. If the task we are processing
* fails to find a proper place to go, that pull request will
* pull this task if the run queue is running at a lower
* priority.
*/
if (cpumask_empty(lowest_mask))
smp_rmb();
/* Need to do the rmb for every iteration */
if (skip)
continue;
if (cpumask_any_and(&p->cpus_allowed, vec->mask) >= nr_cpu_ids)
continue;
if (lowest_mask) {
int cpu;
cpumask_and(lowest_mask, &p->cpus_allowed, vec->mask);
/*
* We have to ensure that we have at least one bit
* still set in the array, since the map could have
* been concurrently emptied between the first and
* second reads of vec->mask. If we hit this
* condition, simply act as though we never hit this
* priority level and continue on.
*/
if (cpumask_empty(lowest_mask))
continue;
if (!fitness_fn)
return 1;
/* Ensure the capacity of the CPUs fit the task */
for_each_cpu(cpu, lowest_mask) {
if (!fitness_fn(p, cpu))
cpumask_clear_cpu(cpu, lowest_mask);
}
/*
* If no CPU at the current priority can fit the task
* continue looking
*/
if (cpumask_empty(lowest_mask))
continue;
}
return 1;
}
/*
* If we failed to find a fitting lowest_mask, kick off a new search
* but without taking into account any fitness criteria this time.
*
* This rule favours honouring priority over fitting the task in the
* correct CPU (Capacity Awareness being the only user now).
* The idea is that if a higher priority task can run, then it should
* run even if this ends up being on unfitting CPU.
*
* The cost of this trade-off is not entirely clear and will probably
* be good for some workloads and bad for others.
*
* The main idea here is that if some CPUs were overcommitted, we try
* to spread which is what the scheduler traditionally did. Sys admins
* must do proper RT planning to avoid overloading the system if they
* really care.
*/
if (fitness_fn)
return cpupri_find(cp, p, lowest_mask);
return 0;
}

View File

@ -19,10 +19,8 @@ struct cpupri {
#ifdef CONFIG_SMP
int cpupri_find(struct cpupri *cp, struct task_struct *p,
struct cpumask *lowest_mask);
int cpupri_find_fitness(struct cpupri *cp, struct task_struct *p,
struct cpumask *lowest_mask,
bool (*fitness_fn)(struct task_struct *p, int cpu));
struct cpumask *lowest_mask,
bool (*fitness_fn)(struct task_struct *p, int cpu));
void cpupri_set(struct cpupri *cp, int cpu, int pri);
int cpupri_init(struct cpupri *cp);
void cpupri_cleanup(struct cpupri *cp);

View File

@ -1478,13 +1478,6 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags,
if (test || !rt_task_fits_capacity(p, cpu)) {
int target = find_lowest_rq(p);
/*
* Bail out if we were forcing a migration to find a better
* fitting CPU but our search failed.
*/
if (!test && target != -1 && !rt_task_fits_capacity(p, target))
goto out_unlock;
/*
* Don't bother moving it if the destination CPU is
* not running a lower priority task.
@ -1493,8 +1486,6 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags,
p->prio < cpu_rq(target)->rt.highest_prio.curr)
cpu = target;
}
out_unlock:
rcu_read_unlock();
out:
@ -1508,7 +1499,7 @@ static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
* let's hope p can move out.
*/
if (rq->curr->nr_cpus_allowed == 1 ||
!cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
!cpupri_find(&rq->rd->cpupri, rq->curr, NULL, NULL))
return;
/*
@ -1516,7 +1507,7 @@ static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
* see if it is pushed or pulled somewhere else.
*/
if (p->nr_cpus_allowed != 1 &&
cpupri_find(&rq->rd->cpupri, p, NULL))
cpupri_find(&rq->rd->cpupri, p, NULL, NULL))
return;
/*
@ -1671,7 +1662,8 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p)
static int pick_rt_task(struct rq *rq, struct task_struct *p, int cpu)
{
if (!task_running(rq, p) &&
cpumask_test_cpu(cpu, &p->cpus_allowed))
cpumask_test_cpu(cpu, &p->cpus_allowed) &&
rt_task_fits_capacity(p, cpu))
return 1;
return 0;
@ -1705,7 +1697,6 @@ static int find_lowest_rq(struct task_struct *task)
struct cpumask *lowest_mask = this_cpu_cpumask_var_ptr(local_cpu_mask);
int this_cpu = smp_processor_id();
int cpu = task_cpu(task);
int ret;
/* Make sure the mask is initialized first */
if (unlikely(!lowest_mask))
@ -1714,22 +1705,8 @@ static int find_lowest_rq(struct task_struct *task)
if (task->nr_cpus_allowed == 1)
return -1; /* No other targets possible */
/*
* If we're on asym system ensure we consider the different capacities
* of the CPUs when searching for the lowest_mask.
*/
if (static_branch_unlikely(&sched_asym_cpucapacity)) {
ret = cpupri_find_fitness(&task_rq(task)->rd->cpupri,
task, lowest_mask,
rt_task_fits_capacity);
} else {
ret = cpupri_find(&task_rq(task)->rd->cpupri,
task, lowest_mask);
}
if (!ret)
if (!cpupri_find(&task_rq(task)->rd->cpupri, task, lowest_mask,
rt_task_fits_capacity))
return -1; /* No targets found */
/*
@ -2242,7 +2219,7 @@ static void task_woken_rt(struct rq *rq, struct task_struct *p)
(rq->curr->nr_cpus_allowed < 2 ||
rq->curr->prio <= p->prio);
if (need_to_push)
if (need_to_push || !rt_task_fits_capacity(p, cpu_of(rq)))
push_rt_tasks(rq);
}
@ -2314,7 +2291,10 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)
*/
if (task_on_rq_queued(p) && rq->curr != p) {
#ifdef CONFIG_SMP
if (p->nr_cpus_allowed > 1 && rq->rt.overloaded)
bool need_to_push = rq->rt.overloaded ||
!rt_task_fits_capacity(p, cpu_of(rq));
if (p->nr_cpus_allowed > 1 && need_to_push)
rt_queue_push_tasks(rq);
#endif /* CONFIG_SMP */
if (p->prio < rq->curr->prio && cpu_online(cpu_of(rq)))

View File

@ -2099,347 +2099,6 @@ failure:
return TEST_FAILURE;
}
static int emit_partial_test_file_data(char *mount_dir, struct test_file *file)
{
int i, j;
int block_cnt = 1 + (file->size - 1) / INCFS_DATA_FILE_BLOCK_SIZE;
int *block_indexes = NULL;
int result = 0;
int blocks_written = 0;
if (file->size == 0)
return 0;
/* Emit 2 blocks, skip 2 blocks etc*/
block_indexes = calloc(block_cnt, sizeof(*block_indexes));
for (i = 0, j = 0; i < block_cnt; ++i)
if ((i & 2) == 0) {
block_indexes[j] = i;
++j;
}
for (i = 0; i < j; i += blocks_written) {
blocks_written = emit_test_blocks(mount_dir, file,
block_indexes + i, j - i);
if (blocks_written < 0) {
result = blocks_written;
goto out;
}
if (blocks_written == 0) {
result = -EIO;
goto out;
}
}
out:
free(block_indexes);
return result;
}
static int validate_ranges(const char *mount_dir, struct test_file *file)
{
int block_cnt = 1 + (file->size - 1) / INCFS_DATA_FILE_BLOCK_SIZE;
char *filename = concat_file_name(mount_dir, file->name);
int fd;
struct incfs_filled_range ranges[128];
struct incfs_get_filled_blocks_args fba = {
.range_buffer = ptr_to_u64(ranges),
.range_buffer_size = sizeof(ranges),
};
int error = TEST_SUCCESS;
int i;
int range_cnt;
fd = open(filename, O_RDONLY);
free(filename);
if (fd <= 0)
return TEST_FAILURE;
error = ioctl(fd, INCFS_IOC_GET_FILLED_BLOCKS, &fba);
if (error && errno != ERANGE)
goto out;
if (error && errno == ERANGE && block_cnt < 509)
goto out;
if (!error && block_cnt >= 509) {
error = -ERANGE;
goto out;
}
if (fba.total_blocks_out != block_cnt) {
error = -EINVAL;
goto out;
}
range_cnt = (block_cnt + 3) / 4;
if (range_cnt > 128)
range_cnt = 128;
if (range_cnt != fba.range_buffer_size_out / sizeof(*ranges)) {
error = -ERANGE;
goto out;
}
error = TEST_SUCCESS;
for (i = 0; i < fba.range_buffer_size_out / sizeof(*ranges) - 1; ++i)
if (ranges[i].begin != i * 4 || ranges[i].end != i * 4 + 2) {
error = -EINVAL;
goto out;
}
if (ranges[i].begin != i * 4 ||
(ranges[i].end != i * 4 + 1 && ranges[i].end != i * 4 + 2)) {
error = -EINVAL;
goto out;
}
for (i = 0; i < 64; ++i) {
fba.start_index = i * 2;
fba.end_index = i * 2 + 2;
error = ioctl(fd, INCFS_IOC_GET_FILLED_BLOCKS, &fba);
if (error)
goto out;
if (fba.total_blocks_out != block_cnt) {
error = -EINVAL;
goto out;
}
if (fba.start_index >= block_cnt) {
if (fba.index_out != fba.start_index) {
printf("Paul: %d, %d\n", (int)fba.index_out,
(int)fba.start_index);
error = -EINVAL;
goto out;
}
break;
}
if (i % 2) {
if (fba.range_buffer_size_out != 0) {
error = -EINVAL;
goto out;
}
} else {
if (fba.range_buffer_size_out != sizeof(*ranges)) {
error = -EINVAL;
goto out;
}
if (ranges[0].begin != i * 2) {
error = -EINVAL;
goto out;
}
if (ranges[0].end != i * 2 + 1 &&
ranges[0].end != i * 2 + 2) {
error = -EINVAL;
goto out;
}
}
}
out:
close(fd);
return error;
}
static int get_blocks_test(char *mount_dir)
{
char *backing_dir;
int cmd_fd = -1;
int i;
struct test_files_set test = get_test_files_set();
const int file_num = test.files_count;
backing_dir = create_backing_dir(mount_dir);
if (!backing_dir)
goto failure;
if (mount_fs_opt(mount_dir, backing_dir, "readahead=0") != 0)
goto failure;
cmd_fd = open_commands_file(mount_dir);
if (cmd_fd < 0)
goto failure;
/* Write data. */
for (i = 0; i < file_num; i++) {
struct test_file *file = &test.files[i];
if (emit_file(cmd_fd, NULL, file->name, &file->id, file->size,
NULL))
goto failure;
if (emit_partial_test_file_data(mount_dir, file))
goto failure;
}
for (i = 0; i < file_num; i++) {
struct test_file *file = &test.files[i];
if (validate_ranges(mount_dir, file))
goto failure;
/*
* The smallest files are filled completely, so this checks that
* the fast get_filled_blocks path is not causing issues
*/
if (validate_ranges(mount_dir, file))
goto failure;
}
close(cmd_fd);
umount(mount_dir);
free(backing_dir);
return TEST_SUCCESS;
failure:
close(cmd_fd);
umount(mount_dir);
free(backing_dir);
return TEST_FAILURE;
}
static int emit_partial_test_file_hash(char *mount_dir, struct test_file *file)
{
int err;
int fd;
struct incfs_fill_blocks fill_blocks = {
.count = 1,
};
struct incfs_fill_block *fill_block_array =
calloc(fill_blocks.count, sizeof(struct incfs_fill_block));
uint8_t data[INCFS_DATA_FILE_BLOCK_SIZE];
if (file->size <= 4096 / 32 * 4096)
return 0;
if (fill_blocks.count == 0)
return 0;
if (!fill_block_array)
return -ENOMEM;
fill_blocks.fill_blocks = ptr_to_u64(fill_block_array);
rnd_buf(data, sizeof(data), 0);
fill_block_array[0] =
(struct incfs_fill_block){ .block_index = 1,
.data_len =
INCFS_DATA_FILE_BLOCK_SIZE,
.data = ptr_to_u64(data),
.flags = INCFS_BLOCK_FLAGS_HASH };
fd = open_file_by_id(mount_dir, file->id, true);
if (fd < 0) {
err = errno;
goto failure;
}
err = ioctl(fd, INCFS_IOC_FILL_BLOCKS, &fill_blocks);
close(fd);
if (err < fill_blocks.count)
err = errno;
else
err = 0;
failure:
free(fill_block_array);
return err;
}
static int validate_hash_ranges(const char *mount_dir, struct test_file *file)
{
char *filename = concat_file_name(mount_dir, file->name);
int fd;
struct incfs_filled_range ranges[128];
struct incfs_get_filled_blocks_args fba = {
.range_buffer = ptr_to_u64(ranges),
.range_buffer_size = sizeof(ranges),
};
int error = TEST_SUCCESS;
int file_blocks = (file->size + INCFS_DATA_FILE_BLOCK_SIZE - 1) /
INCFS_DATA_FILE_BLOCK_SIZE;
if (file->size <= 4096 / 32 * 4096)
return 0;
fd = open(filename, O_RDONLY);
free(filename);
if (fd <= 0)
return TEST_FAILURE;
error = ioctl(fd, INCFS_IOC_GET_FILLED_BLOCKS, &fba);
if (error)
goto out;
if (fba.range_buffer_size_out != sizeof(struct incfs_filled_range)) {
error = -EINVAL;
goto out;
}
if (ranges[0].begin != file_blocks + 1 ||
ranges[0].end != file_blocks + 2) {
error = -EINVAL;
goto out;
}
out:
close(fd);
return error;
}
static int get_hash_blocks_test(char *mount_dir)
{
char *backing_dir;
int cmd_fd = -1;
int i;
struct test_files_set test = get_test_files_set();
const int file_num = test.files_count;
backing_dir = create_backing_dir(mount_dir);
if (!backing_dir)
goto failure;
if (mount_fs_opt(mount_dir, backing_dir, "readahead=0") != 0)
goto failure;
cmd_fd = open_commands_file(mount_dir);
if (cmd_fd < 0)
goto failure;
for (i = 0; i < file_num; i++) {
struct test_file *file = &test.files[i];
if (crypto_emit_file(cmd_fd, NULL, file->name, &file->id,
file->size, file->root_hash,
file->sig.add_data))
goto failure;
if (emit_partial_test_file_hash(mount_dir, file))
goto failure;
}
for (i = 0; i < file_num; i++) {
struct test_file *file = &test.files[i];
if (validate_hash_ranges(mount_dir, file))
goto failure;
}
close(cmd_fd);
umount(mount_dir);
free(backing_dir);
return TEST_SUCCESS;
failure:
close(cmd_fd);
umount(mount_dir);
free(backing_dir);
return TEST_FAILURE;
}
static char *setup_mount_dir()
{
struct stat st;
@ -2507,8 +2166,6 @@ int main(int argc, char *argv[])
MAKE_TEST(multiple_providers_test),
MAKE_TEST(hash_tree_test),
MAKE_TEST(read_log_test),
MAKE_TEST(get_blocks_test),
MAKE_TEST(get_hash_blocks_test),
};
#undef MAKE_TEST