12 Apr, 2018

1 commit

  • [ Upstream commit 63f1e05f7fe9ca509c60154d6a833abf96eecdc9 ]

    df->governor is being dereferenced before it is null checked,
    hence there is a potential null pointer dereference.

    Notice that df->governor is being null checked at line 1004:
    if (df->governor) {, which implies it might be null.

    Fix this by null checking df->governor before dereferencing it.

    Addresses-Coverity-ID: 1401988 ("Dereference before null check")
    Fixes: bcf23c79c4e4 ("PM / devfreq: Fix available_governor sysfs")
    Signed-off-by: Gustavo A. R. Silva
    Reviewed-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Gustavo A. R. Silva
     

22 Feb, 2018

1 commit

  • commit d1bf2d30728f310f72296b54f0651ecdb09cbb12 upstream.

    Propagate the error of devfreq_add_device() in devm_devfreq_add_device()
    rather than statically returning ENOMEM. This makes it slightly faster
    to pinpoint the cause of a returned error.

    Fixes: 8cd84092d35e ("PM / devfreq: Add resource-managed function for devfreq device")
    Cc: stable@vger.kernel.org
    Acked-by: Chanwoo Choi
    Signed-off-by: Bjorn Andersson
    Signed-off-by: MyungJoo Ham
    Signed-off-by: Greg Kroah-Hartman

    Bjorn Andersson
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

28 Aug, 2017

4 commits

  • When the devfreq_add_device fails to register deivce, the memory
    leak of devfreq instance happen. So, this patch fix the memory
    leak issue. Before freeing the devfreq instance checks whether
    devfreq instance is NULL or not because the device_unregister()
    frees the devfreq instance when jumping to the 'err_init'.
    It is to prevent the duplicate the kfee(devfreq).

    Cc: stable@vger.kernel.org
    Fixes: ac4b281176a5 ("PM / devfreq: fix duplicated kfree on devfreq pointer")
    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • The devfreq ues the OPP library to handle the voltage and frequency
    for the device basically. This patch adds the dependency on CONFIG_PM_OPP
    in order to prevent either the build break or the unknow behavior.

    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • THe devfreq_update_stats() updates the 'struct devfreq_dev_status'
    in order to get current status of devfreq device. It is only used
    for the governors.

    This patch moves the devfreq_update_stats() into devfreq directory.

    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • Now that we have a custom printf format specifier, convert users of
    full_name to use %pOF instead. This is preparation to remove storing
    of the full path string for each node.

    Signed-off-by: Rob Herring
    Reviewed-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham
    Cc: Kyungmin Park
    Cc: linux-pm@vger.kernel.org

    Rob Herring
     

06 Jul, 2017

3 commits

  • attribute_groups are not supposed to change at runtime. All functions
    working with attribute_groups provided by work with const
    attribute_group. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    621 176 0 797 31d drivers/devfreq/governor_userspace.o

    File size After adding 'const':
    text data bss dec hex filename
    670 144 0 814 32e drivers/devfreq/governor_userspace.o

    Signed-off-by: Arvind Yadav
    Reviewed-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Arvind Yadav
     
  • platform_get_irq() returns an error code, but the tegra-devfreq
    driver ignores it and always returns -ENODEV. This is not correct,
    and prevents -EPROBE_DEFER from being propagated properly.

    Notice that platform_get_irq() no longer returns 0 on error:
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af

    Print and propagate the return value of platform_get_irq on failure.

    Reviewed-by: Chanwoo Choi
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: MyungJoo Ham

    Gustavo A. R. Silva
     
  • platform_get_irq() returns an error code, but the rk3399_dmc
    driver ignores it and always returns -EINVAL. This is not correct,
    and prevents -EPROBE_DEFER from being propagated properly.

    Notice that platform_get_irq() no longer returns 0 on error:
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af

    Print and propagate the return value of platform_get_irq on failure.

    Reviewed-by: Chanwoo Choi
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: MyungJoo Ham

    Gustavo A. R. Silva
     

12 Jun, 2017

3 commits


12 Apr, 2017

1 commit


28 Feb, 2017

1 commit

  • Fix typos and add the following to the scripts/spelling.txt:

    followings||following

    While we are here, add a missing colon in the boilerplate in DT binding
    documents. The "you SoC" in allwinner,sunxi-pinctrl.txt was fixed as
    well.

    I reworded "as the followings:" to "as follows:" for
    drivers/usb/gadget/udc/renesas_usb3.c.

    Link: http://lkml.kernel.org/r/1481573103-11329-32-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

20 Feb, 2017

1 commit

  • * pm-devfreq:
    PM / devfreq: Modify the device name as devfreq(X) for sysfs
    PM / devfreq: Simplify the sysfs name of devfreq-event device
    PM / devfreq: Remove unnecessary separate _remove_devfreq()
    PM / devfreq: Fix wrong trans_stat of passive devfreq device
    PM / devfreq: Fix available_governor sysfs
    PM / devfreq: exynos-ppmu: Show the registred device for ppmu device
    PM / devfreq: Fix the wrong description for userspace governor
    PM / devfreq: Fix the checkpatch warnings
    PM / devfreq: exynos-bus: Print the real clock rate of bus
    PM / devfreq: exynos-ppmu: Use the regmap interface to handle the registers
    PM / devfreq: exynos-bus: Add the detailed correlation for Exynos5433
    PM / devfreq: Don't delete sysfs group twice

    Rafael J. Wysocki
     

31 Jan, 2017

11 commits

  • This patch modifies the device name as devfreq(X) for sysfs by using the 'devfreq'
    prefix word instead of separate device name. On user-space aspect, user would
    find the some devfreq drvier with 'devfreq(X)' pattern. So, this patch modify the
    device name as following:
    - /sys/class/devfreq/[non-standard device name] -> /sys/class/devfreq/devfreq(X)

    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • This patch just removes '.' character from the sysfs name of devfreq-event
    device as following. Usually, the subsystem uses the similiar naming style
    such as {framework name}{Number}.
    - old : /sys/class/devfreq-event/event.(X)
    - new : /sys/class/devfreq-event/event(X)

    And this patch initializes the value of 'event_no' with -1
    in order to remove the unneeded operation (-1) when calling
    the atomic_inc_return(&event_no).

    Lastly, this patch adds the ABI document for devfreq-event class.

    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • The _remove_devfreq() releases the all resources of the devfreq
    device. This function is only called in the devfreq_dev_release().
    For that reason, the devfreq core doesn't need to leave the
    _remove_devfreq() separately. This patch releases the all
    resources in the devfreq_dev_release() and then removes the
    _remove_devfreq().

    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • Until now, the trans_stat information of passive devfreq is not updated.
    This patch updates the trans_stat information after setting the target
    frequency of passive devfreq device.

    Fixes: 996133119f57 ("PM / devfreq: Add new passive governor")
    Cc: stable@vger.kernel.org
    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • The devfreq using passive governor is not able to change the governor.
    So, the user can not change the governor through 'available_governor' sysfs
    entry. Also, the devfreq which don't use the passive governor is not able to
    change to 'passive' governor on the fly.

    Fixes: 996133119f57 ("PM / devfreq: Add new passive governor")
    Cc: stable@vger.kernel.org
    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • This patch just adds the simple log to show the PPMU device's registration
    during the kernel booting.

    Cc: Kukjin Kim
    Cc: Krzysztof Kozlowski
    Cc: Javier Martinez Canillas
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-samsung-soc@vger.kernel.org
    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • This patch fixes the wrong description of governor_userspace.c
    and removes the unneeded blank line.

    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • This patch just fixes the checkpatch warnings.

    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • This patch shows the real clock rate after calling clk_set_rate()
    to debug it.

    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • This patch uses the regmap interface to read and write the registers for exynos
    PPMU device instead of the legacy memory map functions.

    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • The 'userspace' governor adds a sysfs entry, which is removed when
    the governor is changed, or the devfreq device is released. However,
    when the latter occurs via device_unregister(), device_del() is
    called first, which removes the sysfs entries recursively and deletes
    the kobject.

    This means we get an Oops when the governor calls
    sysfs_remove_group() on the deleted kobject. Fix this by only doing
    the call when kobj *hasn't* been kobject_del()'d.

    Note that we can't just remove the call to sysfs_remove_group()
    entirely - it's needed for when the governor is changed to one which
    doesn't need a sysfs entry.

    Signed-off-by: Chris Diamand
    Reviewed-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chris Diamand
     

30 Jan, 2017

1 commit

  • This patch updates dev_pm_opp_find_freq_*() routines to get a reference
    to the OPPs returned by them.

    Also updates the users of dev_pm_opp_find_freq_*() routines to call
    dev_pm_opp_put() after they are done using the OPPs.

    As it is guaranteed the that OPPs wouldn't get freed while being used,
    the RCU read side locking present with the users isn't required anymore.
    Drop it as well.

    This patch also updates all users of devfreq_recommended_opp() which was
    returning an OPP received from the OPP core.

    Note that some of the OPP core routines have gained
    rcu_read_{lock|unlock}() calls, as those still use RCU specific APIs
    within them.

    Signed-off-by: Viresh Kumar
    Reviewed-by: Chanwoo Choi [Devfreq]
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     

27 Jan, 2017

1 commit


03 Jan, 2017

2 commits

  • This patch fixes the wrong return value. If devfreq driver requires the wrong
    and non-available governor, it is fail. So, this patch returns the error
    insead of -EPROBE_DEFER.

    Fixes: 403e0689d2a9 (PM / devfreq: exynos: Add support of bus frequency of sub-blocks using passive governor)
    Signed-off-by: Chanwoo Choi
    Signed-off-by: Rafael J. Wysocki

    Chanwoo Choi
     
  • This patch fixes the bug of devfreq_add_device(). The devfreq device must
    have the default governor. If find_devfreq_governor() returns error,
    devfreq_add_device() fail to add the devfreq instance.

    Fixes: 1b5c1be2c88e (PM / devfreq: map devfreq drivers to governor using name)
    Signed-off-by: Chanwoo Choi
    Signed-off-by: Rafael J. Wysocki

    Chanwoo Choi
     

08 Dec, 2016

3 commits


17 Nov, 2016

6 commits

  • This patch uses the resource-managed to add the devfreq device.
    This function will make it easy to handle the devfreq device.

    - struct devfreq *devm_devfreq_add_device(struct device *dev,
    struct devfreq_dev_profile *profile,
    const char *governor_name,
    void *data);

    Signed-off-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Chanwoo Choi
     
  • The function name in the comment was incorrect.

    Signed-off-by: MyungJoo Ham
    Reviewed-by: Chanwoo Choi

    MyungJoo Ham
     
  • The mutex is not used at all, remove it.

    Signed-off-by: Axel Lin
    Acked-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Axel Lin
     
  • The rest of the code uses ARRAY_SIZE to count the number of entries in
    ppmu_events array. The NULL terminated entry makes ARRAY_SIZE return
    off-by-one value.

    Signed-off-by: Axel Lin
    Acked-by: Chanwoo Choi
    Signed-off-by: MyungJoo Ham

    Axel Lin
     
  • If the driver is built as a module, autoload won't work because the module
    alias information is not filled. So user-space can't match the registered
    device with the corresponding module.

    Export the module alias information using the MODULE_DEVICE_TABLE() macro.

    Before this patch:

    $ modinfo drivers/devfreq/event/exynos-ppmu.ko | grep alias
    $

    After this patch:

    $ modinfo drivers/devfreq/event/exynos-ppmu.ko | grep alias
    alias: of:N*T*Csamsung,exynos-ppmu-v2C*
    alias: of:N*T*Csamsung,exynos-ppmu-v2
    alias: of:N*T*Csamsung,exynos-ppmuC*
    alias: of:N*T*Csamsung,exynos-ppmu

    Signed-off-by: Javier Martinez Canillas
    Signed-off-by: MyungJoo Ham

    Javier Martinez Canillas
     
  • If the driver is built as a module, autoload won't work because the module
    alias information is not filled. So user-space can't match the registered
    device with the corresponding module.

    Export the module alias information using the MODULE_DEVICE_TABLE() macro.

    Before this patch:

    $ modinfo drivers/devfreq/event/rockchip-dfi.ko | grep alias
    $

    After this patch:

    $ modinfo drivers/devfreq/event/rockchip-dfi.ko | grep alias
    alias: of:N*T*Crockchip,rk3399-dfiC*
    alias: of:N*T*Crockchip,rk3399-dfi

    Signed-off-by: Javier Martinez Canillas
    Signed-off-by: MyungJoo Ham

    Javier Martinez Canillas