Re: [PATCH v2] staging: atomisp: move null check to earlier point

2020-07-31 Thread Andy Shevchenko
On Fri, Jul 31, 2020 at 01:17:38AM +0300, Cengiz Can wrote:
> `find_gmin_subdev` function that returns a pointer to `struct

func() are referred with name followed by parentheses.

> gmin_subdev` can return NULL.

> In `gmin_v2p8_ctrl` there's a call to this function but the possibility
> of a NULL was not checked before its being dereferenced. ie:

'. ie:' -> ', i.e.:'

> ```

Instead just shift right by two spaces.

> /* Acquired here v */
> struct gmin_subdev *gs = find_gmin_subdev(subdev);
> 
> /*  v--Dereferenced here */
> if (gs->v2p8_gpio >= 0) {
> ...
> }

> ```

Drop this as per above comment.

> To avoid the issue, null check has been moved to an earlier point
> and return semantics has been changed to reflect this exception.

> Please do note that this change introduces a new return value to
> `gmin_v2p8_ctrl`.

This rather should explain better the semantics change, e.g.
"Now the function() refuses to take NULL argument and returns an error. We also
WARN() for sake of the debugging."

> [NEW] - raise a WARN and return -ENODEV if there are no subdevices.
>   - return result of `gpio_request` or `gpio_direction_output`.
>   - return 0 if GPIO is ON.
>   - return results of `regulator_enable` or `regulator_disable`.
>   - according to PMIC type, return result of `axp_regulator_set`
> or `gmin_i2c_write`.
>   - return -EINVAL if unknown PMIC type.

This has to go after cutter '---' line below.

> Caught-by: Coverity Static Analyzer CID 1465536

Reported-by:

And as discussed previously,
Suggested-by: Mauro ...

> Signed-off-by: Cengiz Can 

The code looks good enough (WARN() will probably go away when driver gains
better quality).

-- 
With Best Regards,
Andy Shevchenko


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/3] usb: gadget: udc: Avoid tasklet passing a global

2020-07-31 Thread Felipe Balbi
Hi,

Kees Cook  writes:
> There's no reason for the tasklet callback to set an argument since it
> always uses a global. Instead, use the global directly, in preparation
> for converting the tasklet subsystem to modern callback conventions.
>
> Signed-off-by: Kees Cook 

looks okay to me.

Acked-by: Felipe Balbi 

-- 
balbi


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v7] drivers: most: add USB adapter driver

2020-07-31 Thread Greg KH
On Fri, Jul 31, 2020 at 02:20:58PM +0200, Christian Gromm wrote:
> This patch adds the USB driver source file most_usb.c and
> modifies the Makefile and Kconfig accordingly.
> 
> Signed-off-by: Christian Gromm 
> ---
> v2:
> Reported-by: Greg Kroah-Hartman 
> - don't remove usb driver from staging area
> - don't touch staging/most/Kconfig
> - remove subdirectory for USB driver and put source file into
>   drivers/most
> v3:
> - submitted fixes found during code audit to staging version
>   first to be able to resend single patch that adds the driver
> v4:
> Reported-by: Dan Carpenter 
> 
> submitted patch set that fixes issues found during code audit
> to staging version first to be able to resend single patch that
> adds the driver. The patch series included:
> 
> - use function sysfs_streq
> - add missing put_device calls
> - use correct error codes
> - replace code to calculate array index
> - don't use error path to exit function on success
> - move allocation of URB out of critical section
> - return 0 instead of variable
> - change return value of function drci_rd_reg
> - don't use expressions that might fail in a declaration
> - change order of function parameters
> 
> v5:
> Reported-by: Dan Carpenter 
> 
> submitted patch set that fixes issues found during code audit
> to staging version first to be able to resend single patch that
> adds the driver. The patch series included:
> 
> - init return value in default path of switch/case expression
> 
> v6:
> Reported-by: Randy Dunlap 
> 
>   remove dependency to NET in Kconfig file
> 
> v7:
> Reported-by: Greg Kroah-Hartman 
> 
>   created patch with 'git format-patch -M' to show that this is
>   a move only.
>  
>  drivers/most/Kconfig| 11 +++
>  drivers/most/Makefile   |  2 ++
>  drivers/{staging/most/usb/usb.c => most/most_usb.c} |  0
>  drivers/staging/most/Kconfig|  2 --
>  drivers/staging/most/usb/Kconfig| 13 -
>  drivers/staging/most/usb/Makefile   |  4 
>  6 files changed, 13 insertions(+), 19 deletions(-)
>  rename drivers/{staging/most/usb/usb.c => most/most_usb.c} (100%)
>  delete mode 100644 drivers/staging/most/usb/Kconfig
>  delete mode 100644 drivers/staging/most/usb/Makefile

Thanks, this worked, now queued up!

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] sched: Provide USF for the portable equipment.

2020-07-31 Thread Dongdong Yang
From: Dongdong Yang 

The power consumption and UI response are more cared for by the portable
equipment users. USF(User Sensitive Feedback factor) auxiliary cpufreq
governor is providing more utils adjustment settings to the high level
by scenario identification.

From the view of portable equipment, screen off status usually stands
for no request from the user, however, the kernel is still expected to
notify the user in time on modem, network or powerkey events occur. In
some scenarios, such as listening to music, low power processors, such
as DSP, take more actions and CPU load requirements cut down.  It would
bring more power consumption benefit if high level have interfaces to
adjust utils according to the current scenario and load.

In addition, the portable equipment user usually heavily interact with
devices by touch, and other peripherals. The boost preemptive counts
are marking the load requirement urgent, vice versa. If such feedback
factor could be set to high level according to the scenario, it would
contribute to the power consumption and UI response.

If no USF sysfs inode is set, and no screen on or off event,
adjust_task_pred_demand shall not be invoked. Once sched_usf_up_l0_r
sched_usf_down_r or sched_usf_non_ux_r be set, adjust_task_pred_demand
shall be called back to update settings according to high level
scenario identification.

We can get about 17% mean power consumption save at listening to music
with speaker on "screen off" scenario, as below statistical data from
7766 XiaoMi devices for two weeks with sched_usf_non_ux_r be set:

day1 day2 day3 day4
count   7766.00  7766.00  7766.00  7766.00
mean88.03552585.50028283.82930586.054997
std 111.049980   108.258834   107.562583   108.558240
min 0.099000 0.037000 0.067000 0.045000
25% 34.76550034.02175034.10150034.423000
50% 54.9555.28650054.18950054.248500
75% 95.95400093.94200091.73800094.0592500
80% 114.675000   107.43   106.378000   108.673000
85% 137.851000   129.511000   127.156500   131.750750
90% 179.669000   170.208500   164.027000   172.348000
95% 272.395000   257.845500   247.750500   263.275750
98% 399.034500   412.170400   391.484000   402.835600

day5 day6day7 day8
count   7766.00  7766.0  7766.00  7766.00
mean82.53267779.2192377.61138081.075081
std 104.870079   101.34819   103.140037   97.506221
min 0.051000 0.02900 0.007000 0.068000
25% 32.87300033.4440031.96550033.863500
50% 52.18050051.5655050.80650053.08
75% 90.90575086.8262583.85925089.973000
80% 105.455000   99.6470097.271000104.225000
85% 128.30   118.47825   116.570250   126.648250
90% 166.647500   149.18000   150.649500   161.087000
95% 247.208500   224.36050   226.38   245.291250
98% 393.002000   347.92060   369.791800   378.778600

day9 day10day11day12
count   7766.00  7766.00  7766.00  7766.00
mean79.98917083.85941778.03293077.060542
std 104.226122   108.893043   102.561715   99.844276
min 0.118000 0.017000 0.028000 0.039000
25% 32.05625033.45450031.17625030.897750
50% 51.50600054.05600048.96950049.069000
75% 88.51350092.95350083.50675084.096000
80% 102.876000   107.845000   97.71700098.073000
85% 124.363000   128.288000   118.366500   116.869250
90% 160.557000   167.084000   154.342500   148.187500
95% 231.149000   242.925750   236.759000   228.131250
98% 367.206600   388.619100   385.269100   376.541600

day13day14
count   7766.00  7766.00
mean75.52803673.702878
std 90.75059486.796016
min 0.066000 0.054000
25% 31.17050031.608500
50% 48.75850049.215000
75% 84.52275083.053000
80% 97.87900094.875000
85% 116.680250   113.573750
90% 149.083500   144.089500
95% 226.177750   211.488750
98% 347.011100   331.317100

Signed-off-by: Dongdong Yang 
Co-developed-by: Jun Tao 
Co-developed-by: Qiwu Huang 
Co-developed-by: Geliang Tang 
Co-developed-by: Peng Wang 
---
 drivers/staging/Kconfig  |   2 +
 drivers/staging/Makefile |   1 +
 drivers/staging/fbsched/Kconfig  |  10 ++
 drivers/staging/fbsched/Makefile |   2 +
 drivers/staging/fbsched/usf.c| 346 +++
 kernel/sched/cpufreq_schedutil.c |   3 +
 kernel/sched/sched.h |  10 ++
 7 files changed, 374 insertions(+)
 create mode 100644 drivers/staging/fbsched/Kconfig
 create mode 100644 drivers/staging/fbsched/Makefile
 create mode 100644 drivers/staging/fbsched/usf.c

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 4ec5528..05b231e 100644
--- a/drivers/staging/Kconf

[PATCH v2] Provide USF for the portable equipment.

2020-07-31 Thread Dongdong Yang
From: Dongdong Yang 

This patch provides USF(User Sensitive Feedback factor) auxiliary
cpufreq governor to support high level layer sysfs inodes setting
for utils adjustment purpose from the identified scenario on portable
equipment. Because the power consumption and UI response are more cared
for by portable equipment users. And the "screen off" status stands for
no request from the user, however, the kernel is still expected to
notify the user in time on modem, network or powerkey events occur. USF
provides "sched_usf_non_ux_r" sysfs inode to cut down the utils from
user space tasks according to high level scenario. In addition, it
usually hints more cpufreq demand that the preemptive counts of the
tasks on the cpu burst and over the user expecting completed time such
as the ratio sysctl_sched_latency to sysctl_sched_min_granularity on
"screen on" status, which more likely with more UI. The sysfs inodes
"sched_usf_up_l0_r" and "sched_usf_down_r" have been provided to adjust
the utils according to high level identified scenario to alloc the
cpufreq in time.

Changes in v2
  - Add adjust_task_pred_set switch.
  - Move adjust_task_pred_demand declaration into sched.h
  - Update comments.

Dongdong Yang (1):
  sched: Provide USF for the portable equipment.

 drivers/staging/Kconfig  |   2 +
 drivers/staging/Makefile |   1 +
 drivers/staging/fbsched/Kconfig  |  10 ++
 drivers/staging/fbsched/Makefile |   2 +
 drivers/staging/fbsched/usf.c| 346 +++
 kernel/sched/cpufreq_schedutil.c |   3 +
 kernel/sched/sched.h |  10 ++
 7 files changed, 374 insertions(+)
 create mode 100644 drivers/staging/fbsched/Kconfig
 create mode 100644 drivers/staging/fbsched/Makefile
 create mode 100644 drivers/staging/fbsched/usf.c

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] sched: Provide USF for the portable equipment.

2020-07-31 Thread Greg KH
On Fri, Jul 31, 2020 at 08:46:30PM +0800, Dongdong Yang wrote:
>  drivers/staging/Kconfig  |   2 +
>  drivers/staging/Makefile |   1 +
>  drivers/staging/fbsched/Kconfig  |  10 ++
>  drivers/staging/fbsched/Makefile |   2 +
>  drivers/staging/fbsched/usf.c| 346 
> +++
>  kernel/sched/cpufreq_schedutil.c |   3 +
>  kernel/sched/sched.h |  10 ++
>  7 files changed, 374 insertions(+)
>  create mode 100644 drivers/staging/fbsched/Kconfig
>  create mode 100644 drivers/staging/fbsched/Makefile
>  create mode 100644 drivers/staging/fbsched/usf.c

I asked for a TODO file, like all other staging drivers have, why did
you not include one here?

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] sched: Provide USF for the portable equipment.

2020-07-31 Thread Greg KH
On Fri, Jul 31, 2020 at 08:46:30PM +0800, Dongdong Yang wrote:
> --- /dev/null
> +++ b/drivers/staging/fbsched/usf.c
> @@ -0,0 +1,346 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2020 XiaoMi Inc.
> + * Author: Yang Dongdong 
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> + * See http://www.gnu.org/licenses/gpl-2.0.html for more details.

Please remove the license "boilerplate" text as you have the SPDX line
on top.

> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define BOOST_MIN_V -100
> +#define BOOST_MAX_V 100
> +#define LEVEL_TOP 3
> +
> +#define USF_TAG  "[usf_sched]"
> +
> +DEFINE_PER_CPU(unsigned long[PID_MAX_LIMIT], task_hist_nivcsw);
> +
> +static struct {
> + bool is_sched_usf_enabled;
> + int enable_debug;
> + int is_screen_on;
> + struct kobject *kobj;

A raw kobject?  For a driver?  are you _SURE_???

> + struct dentry *debugfs_entry;

Why do you need this?

> + usf_vdev.enable_debug = 0;
> + usf_vdev.debugfs_entry = debugfs_create_file("usf_dbg",
> +  0660, NULL, NULL,
> +  &usf_dbg_fops);
> + if (!usf_vdev.debugfs_entry)
> + pr_err("Failed to create usf_dbg!\n");

How can that value be NULL?

There is no need to check debugfs functions for error values.

But in this case, why are you writing a single file to the root of
debugfs?  Why not put it in a directory instead?  That would be much
nicer, don't you think?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] sched: Provide USF for the portable equipment.

2020-07-31 Thread Greg KH
On Fri, Jul 31, 2020 at 08:46:30PM +0800, Dongdong Yang wrote:
> +static ssize_t store_sched_usf_up_l0_r(struct kobject *kobj,
> +struct kobj_attribute *attr,
> +const char *buf, size_t count)
> +{
> + int val = 0;
> + int ret;
> +
> + ret = kstrtoint(buf, 0, &val);
> + if (ret) {
> + pr_err(USF_TAG "set state fail ret=%d\n", ret);
> + return ret;
> + }
> +
> + if ((val >= 0) && (val <= BOOST_MAX_V)) {
> + usf_vdev.sysctl_sched_usf_up_l0 = val;
> + usf_vdev.usf_up_l0 = LEVEL_TOP -
> + DIV_ROUND_UP(val, BOOST_MAX_V / 2);
> + } else {
> + pr_err(USF_TAG "%d should fall into [%d %d]",
> +val, 0, BOOST_MAX_V);
> + }
> + if ((usf_vdev.sysctl_sched_usf_up_l0 == 0) &&
> + (usf_vdev.sysctl_sched_usf_down == 0))
> + static_branch_disable(&adjust_task_pred_set);
> + else
> + static_branch_enable(&adjust_task_pred_set);
> +
> + return count;
> +}
> +
> +static ssize_t store_sched_usf_down_r(struct kobject *kobj,
> +   struct kobj_attribute *attr,
> +   const char *buf, size_t count)
> +{
> + int val = 0;
> + int ret;
> +
> + ret = kstrtoint(buf, 0, &val);
> + if (ret) {
> + pr_err(USF_TAG "set state fail ret=%d\n", ret);
> + return ret;
> + }
> +
> + if ((val >= BOOST_MIN_V) && (val <= 0)) {
> + usf_vdev.sysctl_sched_usf_down = val;
> + usf_vdev.usf_down = DIV_ROUND_UP(-val, -BOOST_MIN_V / 2);
> + } else {
> + pr_err(USF_TAG "%d should fall into [%d %d]",
> +val, BOOST_MIN_V, 0);
> + }
> + if ((usf_vdev.sysctl_sched_usf_up_l0 == 0) &&
> + (usf_vdev.sysctl_sched_usf_down == 0))
> + static_branch_disable(&adjust_task_pred_set);
> + else
> + static_branch_enable(&adjust_task_pred_set);
> +
> + return count;
> +}
> +
> +static ssize_t store_sched_usf_non_ux_r(struct kobject *kobj,
> + struct kobj_attribute *attr,
> + const char *buf, size_t count)
> +{
> + int val = 0;
> + int ret;
> +
> + ret = kstrtoint(buf, 0, &val);
> + if (ret) {
> + pr_err(USF_TAG "set state fail ret=%d\n", ret);
> + return ret;
> + }
> +
> + if ((val >= BOOST_MIN_V) && (val <= 0)) {
> + usf_vdev.sysctl_sched_usf_non_ux = val;
> + usf_vdev.usf_non_ux = DIV_ROUND_UP(-val, -BOOST_MIN_V / 2);
> + } else {
> + pr_err(USF_TAG "%d should fall into [%d %d]",
> +val, BOOST_MIN_V, 0);
> + }
> + if (usf_vdev.sysctl_sched_usf_non_ux == 0)
> + static_branch_disable(&adjust_task_pred_set);
> + else
> + static_branch_enable(&adjust_task_pred_set);
> +
> + return count;
> +}
> +
> +#define usf_attr_rw(_name)   \
> +static struct kobj_attribute _name = \
> +__ATTR(_name, 0664, show_##_name, store_##_name)

You have a lot of sysfs files here, but no documentation for them at
all, why not?

> +
> +#define usf_show_node(_name, _value) \
> +static ssize_t show_##_name  \
> +(struct kobject *kobj, struct kobj_attribute *attr,  char *buf)  
> \
> +{\
> + unsigned int len = 0;   \
> + unsigned int max_len = 8;   \
> + len +=  \
> + snprintf(buf + len, max_len - len, "%d",\
> +  usf_vdev.sysctl_##_value); \
> + return len; \
> +}
> +
> +usf_show_node(sched_usf_up_l0_r, sched_usf_up_l0);
> +usf_show_node(sched_usf_down_r, sched_usf_down);
> +usf_show_node(sched_usf_non_ux_r, sched_usf_non_ux);
> +
> +usf_attr_rw(sched_usf_up_l0_r);
> +usf_attr_rw(sched_usf_down_r);
> +usf_attr_rw(sched_usf_non_ux_r);
> +
> +static struct attribute *sched_attrs[] = {
> + &sched_usf_up_l0_r.attr,
> + &sched_usf_down_r.attr,
> + &sched_usf_non_ux_r.attr,
> + NULL,
> +};
> +
> +static struct attribute_group sched_attr_group = {
> + .attrs = sched_attrs,
> +};
> +
> +static int usf_dbg_get(void *data, u64 *val)
> +{
> + *val = (u64)usf_vdev.enable_debug;
> +
> + return 0;
> +}
> +
> +static int usf_dbg_set(void *data, u64 val)
> +{
> + usf_vdev.enable_debug = !!val;
> + return 0;
> +}
> +
> +DEFINE_SIMPLE_ATTRIBUTE(usf_dbg_fops, usf_dbg_get,
> + usf_dbg_set, "%llu\n");
> +
>

Re: [PATCH v9 08/12] device core: Introduce DMA range map, supplanting dma_pfn_offset

2020-07-31 Thread Rob Herring
On Thu, Jul 30, 2020 at 10:44 AM Jim Quinlan  wrote:
>
> On Wed, Jul 29, 2020 at 10:28 AM Rob Herring  wrote:
> >
> > On Wed, Jul 29, 2020 at 12:19 AM Christoph Hellwig  wrote:
> > >
> > > On Tue, Jul 28, 2020 at 02:24:51PM -0400, Jim Quinlan wrote:
> > > > I started using devm_kcalloc() but at least two reviewers convinced me
> > > > to just use kcalloc().  In addition, when I was using devm_kcalloc()
> > > > it was awkward because 'dev' is not available to this function.
> > > >
> > > > It comes down to whether unbind/binding the device N times is actually
> > > > a reasonable usage.  As for my experience I've seen two cases: (1) my
> > > > overnight "bind/unbind the PCIe RC driver" script, and we have a
> > > > customer who does an unbind/bind as a hail mary to bring back life to
> > > > their dead EP device.  If the latter case happens repeatedly, there
> > > > are bigger problems.
> > >
> > > We can't just leak the allocations.  Do you have a pointer to the
> > > arguments against managed resources?  I'm generally not a huge fan
> > > of the managed resources, but for a case like this they actually seem
> > > useful.  If we don't use the managed resources we'll at leat need
> > > to explicitly free the resources when freeing the device.
> >
> > The lifetime for devm_kcalloc may not be what we want here. devm
> > allocs are freed on probe fail or remove, not on freeing the device
> > (there is a just in case free there too though).
>
> What do you suggest doing as an alternative?

I believe I gave it already. Put a kfree in the struct device release
function. But you can't be passing the pointer from device to device
if you go that route. You'd have to either copy the struct or check if
it's the same as the parent's and skip the kfree in that case.

Rob
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] sched: Provide USF for the portable equipment.

2020-07-31 Thread Dietmar Eggemann
On 31/07/2020 14:46, Dongdong Yang wrote:
> From: Dongdong Yang 

[...]

> + if (unlikely(usf_vdev.enable_debug))
> + trace_printk
> + ("%s: cpu_id=%d non_ux=%d usf_up=%d usf_down=%d util=%lu\n",
> +  USF_TAG, cpuid, usf_vdev.usf_non_ux,
> +  usf_vdev.usf_up_l0, usf_vdev.usf_down, *util);

trace_printk in code ?

> +static int usf_lcd_notifier(struct notifier_block *nb,
> + unsigned long val, void *data)
> +{
> + struct fb_event *evdata = data;
> + unsigned int blank;
> +
> + if (!evdata)
> + return 0;
> +
> + if (val != FB_EVENT_BLANK)
> + return 0;
> +
> + if (evdata->data && val == FB_EVENT_BLANK) {
> + blank = *(int *)(evdata->data);
> +
> + switch (blank) {
> + case FB_BLANK_POWERDOWN:
> + usf_vdev.is_screen_on = 0;
> + if (usf_vdev.sysctl_sched_usf_non_ux != 0)
> + static_branch_enable(&adjust_task_pred_set);
> + else
> + static_branch_disable(&adjust_task_pred_set);
> +
> + break;
> +
> + case FB_BLANK_UNBLANK:
> + usf_vdev.is_screen_on = 1;
> + if (usf_vdev.sysctl_sched_usf_up_l0 != 0 ||
> + usf_vdev.sysctl_sched_usf_down != 0)
> + static_branch_enable(&adjust_task_pred_set);
> + else
> + static_branch_disable(&adjust_task_pred_set);
> + break;
> + default:
> + break;
> + }
> +
> + usf_vdev.is_sched_usf_enabled = 1;
> + if (usf_vdev.enable_debug)
> + trace_printk("%s : usf_vdev.is_screen_on:%d\n",
> +  __func__, usf_vdev.is_screen_on);
> + }
> + return NOTIFY_OK;
> +}
> +
> +static struct notifier_block usf_lcd_nb = {
> + .notifier_call = usf_lcd_notifier,
> + .priority = INT_MAX,
> +};

Looks like those notifications should enable/disable the schedutil
extension adjust_task_pred_demand(). Who's calling them?

The 3 sched_usf_FOO sys files somehow have an influence here too. How
should this work?

I see a fb_register_client() in intera_monitor_init further below.

[...]

> +usf_attr_rw(sched_usf_up_l0_r);
> +usf_attr_rw(sched_usf_down_r);
> +usf_attr_rw(sched_usf_non_ux_r);

What can I do with these three files? What do they stand for?

root@h620:/sys/devices/system/cpu/sched_usf# ls
sched_usf_down_r  sched_usf_non_ux_r  sched_usf_up_l0_r

[...]

> +static int __init intera_monitor_init(void)
> +{
> + int res = -1;
> + struct attribute_group *attr_group;
> +
> + res = fb_register_client(&usf_lcd_nb);
> + if (res < 0) {
> + pr_err("Failed to register usf_lcd_nb!\n");
> + return res;

[...]
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v7] drivers: most: add USB adapter driver

2020-07-31 Thread Christian Gromm
This patch adds the USB driver source file most_usb.c and
modifies the Makefile and Kconfig accordingly.

Signed-off-by: Christian Gromm 
---
v2:
Reported-by: Greg Kroah-Hartman 
- don't remove usb driver from staging area
- don't touch staging/most/Kconfig
- remove subdirectory for USB driver and put source file into
  drivers/most
v3:
- submitted fixes found during code audit to staging version
  first to be able to resend single patch that adds the driver
v4:
Reported-by: Dan Carpenter 

submitted patch set that fixes issues found during code audit
to staging version first to be able to resend single patch that
adds the driver. The patch series included:

- use function sysfs_streq
- add missing put_device calls
- use correct error codes
- replace code to calculate array index
- don't use error path to exit function on success
- move allocation of URB out of critical section
- return 0 instead of variable
- change return value of function drci_rd_reg
- don't use expressions that might fail in a declaration
- change order of function parameters

v5:
Reported-by: Dan Carpenter 

submitted patch set that fixes issues found during code audit
to staging version first to be able to resend single patch that
adds the driver. The patch series included:

- init return value in default path of switch/case expression

v6:
Reported-by: Randy Dunlap 

remove dependency to NET in Kconfig file

v7:
Reported-by: Greg Kroah-Hartman 

created patch with 'git format-patch -M' to show that this is
a move only.
 
 drivers/most/Kconfig| 11 +++
 drivers/most/Makefile   |  2 ++
 drivers/{staging/most/usb/usb.c => most/most_usb.c} |  0
 drivers/staging/most/Kconfig|  2 --
 drivers/staging/most/usb/Kconfig| 13 -
 drivers/staging/most/usb/Makefile   |  4 
 6 files changed, 13 insertions(+), 19 deletions(-)
 rename drivers/{staging/most/usb/usb.c => most/most_usb.c} (100%)
 delete mode 100644 drivers/staging/most/usb/Kconfig
 delete mode 100644 drivers/staging/most/usb/Makefile

diff --git a/drivers/most/Kconfig b/drivers/most/Kconfig
index 58d7999..60fc082 100644
--- a/drivers/most/Kconfig
+++ b/drivers/most/Kconfig
@@ -13,3 +13,14 @@ menuconfig MOST
  module will be called most_core.
 
  If in doubt, say N here.
+
+if MOST
+config MOST_USB_HDM
+   tristate "USB"
+   depends on USB
+   help
+ Say Y here if you want to connect via USB to network transceiver.
+
+ To compile this driver as a module, choose M here: the
+ module will be called most_usb.
+endif
diff --git a/drivers/most/Makefile b/drivers/most/Makefile
index e810cd3..6a3cb90 100644
--- a/drivers/most/Makefile
+++ b/drivers/most/Makefile
@@ -2,3 +2,5 @@
 obj-$(CONFIG_MOST) += most_core.o
 most_core-y := core.o \
configfs.o
+
+obj-$(CONFIG_MOST_USB_HDM) += most_usb.o
diff --git a/drivers/staging/most/usb/usb.c b/drivers/most/most_usb.c
similarity index 100%
rename from drivers/staging/most/usb/usb.c
rename to drivers/most/most_usb.c
diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index c5a99f7..c35fb34f 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -30,6 +30,4 @@ source "drivers/staging/most/dim2/Kconfig"
 
 source "drivers/staging/most/i2c/Kconfig"
 
-source "drivers/staging/most/usb/Kconfig"
-
 endif
diff --git a/drivers/staging/most/usb/Kconfig b/drivers/staging/most/usb/Kconfig
deleted file mode 100644
index a47a973..000
--- a/drivers/staging/most/usb/Kconfig
+++ /dev/null
@@ -1,13 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# MOST USB configuration
-#
-
-config MOST_USB
-   tristate "USB"
-   depends on USB
-   help
- Say Y here if you want to connect via USB to network transceiver.
-
- To compile this driver as a module, choose M here: the
- module will be called most_usb.
diff --git a/drivers/staging/most/usb/Makefile 
b/drivers/staging/most/usb/Makefile
deleted file mode 100644
index c2b2073..000
--- a/drivers/staging/most/usb/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_MOST_USB) += most_usb.o
-
-most_usb-objs := usb.o
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v7] drivers: most: add USB adapter driver

2020-07-31 Thread Christian Gromm
This patch adds the USB driver source file most_usb.c and
modifies the Makefile and Kconfig accordingly.

Signed-off-by: Christian Gromm 
---
v2:
Reported-by: Greg Kroah-Hartman 
- don't remove usb driver from staging area
- don't touch staging/most/Kconfig
- remove subdirectory for USB driver and put source file into
  drivers/most
v3:
- submitted fixes found during code audit to staging version
  first to be able to resend single patch that adds the driver
v4:
Reported-by: Dan Carpenter 

submitted patch set that fixes issues found during code audit
to staging version first to be able to resend single patch that
adds the driver. The patch series included:

- use function sysfs_streq
- add missing put_device calls
- use correct error codes
- replace code to calculate array index
- don't use error path to exit function on success
- move allocation of URB out of critical section
- return 0 instead of variable
- change return value of function drci_rd_reg
- don't use expressions that might fail in a declaration
- change order of function parameters

v5:
Reported-by: Dan Carpenter 

submitted patch set that fixes issues found during code audit
to staging version first to be able to resend single patch that
adds the driver. The patch series included:

- init return value in default path of switch/case expression

v6:
Reported-by: Randy Dunlap 

remove dependency to NET in Kconfig file

v7:
Reported-by: Greg Kroah-Hartman 

created patch with 'git format-patch -M' to show that this is
a move only.
 
 drivers/most/Kconfig| 11 +++
 drivers/most/Makefile   |  2 ++
 drivers/{staging/most/usb/usb.c => most/most_usb.c} |  0
 drivers/staging/most/Kconfig|  2 --
 drivers/staging/most/usb/Kconfig| 13 -
 drivers/staging/most/usb/Makefile   |  4 
 6 files changed, 13 insertions(+), 19 deletions(-)
 rename drivers/{staging/most/usb/usb.c => most/most_usb.c} (100%)
 delete mode 100644 drivers/staging/most/usb/Kconfig
 delete mode 100644 drivers/staging/most/usb/Makefile

diff --git a/drivers/most/Kconfig b/drivers/most/Kconfig
index 58d7999..60fc082 100644
--- a/drivers/most/Kconfig
+++ b/drivers/most/Kconfig
@@ -13,3 +13,14 @@ menuconfig MOST
  module will be called most_core.
 
  If in doubt, say N here.
+
+if MOST
+config MOST_USB_HDM
+   tristate "USB"
+   depends on USB
+   help
+ Say Y here if you want to connect via USB to network transceiver.
+
+ To compile this driver as a module, choose M here: the
+ module will be called most_usb.
+endif
diff --git a/drivers/most/Makefile b/drivers/most/Makefile
index e810cd3..6a3cb90 100644
--- a/drivers/most/Makefile
+++ b/drivers/most/Makefile
@@ -2,3 +2,5 @@
 obj-$(CONFIG_MOST) += most_core.o
 most_core-y := core.o \
configfs.o
+
+obj-$(CONFIG_MOST_USB_HDM) += most_usb.o
diff --git a/drivers/staging/most/usb/usb.c b/drivers/most/most_usb.c
similarity index 100%
rename from drivers/staging/most/usb/usb.c
rename to drivers/most/most_usb.c
diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index c5a99f7..c35fb34f 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -30,6 +30,4 @@ source "drivers/staging/most/dim2/Kconfig"
 
 source "drivers/staging/most/i2c/Kconfig"
 
-source "drivers/staging/most/usb/Kconfig"
-
 endif
diff --git a/drivers/staging/most/usb/Kconfig b/drivers/staging/most/usb/Kconfig
deleted file mode 100644
index a47a973..000
--- a/drivers/staging/most/usb/Kconfig
+++ /dev/null
@@ -1,13 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# MOST USB configuration
-#
-
-config MOST_USB
-   tristate "USB"
-   depends on USB
-   help
- Say Y here if you want to connect via USB to network transceiver.
-
- To compile this driver as a module, choose M here: the
- module will be called most_usb.
diff --git a/drivers/staging/most/usb/Makefile 
b/drivers/staging/most/usb/Makefile
deleted file mode 100644
index c2b2073..000
--- a/drivers/staging/most/usb/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_MOST_USB) += most_usb.o
-
-most_usb-objs := usb.o
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] sched: Provide USF for the portable equipment.

2020-07-31 Thread peterz
On Thu, Jul 30, 2020 at 09:35:43PM +0800, Dongdong Yang wrote:
> diff --git a/kernel/sched/cpufreq_schedutil.c 
> b/kernel/sched/cpufreq_schedutil.c
> index 7fbaee2..7bc3429 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -289,12 +289,21 @@ unsigned long schedutil_cpu_util(int cpu, unsigned long 
> util_cfs,
>   return min(max, util);
>  }
>  
> +#ifdef CONFIG_SCHED_USF
> +void (*adjust_task_pred_demand)(int cpuid, unsigned long *util,
> + struct rq *rq) = NULL;
> +EXPORT_SYMBOL(adjust_task_pred_demand);
> +#endif
> +
>  static unsigned long sugov_get_util(struct sugov_cpu *sg_cpu)
>  {
>   struct rq *rq = cpu_rq(sg_cpu->cpu);
>   unsigned long util = cpu_util_cfs(rq);
>   unsigned long max = arch_scale_cpu_capacity(sg_cpu->cpu);
> -
> +#ifdef CONFIG_SCHED_USF
> + if (adjust_task_pred_demand)
> + adjust_task_pred_demand(sg_cpu->cpu, &util, rq);
> +#endif
>   sg_cpu->max = max;
>   sg_cpu->bw_dl = cpu_bw_dl(rq);

NAK
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: netlogic: clear alignment style issues

2020-07-31 Thread Tomer Samara
Clear checkpatch alignment style issues in xlr_net.c.
CHECK: Alignment should match open parenthesis

Signed-off-by: Tomer Samara 
---
 drivers/staging/netlogic/xlr_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/netlogic/xlr_net.c 
b/drivers/staging/netlogic/xlr_net.c
index 204fcdfc022f..69ea61faf8fa 100644
--- a/drivers/staging/netlogic/xlr_net.c
+++ b/drivers/staging/netlogic/xlr_net.c
@@ -355,7 +355,7 @@ static void xlr_stats(struct net_device *ndev, struct 
rtnl_link_stats64 *stats)
stats->rx_missed_errors);
 
stats->tx_aborted_errors = xlr_nae_rdreg(priv->base_addr,
-   TX_EXCESSIVE_COLLISION_PACKET_COUNTER);
+
TX_EXCESSIVE_COLLISION_PACKET_COUNTER);
stats->tx_carrier_errors = xlr_nae_rdreg(priv->base_addr,
 TX_DROP_FRAME_COUNTER);
stats->tx_fifo_errors = xlr_nae_rdreg(priv->base_addr,
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] sched: Provide USF for the portable equipment.

2020-07-31 Thread Steven Rostedt
On Fri, 31 Jul 2020 20:15:38 +0200
pet...@infradead.org wrote:

> On Thu, Jul 30, 2020 at 09:35:43PM +0800, Dongdong Yang wrote:
> > diff --git a/kernel/sched/cpufreq_schedutil.c 
> > b/kernel/sched/cpufreq_schedutil.c
> > index 7fbaee2..7bc3429 100644
> > --- a/kernel/sched/cpufreq_schedutil.c
> > +++ b/kernel/sched/cpufreq_schedutil.c
> > @@ -289,12 +289,21 @@ unsigned long schedutil_cpu_util(int cpu, unsigned 
> > long util_cfs,
> > return min(max, util);
> >  }
> >  
> > +#ifdef CONFIG_SCHED_USF
> > +void (*adjust_task_pred_demand)(int cpuid, unsigned long *util,
> > +   struct rq *rq) = NULL;
> > +EXPORT_SYMBOL(adjust_task_pred_demand);
> > +#endif
> > +
> >  static unsigned long sugov_get_util(struct sugov_cpu *sg_cpu)
> >  {
> > struct rq *rq = cpu_rq(sg_cpu->cpu);
> > unsigned long util = cpu_util_cfs(rq);
> > unsigned long max = arch_scale_cpu_capacity(sg_cpu->cpu);
> > -
> > +#ifdef CONFIG_SCHED_USF
> > +   if (adjust_task_pred_demand)
> > +   adjust_task_pred_demand(sg_cpu->cpu, &util, rq);
> > +#endif
> > sg_cpu->max = max;
> > sg_cpu->bw_dl = cpu_bw_dl(rq);  
> 
> NAK

Peter,

It's more informative if you include rational with a NAK.

-- Steve

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel