Merge "usb: bam: Remove inactivity_timer sysfs attribute"

This commit is contained in:
Linux Build Service Account 2017-07-03 07:57:54 -07:00 committed by Gerrit - the friendly Code Review server
commit 6944c59d4b

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -3100,79 +3100,6 @@ static int enable_usb_bam(struct platform_device *pdev)
return 0;
}
static ssize_t
usb_bam_show_inactivity_timer(struct device *dev, struct device_attribute *attr,
char *buf)
{
char *buff = buf;
int i;
for (i = 0; i < ARRAY_SIZE(bam_enable_strings); i++) {
buff += snprintf(buff, PAGE_SIZE, "%s: %dms\n",
bam_enable_strings[i],
msm_usb_bam[i].inactivity_timer_ms);
}
return buff - buf;
}
static ssize_t usb_bam_store_inactivity_timer(struct device *dev,
struct device_attribute *attr,
const char *buff, size_t count)
{
char buf[USB_BAM_MAX_STR_LEN];
char *trimmed_buf, *bam_str, *bam_name, *timer;
int timer_d;
int bam;
if (strnstr(buff, "help", USB_BAM_MAX_STR_LEN)) {
pr_info("Usage: <bam_name> <ms>,<bam_name> <ms>,...\n");
pr_info("\tbam_name: [%s, %s, %s]\n",
bam_enable_strings[DWC3_CTRL],
bam_enable_strings[CI_CTRL],
bam_enable_strings[HSIC_CTRL]);
pr_info("\tms: time in ms. Use 0 to disable timer\n");
return count;
}
strlcpy(buf, buff, sizeof(buf));
trimmed_buf = strim(buf);
while (trimmed_buf) {
bam_str = strsep(&trimmed_buf, ",");
if (bam_str) {
bam_name = strsep(&bam_str, " ");
bam = get_bam_type_from_core_name(bam_name);
if (bam < 0 || bam >= MAX_BAMS) {
log_event_err("%s: Invalid bam, type=%d ,name=%s\n",
__func__, bam, bam_name);
return -EINVAL;
}
timer = strsep(&bam_str, " ");
if (!timer)
continue;
sscanf(timer, "%d", &timer_d);
/* Apply new timer setting if bam has running pipes */
if (msm_usb_bam[bam].inactivity_timer_ms != timer_d) {
msm_usb_bam[bam].inactivity_timer_ms = timer_d;
if (msm_usb_bam[bam].pipes_enabled_per_bam > 0
&& !info[bam].in_lpm)
usb_bam_set_inactivity_timer(bam);
}
}
}
return count;
}
static DEVICE_ATTR(inactivity_timer, S_IWUSR | S_IRUSR,
usb_bam_show_inactivity_timer,
usb_bam_store_inactivity_timer);
static int usb_bam_panic_notifier(struct notifier_block *this,
unsigned long event, void *ptr)
{
@ -3221,12 +3148,6 @@ static int usb_bam_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "usb_bam_probe\n");
ret = device_create_file(&pdev->dev, &dev_attr_inactivity_timer);
if (ret) {
dev_err(&pdev->dev, "failed to create fs node\n");
return ret;
}
io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!io_res) {
dev_err(&pdev->dev, "missing BAM memory resource\n");