17 May, 2016

24 commits

  • Add an ->apply() method to the pwm_ops struct to allow PWM drivers to
    implement atomic updates. This method is preferred over the ->enable(),
    ->disable() and ->config() methods if available.

    Add the pwm_apply_state() function to the PWM user API.

    Note that the pwm_apply_state() does not guarantee the atomicity of the
    update operation, it all depends on the availability and implementation
    of the ->apply() method.

    pwm_enable/disable/set_polarity/config() are now implemented as wrappers
    around the pwm_apply_state() function.

    pwm_adjust_config() is allowing smooth handover between the bootloader
    and the kernel. This function tries to adapt the current PWM state to
    the PWM arguments coming from a PWM lookup table or a DT definition
    without changing the duty_cycle/period proportion.

    Signed-off-by: Boris Brezillon
    [thierry.reding@gmail.com: fix a couple of typos]
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • Add a ->get_state() function to the pwm_ops struct to let PWM drivers
    initialize the PWM state attached to a PWM device.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • Prepare the transition to PWM atomic update by moving the enabled and
    disabled state into the pwm_state struct. This way we can easily update
    the whole PWM state by copying the new state in the ->state field.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • The PWM state, represented by its period, duty_cycle and polarity is
    currently directly stored in the PWM device. Declare a pwm_state
    structure embedding those field so that we can later use this struct
    to atomically update all the PWM parameters at once.

    All pwm_get_xxx() helpers are now implemented as wrappers around
    pwm_get_state().

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • Before the introduction of pwm_args, the core was resetting the PWM
    period and polarity states to the reference values (those provided
    through the DT, a PWM lookup table or hardcoded in the driver).

    Now that all PWM users are correctly using pwm_args to configure their
    PWM device, we can safely remove the pwm_apply_args() call in pwm_get()
    and of_pwm_get().

    We can also get rid of the pwm_set_period() call in pwm_apply_args(),
    because PWM users are now directly using pargs->period instead of
    pwm_get_period(). By doing that we avoid messing with the current PWM
    period.

    The only remaining bit in pwm_apply_args() is the initial polarity
    setting, and it should go away when all PWM users have been patched to
    use the atomic API (with this API the polarity will be set along with
    other PWM arguments when configuring the PWM).

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • Call pwm_apply_args() just after requesting the PWM device so that the
    polarity and period are initialized according to the information
    provided in pwm_args.

    This is an intermediate state, and pwm_apply_args() should be dropped as
    soon as the atomic PWM infrastructure is in place and the driver makes
    use of it.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • Call pwm_apply_args() just after requesting the PWM device so that the
    polarity and period are initialized according to the information
    provided in pwm_args.

    This is an intermediate state, and pwm_apply_args() should be dropped as
    soon as the atomic PWM infrastructure is in place and the driver makes
    use of it.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • Call pwm_apply_args() just after requesting the PWM device so that the
    polarity and period are initialized according to the information
    provided in pwm_args.

    This is an intermediate state, and pwm_apply_args() should be dropped as
    soon as the atomic PWM infrastructure is in place and the driver makes
    use of it.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • Call pwm_apply_args() just after requesting the PWM device so that the
    polarity and period are initialized according to the information
    provided in pwm_args.

    This is an intermediate state, and pwm_apply_args() should be dropped as
    soon as the atomic PWM infrastructure is in place and the driver makes
    use of it.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • Call pwm_apply_args() just after requesting the PWM device so that the
    polarity and period are initialized according to the information
    provided in pwm_args.

    This is an intermediate state, and pwm_apply_args() should be dropped as
    soon as the atomic PWM infrastructure is in place and the driver makes
    use of it.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • Call pwm_apply_args() just after requesting the PWM device so that the
    polarity and period are initialized according to the information
    provided in pwm_args.

    This is an intermediate state, and pwm_apply_args() should be dropped as
    soon as the atomic PWM infrastructure is in place and the driver makes
    use of it.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • The PWM framework has clarified the concept of reference PWM config (the
    platform dependent config retrieved from the DT or the PWM lookup table)
    and real PWM state.

    Use pwm_get_args() when the PWM user wants to retrieve this reference
    config and not the current state.

    This is part of the rework allowing the PWM framework to support
    hardware readout and expose real PWM state even when the PWM has just
    been requested (before the user calls pwm_config/enable/disable()).

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • The PWM framework has clarified the concept of reference PWM config (the
    platform dependent config retrieved from the DT or the PWM lookup table)
    and real PWM state.

    Use pwm_get_args() when the PWM user wants to retrieve this reference
    config and not the current state.

    This is part of the rework allowing the PWM framework to support
    hardware readout and expose real PWM state even when the PWM has just
    been requested (before the user calls pwm_config/enable/disable()).

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • The PWM framework has clarified the concept of reference PWM config (the
    platform dependent config retrieved from the DT or the PWM lookup table)
    and real PWM state.

    Use pwm_get_args() when the PWM user wants to retrieve this reference
    config and not the current state.

    This is part of the rework allowing the PWM framework to support
    hardware readout and expose real PWM state even when the PWM has just
    been requested (before the user calls pwm_config/enable/disable()).

    Signed-off-by: Boris Brezillon
    Acked-by: Mark Brown
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • The PWM framework has clarified the concept of reference PWM config (the
    platform dependent config retrieved from the DT or the PWM lookup table)
    and real PWM state.

    Use pwm_get_args() when the PWM user wants to retrieve this reference
    config and not the current state.

    This is part of the rework allowing the PWM framework to support
    hardware readout and expose real PWM state even when the PWM has just
    been requested (before the user calls pwm_config/enable/disable()).

    Signed-off-by: Boris Brezillon
    Acked-by: Jacek Anaszewski
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • The PWM framework has clarified the concept of reference PWM config (the
    platform dependent config retrieved from the DT or the PWM lookup table)
    and real PWM state.

    Use pwm_get_args() when the PWM user wants to retrieve this reference
    config and not the current state.

    This is part of the rework allowing the PWM framework to support
    hardware readout and expose real PWM state even when the PWM has just
    been requested (before the user calls pwm_config/enable/disable()).

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • The PWM framework has clarified the concept of reference PWM config (the
    platform dependent config retrieved from the DT or the PWM lookup table)
    and real PWM state.

    Use pwm_get_args() when the PWM user wants to retrieve this reference
    config and not the current state.

    This is part of the rework allowing the PWM framework to support
    hardware readout and expose real PWM state even when the PWM has just
    been requested (before the user calls pwm_config/enable/disable()).

    Signed-off-by: Boris Brezillon
    Acked-by: Kamil Debski
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • The PWM framework has clarified the concept of reference PWM config (the
    platform dependent config retrieved from the DT or the PWM lookup table)
    and real PWM state.

    Use pwm_get_args() when the PWM user wants to retrieve this reference
    config and not the current state.

    This is part of the rework allowing the PWM framework to support
    hardware readout and expose real PWM state even when the PWM has just
    been requested (before the user calls pwm_config/enable/disable()).

    Signed-off-by: Boris Brezillon
    Acked-by: Stephen Boyd
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • Use pwm_get/set_xxx() helpers instead of directly accessing the pwm->xxx
    field. Doing that will ease adaptation of the PWM framework to support
    atomic update.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • PWM devices are not protected against concurrent accesses. The lock in
    struct pwm_device might let PWM users think it is, but it's actually
    only protecting the enabled state.

    Removing this lock should be fine as long as all PWM users are aware
    that accesses to the PWM device have to be serialized, which seems to be
    the case for all of them except the sysfs interface. Patch the sysfs
    code by adding a lock to the pwm_export struct and making sure it's
    taken for all relevant accesses to the exported PWM device.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris BREZILLON
     
  • pwm->period field is not supposed to be changed by PWM users. The only
    ones authorized to change it are the PWM core and PWM drivers.

    Signed-off-by: Boris Brezillon
    Acked-by: Lee Jones
    Signed-off-by: Thierry Reding

    Boris BREZILLON
     
  • The PWM period will be set when calling pwm_config. Remove this useless
    call to pwm_set_period(), which might mess up the internal PWM state.

    Signed-off-by: Boris Brezillon
    Acked-by: Lee Jones
    Signed-off-by: Thierry Reding

    Boris BREZILLON
     
  • Commit 5c31252c4a86 ("pwm: Add the pwm_is_enabled() helper") introduced
    a new function to test whether a PWM device is enabled or not without
    manipulating PWM internal fields.

    Hiding this is necessary if we want to smoothly move to the atomic PWM
    config approach without impacting PWM drivers. Fix this driver to use
    pwm_is_enabled() instead of directly accessing the ->flags field.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris BREZILLON
     
  • pwm_apply_args() is supposed to initialize a PWM device according to the
    arguments provided by the DT or the PWM lookup, but this function was
    called inside pwm_device_request(), which in turn was called before the
    core had a chance to initialize the pwm->args fields.

    Fix that by calling pwm_apply_args directly in pwm_get() and of_pwm_get()
    after initializing pwm->args field.

    This commit also fixes an invalid pointer dereference introduced by
    commit e39c0df1be5a ("pwm: Introduce the pwm_args concept").

    Signed-off-by: Boris Brezillon
    Fixes: e39c0df1be5a ("pwm: Introduce the pwm_args concept")
    Signed-off-by: Thierry Reding

    Boris Brezillon
     

03 May, 2016

1 commit

  • Currently the PWM core mixes the current PWM state with the per-platform
    reference config (specified through the PWM lookup table, DT definition
    or directly hardcoded in PWM drivers).

    Create a struct pwm_args to store this reference configuration, so that
    PWM users can differentiate between the current and reference
    configurations.

    Patch all places where pwm->args should be initialized. We keep the
    pwm_set_polarity/period() calls until all PWM users are patched to use
    pwm_args instead of pwm_get_period/polarity().

    Signed-off-by: Boris Brezillon
    [thierry.reding@gmail.com: reword kerneldoc comments]
    Signed-off-by: Thierry Reding

    Boris Brezillon
     

27 Mar, 2016

3 commits

  • Pull Ceph updates from Sage Weil:
    "There is quite a bit here, including some overdue refactoring and
    cleanup on the mon_client and osd_client code from Ilya, scattered
    writeback support for CephFS and a pile of bug fixes from Zheng, and a
    few random cleanups and fixes from others"

    [ I already decided not to pull this because of it having been rebased
    recently, but ended up changing my mind after all. Next time I'll
    really hold people to it. Oh well. - Linus ]

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: (34 commits)
    libceph: use KMEM_CACHE macro
    ceph: use kmem_cache_zalloc
    rbd: use KMEM_CACHE macro
    ceph: use lookup request to revalidate dentry
    ceph: kill ceph_get_dentry_parent_inode()
    ceph: fix security xattr deadlock
    ceph: don't request vxattrs from MDS
    ceph: fix mounting same fs multiple times
    ceph: remove unnecessary NULL check
    ceph: avoid updating directory inode's i_size accidentally
    ceph: fix race during filling readdir cache
    libceph: use sizeof_footer() more
    ceph: kill ceph_empty_snapc
    ceph: fix a wrong comparison
    ceph: replace CURRENT_TIME by current_fs_time()
    ceph: scattered page writeback
    libceph: add helper that duplicates last extent operation
    libceph: enable large, variable-sized OSD requests
    libceph: osdc->req_mempool should be backed by a slab pool
    libceph: make r_request msg_size calculation clearer
    ...

    Linus Torvalds
     
  • Pull NTB bug fixes from Jon Mason:
    "NTB bug fixes for tasklet from spinning forever, link errors,
    translation window setup, NULL ptr dereference, and ntb-perf errors.

    Also, a modification to the driver API that makes _addr functions
    optional"

    * tag 'ntb-4.6' of git://github.com/jonmason/ntb:
    NTB: Remove _addr functions from ntb_hw_amd
    NTB: Make _addr functions optional in the API
    NTB: Fix incorrect clean up routine in ntb_perf
    NTB: Fix incorrect return check in ntb_perf
    ntb: fix possible NULL dereference
    ntb: add missing setup of translation window
    ntb: stop link work when we do not have memory
    ntb: stop tasklet from spinning forever during shutdown.
    ntb: perf test: fix address space confusion

    Linus Torvalds
     
  • Pull more SCSI updates from James Bottomley:
    "The only new stuff which missed the first pull request is an update to
    the UFS driver.

    The rest is an assortment of bug fixes and minor tweaks which appeared
    recently (some are fixes for recent code and some are stuff spotted
    recently by the checkers or the new gcc-6 compiler [most of Arnd's
    stuff])"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (32 commits)
    scsi_common: do not clobber fixed sense information
    scsi: ufs: select CONFIG_NLS
    scsi: fc: use get/put_unaligned64 for wwn access
    fnic: move printk()s outside of the critical code section.
    qla2xxx: avoid maybe_uninitialized warning
    megaraid_sas: add missing curly braces in ioctl handler
    lpfc: fix misleading indentation
    scsi_transport_sas: add 'scsi_target_id' sysfs attribute
    scsi_dh_alua: uninitialized variable in alua_check_vpd()
    scsi: ufs-qcom: add printouts of testbus debug registers
    scsi: ufs-qcom: enable/disable the device ref clock
    scsi: ufs-qcom: set PA_Local_TX_LCC_Enable before link startup
    scsi: ufs: add device quirk delay before putting UFS rails in LPM
    scsi: ufs: fix leakage during link off state
    scsi: ufs: tune UniPro parameters to optimize hibern8 exit time
    scsi: ufs: handle non spec compliant bkops behaviour by device
    scsi: ufs: add retry for query descriptors
    scsi: ufs: add error recovery after DL NAC error
    scsi: ufs: make error handling bit faster
    scsi: ufs: disable vccq if it's not needed by UFS device
    ...

    Linus Torvalds
     

26 Mar, 2016

11 commits

  • Kernel zero day testing warned about address space confusion. A virtual
    iomem address was used where a physical address is expected. The
    offending functions implement an optional part of the api, so they are
    removed. They can be added later, after testing.

    Fixes: a1b3695820aa490e58915d720a1438069813008b

    Signed-off-by: Allen Hubbe
    Acked-by: Xiangliang Yu
    Signed-off-by: Jon Mason

    Allen Hubbe
     
  • Merge fourth patch-bomb from Andrew Morton:
    "A lot more stuff than expected, sorry. A bunch of ocfs2 reviewing was
    finished off.

    - mhocko's oom-reaper out-of-memory-handler changes

    - ocfs2 fixes and features

    - KASAN feature work

    - various fixes"

    * emailed patches from Andrew Morton : (42 commits)
    thp: fix typo in khugepaged_scan_pmd()
    MAINTAINERS: fill entries for KASAN
    mm/filemap: generic_file_read_iter(): check for zero reads unconditionally
    kasan: test fix: warn if the UAF could not be detected in kmalloc_uaf2
    mm, kasan: stackdepot implementation. Enable stackdepot for SLAB
    arch, ftrace: for KASAN put hard/soft IRQ entries into separate sections
    mm, kasan: add GFP flags to KASAN API
    mm, kasan: SLAB support
    kasan: modify kmalloc_large_oob_right(), add kmalloc_pagealloc_oob_right()
    include/linux/oom.h: remove undefined oom_kills_count()/note_oom_kill()
    mm/page_alloc: prevent merging between isolated and other pageblocks
    drivers/memstick/host/r592.c: avoid gcc-6 warning
    ocfs2: extend enough credits for freeing one truncate record while replaying truncate records
    ocfs2: extend transaction for ocfs2_remove_rightmost_path() and ocfs2_update_edge_lengths() before to avoid inconsistency between inode and et
    ocfs2/dlm: move lock to the tail of grant queue while doing in-place convert
    ocfs2: solve a problem of crossing the boundary in updating backups
    ocfs2: fix occurring deadlock by changing ocfs2_wq from global to local
    ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list
    ocfs2/dlm: fix race between convert and recovery
    ocfs2: fix a deadlock issue in ocfs2_dio_end_io_write()
    ...

    Linus Torvalds
     
  • Pull power management fixlet from Rafael Wysocki:
    "One of commits in my previous pull request changed the permissions of
    drivers/power/avs/rockchip-io-domain.c to executable by mistake"

    * tag 'pm+acpi-4.6-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    Fix permissions of drivers/power/avs/rockchip-io-domain.c

    Linus Torvalds
     
  • Pull more input updates from Dmitry Torokhov:
    "Second round of updates for the input subsystem.

    The BYD PS/2 protocol driver now uses absolute reporting mode and
    should behave more like other touchpads; Synaptics driver needed to
    extend one of its quirks to a newer firmware version, and a few USB
    drivers got tightened up checks for the contents of their descriptors"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
    Input: sur40 - fix DMA on stack
    Input: ati_remote2 - fix crashes on detecting device with invalid descriptor
    Input: synaptics - handle spurious release of trackstick buttons, again
    Input: synaptics-rmi4 - remove check of Non-NULL array
    Input: byd - enable absolute mode
    Input: ims-pcu - sanity check against missing interfaces
    Input: melfas_mip4 - add hw_version sysfs attribute

    Linus Torvalds
     
  • The r592 driver relies on behavior of the DMA mapping API that is
    normally observed but not guaranteed by the API. Instead it uses a
    runtime check to fail transfers if the API ever behaves

    When CONFIG_NEED_SG_DMA_LENGTH is not set, one of the checks turns into a
    comparison of a variable with itself, which gcc-6.0 now warns about:

    drivers/memstick/host/r592.c: In function 'r592_transfer_fifo_dma':
    drivers/memstick/host/r592.c:302:31: error: self-comparison always evaluates to false [-Werror=tautological-compare]
    (sg_dma_len(&dev->req->sg) < dev->req->sg.length)) {
    ^

    The check itself is not a problem, so this patch just rephrases the
    condition in a way that gcc does not consider an indication of a mistake.
    We already know that dev->req->sg.length was initially R592_LFIFO_SIZE, so
    we can compare it to that constant again.

    Signed-off-by: Arnd Bergmann
    Cc: Maxim Levitsky
    Cc: Quentin Lambert
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     
  • INPUT_COMPAT_TEST became much simpler after commit f4056b52845283
    ("input: redefine INPUT_COMPAT_TEST as in_compat_syscall()") so we can
    cleanly eliminate it altogether.

    Acked-by: Dmitry Torokhov
    Cc: Andy Lutomirski
    Cc: Andy Lutomirski
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • The permissions of this file were modified by commit (f447671b9e4f PM /
    AVS: rockchip-io: add io selectors and supplies for rk3399) by mistake,
    so fix them.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Use KMEM_CACHE() instead of kmem_cache_create() to simplify the code.

    Signed-off-by: Geliang Tang
    Signed-off-by: Ilya Dryomov

    Geliang Tang
     
  • Turn r_ops into a flexible array member to enable large, consisting of
    up to 16 ops, OSD requests. The use case is scattered writeback in
    cephfs and, as far as the kernel client is concerned, 16 is just a made
    up number.

    r_ops had size 3 for copyup+hint+write, but copyup is really a special
    case - it can only happen once. ceph_osd_request_cache is therefore
    stuffed with num_ops=2 requests, anything bigger than that is allocated
    with kmalloc(). req_mempool is backed by ceph_osd_request_cache, which
    means either num_ops=1 or num_ops=2 for use_mempool=true - all existing
    users (ceph_writepages_start(), ceph_osdc_writepages()) are fine with
    that.

    Signed-off-by: Ilya Dryomov

    Ilya Dryomov
     
  • This avoids defining large array of r_reply_op_{len,result} in
    in struct ceph_osd_request.

    Signed-off-by: Yan, Zheng
    Signed-off-by: Ilya Dryomov

    Yan, Zheng
     
  • This reverts commit e7223f18603374d235d8bb0398532323e5f318b9.

    It causes problems when a ppdev tries to register before the parport
    driver has been registered with the device model. That will trigger the

    BUG_ON(!drv->bus->p);

    at drivers/base/driver.c:153. The call chain is

    kernel_init ->
    kernel_init_freeable ->
    do_one_initcall ->
    ppdev_init ->
    __parport_register_driver ->
    driver_register *BOOM*

    Reported-by: kernel test robot
    Reported-by: Ross Zwisler
    Reported-by: Petr Mladek
    Cc: Sudip Mukherjee
    Cc: Greg Kroah-Hartman
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

25 Mar, 2016

1 commit