11 Sep, 2020

1 commit

  • I can't always remember the return values of these functions, and so I
    usually jump to the function to read the kernel-doc and see that it
    doesn't tell me. Then I have to spend more time reading the code to jump
    to the function that actually tells me the return values. Let's document
    it here so that we don't all have to spend time digging through the code
    to understand the return values.

    Cc:
    Signed-off-by: Stephen Boyd
    Link: https://lore.kernel.org/r/20200910060440.2302925-1-swboyd@chromium.org
    Signed-off-by: Greg Kroah-Hartman

    Stephen Boyd
     

07 Sep, 2020

1 commit

  • Drop the repeated word "the".

    Signed-off-by: Randy Dunlap
    Cc: Andrew Morton
    Cc: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Link: https://lore.kernel.org/r/20200823040443.25900-1-rdunlap@infradead.org
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap
     

10 Jul, 2020

2 commits

  • We recently introduced a bug when we tried to convert of_iomap() to
    devm_of_iomap(). The problem was that there were two drivers mapping
    the same io region. The first driver was using of_iomap() and the
    second driver was using devm_of_iomap() and the kernel booted fine.
    When we converted the first drive to use devm_of_iomap() then the second
    driver failed with -EBUSY and the kernel couldn't boot.

    Let's add a comment to prevent this sort of mistake in the future.

    Signed-off-by: Dan Carpenter
    Acked-by: Arnd Bergmann
    Link: https://lore.kernel.org/r/20200609104642.GA43074@mwanda
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     
  • Sometimes debugging a device is easiest using devmem on its register
    map, and that can be seen with /proc/iomem. But some device drivers have
    many memory regions. Take for example a networking switch. Its memory
    map used to look like this in /proc/iomem:

    1fc000000-1fc3fffff : pcie@1f0000000
    1fc000000-1fc3fffff : 0000:00:00.5
    1fc010000-1fc01ffff : sys
    1fc030000-1fc03ffff : rew
    1fc060000-1fc0603ff : s2
    1fc070000-1fc0701ff : devcpu_gcb
    1fc080000-1fc0800ff : qs
    1fc090000-1fc0900cb : ptp
    1fc100000-1fc10ffff : port0
    1fc110000-1fc11ffff : port1
    1fc120000-1fc12ffff : port2
    1fc130000-1fc13ffff : port3
    1fc140000-1fc14ffff : port4
    1fc150000-1fc15ffff : port5
    1fc200000-1fc21ffff : qsys
    1fc280000-1fc28ffff : ana

    But after the patch in Fixes: was applied, the information is now
    presented in a much more opaque way:

    1fc000000-1fc3fffff : pcie@1f0000000
    1fc000000-1fc3fffff : 0000:00:00.5
    1fc010000-1fc01ffff : 0000:00:00.5
    1fc030000-1fc03ffff : 0000:00:00.5
    1fc060000-1fc0603ff : 0000:00:00.5
    1fc070000-1fc0701ff : 0000:00:00.5
    1fc080000-1fc0800ff : 0000:00:00.5
    1fc090000-1fc0900cb : 0000:00:00.5
    1fc100000-1fc10ffff : 0000:00:00.5
    1fc110000-1fc11ffff : 0000:00:00.5
    1fc120000-1fc12ffff : 0000:00:00.5
    1fc130000-1fc13ffff : 0000:00:00.5
    1fc140000-1fc14ffff : 0000:00:00.5
    1fc150000-1fc15ffff : 0000:00:00.5
    1fc200000-1fc21ffff : 0000:00:00.5
    1fc280000-1fc28ffff : 0000:00:00.5

    That patch made a fair comment that /proc/iomem might be confusing when
    it shows resources without an associated device, but we can do better
    than just hide the resource name altogether. Namely, we can print the
    device name _and_ the resource name. Like this:

    1fc000000-1fc3fffff : pcie@1f0000000
    1fc000000-1fc3fffff : 0000:00:00.5
    1fc010000-1fc01ffff : 0000:00:00.5 sys
    1fc030000-1fc03ffff : 0000:00:00.5 rew
    1fc060000-1fc0603ff : 0000:00:00.5 s2
    1fc070000-1fc0701ff : 0000:00:00.5 devcpu_gcb
    1fc080000-1fc0800ff : 0000:00:00.5 qs
    1fc090000-1fc0900cb : 0000:00:00.5 ptp
    1fc100000-1fc10ffff : 0000:00:00.5 port0
    1fc110000-1fc11ffff : 0000:00:00.5 port1
    1fc120000-1fc12ffff : 0000:00:00.5 port2
    1fc130000-1fc13ffff : 0000:00:00.5 port3
    1fc140000-1fc14ffff : 0000:00:00.5 port4
    1fc150000-1fc15ffff : 0000:00:00.5 port5
    1fc200000-1fc21ffff : 0000:00:00.5 qsys
    1fc280000-1fc28ffff : 0000:00:00.5 ana

    Fixes: 8d84b18f5678 ("devres: always use dev_name() in devm_ioremap_resource()")
    Signed-off-by: Vladimir Oltean
    Link: https://lore.kernel.org/r/20200601095826.1757621-1-olteanv@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Vladimir Oltean
     

06 Jan, 2020

1 commit


04 Dec, 2019

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "Enumeration:

    - Warn if a host bridge has no NUMA info (Yunsheng Lin)

    - Add PCI_STD_NUM_BARS for the number of standard BARs (Denis
    Efremov)

    Resource management:

    - Fix boot-time Embedded Controller GPE storm caused by incorrect
    resource assignment after ACPI Bus Check Notification (Mika
    Westerberg)

    - Protect pci_reassign_bridge_resources() against concurrent
    addition/removal (Benjamin Herrenschmidt)

    - Fix bridge dma_ranges resource list cleanup (Rob Herring)

    - Add "pci=hpmmiosize" and "pci=hpmmioprefsize" parameters to control
    the MMIO and prefetchable MMIO window sizes of hotplug bridges
    independently (Nicholas Johnson)

    - Fix MMIO/MMIO_PREF window assignment that assigned more space than
    desired (Nicholas Johnson)

    - Only enforce bus numbers from bridge EA if the bridge has EA
    devices downstream (Subbaraya Sundeep)

    - Consolidate DT "dma-ranges" parsing and convert all host drivers to
    use shared parsing (Rob Herring)

    Error reporting:

    - Restore AER capability after resume (Mayurkumar Patel)

    - Add PoisonTLPBlocked AER counter (Rajat Jain)

    - Use for_each_set_bit() to simplify AER code (Andy Shevchenko)

    - Fix AER kernel-doc (Andy Shevchenko)

    - Add "pcie_ports=dpc-native" parameter to allow native use of DPC
    even if platform didn't grant control over AER (Olof Johansson)

    Hotplug:

    - Avoid returning prematurely from sysfs requests to enable or
    disable a PCIe hotplug slot (Lukas Wunner)

    - Don't disable interrupts twice when suspending hotplug ports (Mika
    Westerberg)

    - Fix deadlocks when PCIe ports are hot-removed while suspended (Mika
    Westerberg)

    Power management:

    - Remove unnecessary ASPM locking (Bjorn Helgaas)

    - Add support for disabling L1 PM Substates (Heiner Kallweit)

    - Allow re-enabling Clock PM after it has been disabled (Heiner
    Kallweit)

    - Add sysfs attributes for controlling ASPM link states (Heiner
    Kallweit)

    - Remove CONFIG_PCIEASPM_DEBUG, including "link_state" and "clk_ctl"
    sysfs files (Heiner Kallweit)

    - Avoid AMD FCH XHCI USB PME# from D0 defect that prevents wakeup on
    USB 2.0 or 1.1 connect events (Kai-Heng Feng)

    - Move power state check out of pci_msi_supported() (Bjorn Helgaas)

    - Fix incorrect MSI-X masking on resume and revert related nvme quirk
    for Kingston NVME SSD running FW E8FK11.T (Jian-Hong Pan)

    - Always return devices to D0 when thawing to fix hibernation with
    drivers like mlx4 that used legacy power management (previously we
    only did it for drivers with new power management ops) (Dexuan Cui)

    - Clear PCIe PME Status even for legacy power management (Bjorn
    Helgaas)

    - Fix PCI PM documentation errors (Bjorn Helgaas)

    - Use dev_printk() for more power management messages (Bjorn Helgaas)

    - Apply D2 delay as milliseconds, not microseconds (Bjorn Helgaas)

    - Convert xen-platform from legacy to generic power management (Bjorn
    Helgaas)

    - Removed unused .resume_early() and .suspend_late() legacy power
    management hooks (Bjorn Helgaas)

    - Rearrange power management code for clarity (Rafael J. Wysocki)

    - Decode power states more clearly ("4" or "D4" really refers to
    "D3cold") (Bjorn Helgaas)

    - Notice when reading PM Control register returns an error (~0)
    instead of interpreting it as being in D3hot (Bjorn Helgaas)

    - Add missing link delays required by the PCIe spec (Mika Westerberg)

    Virtualization:

    - Move pci_prg_resp_pasid_required() to CONFIG_PCI_PRI (Bjorn
    Helgaas)

    - Allow VFs to use PRI (the PF PRI is shared by the VFs, but the code
    previously didn't recognize that) (Kuppuswamy Sathyanarayanan)

    - Allow VFs to use PASID (the PF PASID capability is shared by the
    VFs, but the code previously didn't recognize that) (Kuppuswamy
    Sathyanarayanan)

    - Disconnect PF and VF ATS enablement, since ATS in PFs and
    associated VFs can be enabled independently (Kuppuswamy
    Sathyanarayanan)

    - Cache PRI and PASID capability offsets (Kuppuswamy Sathyanarayanan)

    - Cache the PRI PRG Response PASID Required bit (Bjorn Helgaas)

    - Consolidate ATS declarations in linux/pci-ats.h (Krzysztof
    Wilczynski)

    - Remove unused PRI and PASID stubs (Bjorn Helgaas)

    - Removed unnecessary EXPORT_SYMBOL_GPL() from ATS, PRI, and PASID
    interfaces that are only used by built-in IOMMU drivers (Bjorn
    Helgaas)

    - Hide PRI and PASID state restoration functions used only inside the
    PCI core (Bjorn Helgaas)

    - Add a DMA alias quirk for the Intel VCA NTB (Slawomir Pawlowski)

    - Serialize sysfs sriov_numvfs reads vs writes (Pierre Crégut)

    - Update Cavium ACS quirk for ThunderX2 and ThunderX3 (George
    Cherian)

    - Fix the UPDCR register address in the Intel ACS quirk (Steffen
    Liebergeld)

    - Unify ACS quirk implementations (Bjorn Helgaas)

    Amlogic Meson host bridge driver:

    - Fix meson PERST# GPIO polarity problem (Remi Pommarel)

    - Add DT bindings for Amlogic Meson G12A (Neil Armstrong)

    - Fix meson clock names to match DT bindings (Neil Armstrong)

    - Add meson support for Amlogic G12A SoC with separate shared PHY
    (Neil Armstrong)

    - Add meson extended PCIe PHY functions for Amlogic G12A USB3+PCIe
    combo PHY (Neil Armstrong)

    - Add arm64 DT for Amlogic G12A PCIe controller node (Neil Armstrong)

    - Add commented-out description of VIM3 USB3/PCIe mux in arm64 DT
    (Neil Armstrong)

    Broadcom iProc host bridge driver:

    - Invalidate iProc PAXB address mapping before programming it
    (Abhishek Shah)

    - Fix iproc-msi and mvebu __iomem annotations (Ben Dooks)

    Cadence host bridge driver:

    - Refactor Cadence PCIe host controller to use as a library for both
    host and endpoint (Tom Joseph)

    Freescale Layerscape host bridge driver:

    - Add layerscape LS1028a support (Xiaowei Bao)

    Intel VMD host bridge driver:

    - Add VMD bus 224-255 restriction decode (Jon Derrick)

    - Add VMD 8086:9A0B device ID (Jon Derrick)

    - Remove Keith from VMD maintainer list (Keith Busch)

    Marvell ARMADA 3700 / Aardvark host bridge driver:

    - Use LTSSM state to build link training flag since Aardvark doesn't
    implement the Link Training bit (Remi Pommarel)

    - Delay before training Aardvark link in case PERST# was asserted
    before the driver probe (Remi Pommarel)

    - Fix Aardvark issues with Root Control reads and writes (Remi
    Pommarel)

    - Don't rely on jiffies in Aardvark config access path since
    interrupts may be disabled (Remi Pommarel)

    - Fix Aardvark big-endian support (Grzegorz Jaszczyk)

    Marvell ARMADA 370 / XP host bridge driver:

    - Make mvebu_pci_bridge_emul_ops static (Ben Dooks)

    Microsoft Hyper-V host bridge driver:

    - Add hibernation support for Hyper-V virtual PCI devices (Dexuan
    Cui)

    - Track Hyper-V pci_protocol_version per-hbus, not globally (Dexuan
    Cui)

    - Avoid kmemleak false positive on hv hbus buffer (Dexuan Cui)

    Mobiveil host bridge driver:

    - Change mobiveil csr_read()/write() function names that conflict
    with riscv arch functions (Kefeng Wang)

    NVIDIA Tegra host bridge driver:

    - Fix Tegra CLKREQ dependency programming (Vidya Sagar)

    Renesas R-Car host bridge driver:

    - Remove unnecessary header include from rcar (Andrew Murray)

    - Tighten register index checking for rcar inbound range programming
    (Marek Vasut)

    - Fix rcar inbound range alignment calculation to improve packing of
    multiple entries (Marek Vasut)

    - Update rcar MACCTLR setting to match documentation (Yoshihiro
    Shimoda)

    - Clear bit 0 of MACCTLR before PCIETCTLR.CFINIT per manual
    (Yoshihiro Shimoda)

    - Add Marek Vasut and Yoshihiro Shimoda as R-Car maintainers (Simon
    Horman)

    Rockchip host bridge driver:

    - Make rockchip 0V9 and 1V8 power regulators non-optional (Robin
    Murphy)

    Socionext UniPhier host bridge driver:

    - Set uniphier to host (RC) mode always (Kunihiko Hayashi)

    Endpoint drivers:

    - Fix endpoint driver sign extension problem when shifting page
    number to phys_addr_t (Alan Mikhak)

    Misc:

    - Add NumaChip SPDX header (Krzysztof Wilczynski)

    - Replace EXTRA_CFLAGS with ccflags-y (Krzysztof Wilczynski)

    - Remove unused includes (Krzysztof Wilczynski)

    - Removed unused sysfs attribute groups (Ben Dooks)

    - Remove PTM and ASPM dependencies on PCIEPORTBUS (Bjorn Helgaas)

    - Add PCIe Link Control 2 register field definitions to replace magic
    numbers in AMDGPU and Radeon CIK/SI (Bjorn Helgaas)

    - Fix incorrect Link Control 2 Transmit Margin usage in AMDGPU and
    Radeon CIK/SI PCIe Gen3 link training (Bjorn Helgaas)

    - Use pcie_capability_read_word() instead of pci_read_config_word()
    in AMDGPU and Radeon CIK/SI (Frederick Lawler)

    - Remove unused pci_irq_get_node() Greg Kroah-Hartman)

    - Make asm/msi.h mandatory and simplify PCI_MSI_IRQ_DOMAIN Kconfig
    (Palmer Dabbelt, Michal Simek)

    - Read all 64 bits of Switchtec part_event_bitmap (Logan Gunthorpe)

    - Fix erroneous intel-iommu dependency on CONFIG_AMD_IOMMU (Bjorn
    Helgaas)

    - Fix bridge emulation big-endian support (Grzegorz Jaszczyk)

    - Fix dwc find_next_bit() usage (Niklas Cassel)

    - Fix pcitest.c fd leak (Hewenliang)

    - Fix typos and comments (Bjorn Helgaas)

    - Fix Kconfig whitespace errors (Krzysztof Kozlowski)"

    * tag 'pci-v5.5-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (160 commits)
    PCI: Remove PCI_MSI_IRQ_DOMAIN architecture whitelist
    asm-generic: Make msi.h a mandatory include/asm header
    Revert "nvme: Add quirk for Kingston NVME SSD running FW E8FK11.T"
    PCI/MSI: Fix incorrect MSI-X masking on resume
    PCI/MSI: Move power state check out of pci_msi_supported()
    PCI/MSI: Remove unused pci_irq_get_node()
    PCI: hv: Avoid a kmemleak false positive caused by the hbus buffer
    PCI: hv: Change pci_protocol_version to per-hbus
    PCI: hv: Add hibernation support
    PCI: hv: Reorganize the code in preparation of hibernation
    MAINTAINERS: Remove Keith from VMD maintainer
    PCI/ASPM: Remove PCIEASPM_DEBUG Kconfig option and related code
    PCI/ASPM: Add sysfs attributes for controlling ASPM link states
    PCI: Fix indentation
    drm/radeon: Prefer pcie_capability_read_word()
    drm/radeon: Replace numbers with PCI_EXP_LNKCTL2 definitions
    drm/radeon: Correct Transmit Margin masks
    drm/amdgpu: Prefer pcie_capability_read_word()
    PCI: uniphier: Set mode register to host mode
    drm/amdgpu: Replace numbers with PCI_EXP_LNKCTL2 definitions
    ...

    Linus Torvalds
     

02 Dec, 2019

1 commit

  • Pull MFD updates from Lee Jones:
    "Core Frameworks:
    - Add support for a "resource managed strongly uncachable ioremap"
    call
    - Provide a collection of MFD helper macros
    - Remove mfd_clone_cell() from MFD core
    - Add NULL de-reference protection in MFD core
    - Remove superfluous function fd_platform_add_cell() from MFD core
    - Honour Device Tree's request to disable a device

    New Drivers:
    - Add support for MediaTek MT6323 PMIC

    New Device Support:
    - Add support for Gemini Lake to Intel LPSS PCI
    - Add support for Cherry Trail Crystal Cover PMIC to Intel SoC PMIC
    CRC
    - Add support for PM{I}8950 to Qualcomm SPMI PMIC
    - Add support for U8420 to ST-Ericsson DB8500
    - Add support for Comet Lake PCH-H to Intel LPSS PCI

    New Functionality:
    - Add support for requested supply clocks; madera-core

    Fix-ups:
    - Lower interrupt priority; rk808
    - Use provided helpers (macros, group functions, defines); rk808,
    ipaq-micro, ab8500-core, db8500-prcmu, mt6397-core, cs5535-mfd
    - Only allocate IRQs on request; max77620
    - Use simplified API; arizona-core
    - Remove redundant and/or duplicated code; wm8998-tables, arizona,
    syscon
    - Device Tree binding fix-ups; madera, max77650, max77693
    - Remove mfd_cell->id abuse hack; cs5535-mfd
    - Remove only user of mfd_clone_cell(); cs5535-mfd
    - Make resources static; rohm-bd70528

    Bug Fixes:
    - Fix product ID for RK818; rk808
    - Fix Power Key; rk808
    - Fix booting on the BananaPi; mt6397-core
    - Endian fix-ups; twl.h
    - Fix static error checker warnings; ti_am335x_tscadc"

    * tag 'mfd-next-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (47 commits)
    Revert "mfd: syscon: Set name of regmap_config"
    mfd: ti_am335x_tscadc: Fix static checker warning
    mfd: bd70528: Staticize bit value definitions
    mfd: mfd-core: Honour Device Tree's request to disable a child-device
    dt-bindings: mfd: max77693: Fix missing curly brace
    mfd: intel-lpss: Add Intel Comet Lake PCH-H PCI IDs
    mfd: db8500-prcmu: Support U8420-sysclk firmware
    dt-bindings: mfd: max77650: Convert the binding document to yaml
    mfd: mfd-core: Move pdev->mfd_cell creation back into mfd_add_device()
    mfd: mfd-core: Remove usage counting for .{en,dis}able() call-backs
    x86: olpc-xo1-sci: Remove invocation of MFD's .enable()/.disable() call-backs
    x86: olpc-xo1-pm: Remove invocation of MFD's .enable()/.disable() call-backs
    mfd: mfd-core: Remove mfd_clone_cell()
    mfd: mfd-core: Protect against NULL call-back function pointer
    mfd: cs5535-mfd: Register clients using their own dedicated MFD cell entries
    mfd: cs5535-mfd: Request shared IO regions centrally
    mfd: cs5535-mfd: Remove mfd_cell->id hack
    mfd: cs5535-mfd: Use PLATFORM_DEVID_* defines and tidy error message
    mfd: intel_soc_pmic_crc: Add "cht_crystal_cove_pmic" cell to CHT cells
    mfd: madera: Add support for requesting the supply clocks
    ...

    Linus Torvalds
     

11 Nov, 2019

1 commit


06 Nov, 2019

2 commits

  • Provide a variant of devm_ioremap_resource() for write-combined ioremap.

    Signed-off-by: Bartosz Golaszewski
    Reviewed-by: Arnd Bergmann
    Link: https://lore.kernel.org/r/20191022084318.22256-4-brgl@bgdev.pl
    Signed-off-by: Greg Kroah-Hartman

    Bartosz Golaszewski
     
  • We want to add the write-combined variant of devm_ioremap_resource().
    Let's first implement __devm_ioremap_resource() which takes
    an additional argument type. The types are the same as for
    __devm_ioremap(). The existing devm_ioremap_resource() now simply
    calls __devm_ioremap_resource() with regular DEVM_IOREMAP type.

    Signed-off-by: Bartosz Golaszewski
    Reviewed-by: Arnd Bergmann
    Link: https://lore.kernel.org/r/20191022084318.22256-3-brgl@bgdev.pl
    Signed-off-by: Greg Kroah-Hartman

    Bartosz Golaszewski
     

14 Oct, 2019

1 commit

  • Code that iterates over all standard PCI BARs typically uses
    PCI_STD_RESOURCE_END. However, that requires the unusual test
    "i < PCI_STD_NUM_BARS".

    Add a definition for PCI_STD_NUM_BARS and change loops to use the more
    idiomatic C style to help avoid fencepost errors.

    Link: https://lore.kernel.org/r/20190927234026.23342-1-efremov@linux.com
    Link: https://lore.kernel.org/r/20190927234308.23935-1-efremov@linux.com
    Link: https://lore.kernel.org/r/20190916204158.6889-3-efremov@linux.com
    Signed-off-by: Denis Efremov
    Signed-off-by: Bjorn Helgaas
    Acked-by: Sebastian Ott # arch/s390/
    Acked-by: Bartlomiej Zolnierkiewicz # video/fbdev/
    Acked-by: Gustavo Pimentel # pci/controller/dwc/
    Acked-by: Jack Wang # scsi/pm8001/
    Acked-by: Martin K. Petersen # scsi/pm8001/
    Acked-by: Ulf Hansson # memstick/

    Denis Efremov
     

05 Jul, 2019

1 commit

  • devm_ioremap_resource() does not currently take 'const' arguments, which
    results in a warning from the first driver trying to do it anyway:

    drivers/gpio/gpio-amd-fch.c: In function 'amd_fch_gpio_probe':
    drivers/gpio/gpio-amd-fch.c:171:49: error: passing argument 2 of 'devm_ioremap_resource' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
    priv->base = devm_ioremap_resource(&pdev->dev, &amd_fch_gpio_iores);
    ^~~~~~~~~~~~~~~~~~~

    Change the prototype to allow it, as there is no real reason not to.

    Link: http://lkml.kernel.org/r/20190628150049.1108048-1-arnd@arndb.de
    Fixes: 9bb2e0452508 ("gpio: amd: Make resource struct const")
    Signed-off-by: Arnd Bergmann
    Acked-by: Greg Kroah-Hartman
    Reviewed-by: Enrico Weigelt
    Reviewed-by: Andrew Morton
    Cc: Greg Kroah-Hartman
    Cc: Linus Walleij
    Cc: Arnd Bergmann
    Cc: "Rafael J. Wysocki"
    Cc: Ulf Hansson
    Cc: Andy Shevchenko
    Cc: Heikki Krogerus
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

01 Feb, 2019

1 commit

  • devm_ioremap_resource() prefers calling devm_request_mem_region() with a
    resource name instead of a device name -- this looks pretty iff a resource
    name isn't specified via a device tree with a "reg-names" property (in this
    case, a resource name is set to a device node's full name), but if it is,
    it doesn't really scale since these names are only unique to a given device
    node, not globally; so, looking at the output of 'cat /proc/iomem', you do
    not have an idea which memory region belongs to which device (see "dirmap",
    "regs", and "wbuf" lines below):

    08000000-0bffffff : dirmap
    48000000-bfffffff : System RAM
    48000000-48007fff : reserved
    48080000-48b0ffff : Kernel code
    48b10000-48b8ffff : reserved
    48b90000-48c7afff : Kernel data
    bc6a4000-bcbfffff : reserved
    bcc0f000-bebfffff : reserved
    bec0e000-bec0efff : reserved
    bec11000-bec11fff : reserved
    bec12000-bec14fff : reserved
    bec15000-bfffffff : reserved
    e6050000-e605004f : gpio@e6050000
    e6051000-e605104f : gpio@e6051000
    e6052000-e605204f : gpio@e6052000
    e6053000-e605304f : gpio@e6053000
    e6054000-e605404f : gpio@e6054000
    e6055000-e605504f : gpio@e6055000
    e6060000-e606050b : pin-controller@e6060000
    e6e60000-e6e6003f : e6e60000.serial
    e7400000-e7400fff : ethernet@e7400000
    ee200000-ee2001ff : regs
    ee208000-ee2080ff : wbuf

    I think that devm_request_mem_region() should be called with dev_name()
    despite the region names won't look as pretty as before (however, we gain
    more consistency with e.g. the serial driver:

    08000000-0bffffff : ee200000.rpc
    48000000-bfffffff : System RAM
    48000000-48007fff : reserved
    48080000-48b0ffff : Kernel code
    48b10000-48b8ffff : reserved
    48b90000-48c7afff : Kernel data
    bc6a4000-bcbfffff : reserved
    bcc0f000-bebfffff : reserved
    bec0e000-bec0efff : reserved
    bec11000-bec11fff : reserved
    bec12000-bec14fff : reserved
    bec15000-bfffffff : reserved
    e6050000-e605004f : e6050000.gpio
    e6051000-e605104f : e6051000.gpio
    e6052000-e605204f : e6052000.gpio
    e6053000-e605304f : e6053000.gpio
    e6054000-e605404f : e6054000.gpio
    e6055000-e605504f : e6055000.gpio
    e6060000-e606050b : e6060000.pin-controller
    e6e60000-e6e6003f : e6e60000.serial
    e7400000-e7400fff : e7400000.ethernet
    ee200000-ee2001ff : ee200000.rpc
    ee208000-ee2080ff : ee200000.rpc

    Fixes: 72f8c0bfa0de ("lib: devres: add convenience function to remap a resource")
    Signed-off-by: Sergei Shtylyov
    Signed-off-by: Greg Kroah-Hartman

    Sergei Shtylyov
     

23 Jul, 2018

1 commit

  • There are still quite a few cases where a device might want
    to get to a different node of the device-tree, obtain the
    resources and map them.

    We have of_iomap() and of_io_request_and_map() but they both
    have shortcomings, such as not returning the size of the
    resource found (which can be useful) and not being "managed".

    This adds a devm_of_iomap() that provides all of these and
    should probably replace uses of the above in most drivers.

    Signed-off-by: Benjamin Herrenschmidt
    Reviewed-by: Linus Walleij
    Reviewed-by: Joel Stanley

    Benjamin Herrenschmidt
     

16 Mar, 2018

1 commit

  • When I tried to use devm_ioremap function and review related
    code, I found devm_ioremap_* almost have the similar realize
    with each other, which can be combined.

    In the former version, I have tried to kill ioremap_cache to
    reduce the size of devres, which can not work for ioremap is
    not the same as ioremap_nocache in some ARCHs likes ia64.
    Therefore, as the suggestion of Christophe, I introduce a help
    function __devm_ioremap, let devm_ioremap* inline and call
    __devm_ioremap with different devm_ioremap_type.

    After apply the patch, the size of devres.o can be reduce from
    8216 Bytes to 8052 Bytes in my compile environment.

    Suggested-by: Greg KH
    Suggested-by: Christophe LEROY
    Signed-off-by: Yisheng Xie
    Reviewed-by: Christophe LEROY
    Signed-off-by: Greg Kroah-Hartman

    Yisheng Xie
     

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
     

25 Apr, 2017

1 commit

  • The offset parameter in the devres devm_ioremap_*() functions kerneldoc
    entries is erroneously defined as BUS offset whereas it is actually a
    resource address.

    Since it is actually misleading, fix the devres devm_ioremap_* offset
    parameter kerneldoc entry by replacing BUS offset with a more suitable
    description (ie Resource address).

    Signed-off-by: Lorenzo Pieralisi
    Signed-off-by: Bjorn Helgaas
    Cc: Tejun Heo

    Lorenzo Pieralisi
     

08 Feb, 2016

1 commit


05 Oct, 2015

1 commit

  • The iomap[] array has PCIM_IOMAP_MAX (6) elements and not
    DEVICE_COUNT_RESOURCE (16). This bug was found using a static checker.
    It may be that the "if (!(mask & (1 << i)))" check means we never
    actually go past the end of the array in real life.

    Fixes: ec04b075843d ('iomap: implement pcim_iounmap_regions()')
    Signed-off-by: Dan Carpenter
    Acked-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     

11 Aug, 2015

1 commit

  • Quoting Arnd:
    I was thinking the opposite approach and basically removing all uses
    of IORESOURCE_CACHEABLE from the kernel. There are only a handful of
    them.and we can probably replace them all with hardcoded
    ioremap_cached() calls in the cases they are actually useful.

    All existing usages of IORESOURCE_CACHEABLE call ioremap() instead of
    ioremap_nocache() if the resource is cacheable, however ioremap() is
    uncached by default. Clearly none of the existing usages care about the
    cacheability. Particularly devm_ioremap_resource() never worked as
    advertised since it always fell back to plain ioremap().

    Clean this up as the new direction we want is to convert
    ioremap_() usages to memremap(..., flags).

    Suggested-by: Arnd Bergmann
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Dan Williams

    Dan Williams
     

17 Mar, 2015

1 commit


08 Nov, 2014

1 commit


06 Aug, 2014

1 commit

  • Pull timer and time updates from Thomas Gleixner:
    "A rather large update of timers, timekeeping & co

    - Core timekeeping code is year-2038 safe now for 32bit machines.
    Now we just need to fix all in kernel users and the gazillion of
    user space interfaces which rely on timespec/timeval :)

    - Better cache layout for the timekeeping internal data structures.

    - Proper nanosecond based interfaces for in kernel users.

    - Tree wide cleanup of code which wants nanoseconds but does hoops
    and loops to convert back and forth from timespecs. Some of it
    definitely belongs into the ugly code museum.

    - Consolidation of the timekeeping interface zoo.

    - A fast NMI safe accessor to clock monotonic for tracing. This is a
    long standing request to support correlated user/kernel space
    traces. With proper NTP frequency correction it's also suitable
    for correlation of traces accross separate machines.

    - Checkpoint/restart support for timerfd.

    - A few NOHZ[_FULL] improvements in the [hr]timer code.

    - Code move from kernel to kernel/time of all time* related code.

    - New clocksource/event drivers from the ARM universe. I'm really
    impressed that despite an architected timer in the newer chips SoC
    manufacturers insist on inventing new and differently broken SoC
    specific timers.

    [ Ed. "Impressed"? I don't think that word means what you think it means ]

    - Another round of code move from arch to drivers. Looks like most
    of the legacy mess in ARM regarding timers is sorted out except for
    a few obnoxious strongholds.

    - The usual updates and fixlets all over the place"

    * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (114 commits)
    timekeeping: Fixup typo in update_vsyscall_old definition
    clocksource: document some basic timekeeping concepts
    timekeeping: Use cached ntp_tick_length when accumulating error
    timekeeping: Rework frequency adjustments to work better w/ nohz
    timekeeping: Minor fixup for timespec64->timespec assignment
    ftrace: Provide trace clocks monotonic
    timekeeping: Provide fast and NMI safe access to CLOCK_MONOTONIC
    seqcount: Add raw_write_seqcount_latch()
    seqcount: Provide raw_read_seqcount()
    timekeeping: Use tk_read_base as argument for timekeeping_get_ns()
    timekeeping: Create struct tk_read_base and use it in struct timekeeper
    timekeeping: Restructure the timekeeper some more
    clocksource: Get rid of cycle_last
    clocksource: Move cycle_last validation to core code
    clocksource: Make delta calculation a function
    wireless: ath9k: Get rid of timespec conversions
    drm: vmwgfx: Use nsec based interfaces
    drm: i915: Use nsec based interfaces
    timekeeping: Provide ktime_get_raw()
    hangcheck-timer: Use ktime_get_ns()
    ...

    Linus Torvalds
     

23 Jul, 2014

1 commit

  • A call to of_iomap does not request the memory region. This patch adds the
    function of_io_request_and_map which requests the memory region before
    mapping it.

    Signed-off-by: Matthias Brugger
    Suggested-by: Thomas Gleixner
    Suggested-by: Rob Herring
    Acked-by: Rob Herring
    Signed-off-by: Daniel Lezcano

    Matthias Brugger
     

20 Jun, 2014

1 commit

  • devm_request_and_ioremap() was obsoleted by the commit 7509657
    ("lib: devres: Introduce devm_ioremap_resource()") and has been
    deprecated for a long time. So, let's remove this function.
    In addition, all usages of devm_request_and_ioremap() are also
    removed.

    Signed-off-by: Jingoo Han
    Signed-off-by: Greg Kroah-Hartman

    Jingoo Han
     

24 May, 2014

2 commits


08 Apr, 2014

1 commit

  • If the renamed symbol is defined lib/iomap.c implements ioport_map and
    ioport_unmap and currently (nearly) all platforms define the port
    accessor functions outb/inb and friend unconditionally. So
    HAS_IOPORT_MAP is the better name for this.

    Consequently NO_IOPORT is renamed to NO_IOPORT_MAP.

    The motivation for this change is to reintroduce a symbol HAS_IOPORT
    that signals if outb/int et al are available. I will address that at
    least one merge window later though to keep surprises to a minimum and
    catch new introductions of (HAS|NO)_IOPORT.

    The changes in this commit were done using:

    $ git grep -l -E '(NO|HAS)_IOPORT' | xargs perl -p -i -e 's/\b((?:CONFIG_)?(?:NO|HAS)_IOPORT)\b/$1_MAP/'

    Signed-off-by: Uwe Kleine-König
    Acked-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Uwe Kleine-König
     

04 Apr, 2014

1 commit

  • Having a discussion about sparse warnings in the kernel, and that we
    should clean them up, I decided to pick a random file to do so. This
    happened to be devres.c which gives the following warnings:

    CHECK lib/devres.c
    lib/devres.c:83:9: warning: cast removes address space of expression
    lib/devres.c:117:31: warning: incorrect type in return expression (different address spaces)
    lib/devres.c:117:31: expected void [noderef] *
    lib/devres.c:117:31: got void *
    lib/devres.c:125:31: warning: incorrect type in return expression (different address spaces)
    lib/devres.c:125:31: expected void [noderef] *
    lib/devres.c:125:31: got void *
    lib/devres.c:136:26: warning: incorrect type in assignment (different address spaces)
    lib/devres.c:136:26: expected void [noderef] *[assigned] dest_ptr
    lib/devres.c:136:26: got void *
    lib/devres.c:226:9: warning: cast removes address space of expression

    Mostly it's just the use of typecasting to void * without adding
    __force, or returning ERR_PTR(-ESOMEERR) without typecasting to a
    __iomem type.

    I added a helper macro IOMEM_ERR_PTR() that does the typecast to make
    the code a little nicer than adding ugly typecasts to the code.

    Signed-off-by: Steven Rostedt
    Cc: Tejun Heo
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Steven Rostedt
     

28 Feb, 2013

1 commit

  • A misplaced #endif causes link errors related to pcim_*() functions.

    This is because pcim_*() functions are related to CONFIG_PCI option,
    however these are not related to CONFIG_HAS_IOPORT option. Therefore,
    when CONFIG_PCI is enabled and CONFIG_HAS_IOPORT is not enabled, it makes
    link errors related to pcim_*() functions as below:

    drivers/ata/libata-sff.c:3233: undefined reference to `pcim_iomap_regions'
    drivers/ata/libata-sff.c:3238: undefined reference to `pcim_iomap_table'
    drivers/built-in.o: In function `ata_pci_sff_init_host':
    drivers/ata/libata-sff.c:2318: undefined reference to `pcim_iomap_regions'
    drivers/ata/libata-sff.c:2329: undefined reference to `pcim_iomap_table

    Signed-off-by: Jingoo Han
    Cc: Greg KH
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jingoo Han
     

23 Jan, 2013

2 commits

  • The ERR_PTR() and IS_ERR() macros used by the devm_ioremap_resource()
    function are defined in the linux/err.h header. On ARM this seems to be
    pulled in by one of the other headers but the build fails at least on
    OpenRISC.

    Signed-off-by: Thierry Reding
    Reported-by: kbuild test robot
    Signed-off-by: Greg Kroah-Hartman

    Thierry Reding
     
  • The devm_request_and_ioremap() function is very useful and helps avoid a
    whole lot of boilerplate. However, one issue that keeps popping up is
    its lack of a specific error code to determine which of the steps that
    it performs failed. Furthermore, while the function gives an example and
    suggests what error code to return on failure, a wide variety of error
    codes are used throughout the tree.

    In an attempt to fix these problems, this patch adds a new function that
    drivers can transition to. The devm_ioremap_resource() returns a pointer
    to the remapped I/O memory on success or an ERR_PTR() encoded error code
    on failure. Callers can check for failure using IS_ERR() and determine
    its cause by extracting the error code using PTR_ERR().

    devm_request_and_ioremap() is implemented as a wrapper around the new
    API and return NULL on failure as before. This ensures that backwards
    compatibility is maintained until all users have been converted to the
    new API, at which point the old devm_request_and_ioremap() function
    should be removed.

    A semantic patch is included which can be used to convert from the old
    devm_request_and_ioremap() API to the new devm_ioremap_resource() API.
    Some non-trivial cases may require manual intervention, though.

    Signed-off-by: Thierry Reding
    Cc: Arnd Bergmann
    Acked-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Thierry Reding
     

08 Mar, 2012

1 commit


12 Jan, 2012

1 commit

  • * 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci: (80 commits)
    x86/PCI: Expand the x86_msi_ops to have a restore MSIs.
    PCI: Increase resource array mask bit size in pcim_iomap_regions()
    PCI: DEVICE_COUNT_RESOURCE should be equal to PCI_NUM_RESOURCES
    PCI: pci_ids: add device ids for STA2X11 device (aka ConneXT)
    PNP: work around Dell 1536/1546 BIOS MMCONFIG bug that breaks USB
    x86/PCI: amd: factor out MMCONFIG discovery
    PCI: Enable ATS at the device state restore
    PCI: msi: fix imbalanced refcount of msi irq sysfs objects
    PCI: kconfig: English typo in pci/pcie/Kconfig
    PCI/PM/Runtime: make PCI traces quieter
    PCI: remove pci_create_bus()
    xtensa/PCI: convert to pci_scan_root_bus() for correct root bus resources
    x86/PCI: convert to pci_create_root_bus() and pci_scan_root_bus()
    x86/PCI: use pci_scan_bus() instead of pci_scan_bus_parented()
    x86/PCI: read Broadcom CNB20LE host bridge info before PCI scan
    sparc32, leon/PCI: convert to pci_scan_root_bus() for correct root bus resources
    sparc/PCI: convert to pci_create_root_bus()
    sh/PCI: convert to pci_scan_root_bus() for correct root bus resources
    powerpc/PCI: convert to pci_create_root_bus()
    powerpc/PCI: split PHB part out of pcibios_map_io_space()
    ...

    Fix up conflicts in drivers/pci/msi.c and include/linux/pci_regs.h due
    to the same patches being applied in other branches.

    Linus Torvalds
     

07 Jan, 2012

1 commit


16 Nov, 2011

2 commits

  • Almost every platform_driver does the three steps get_resource,
    request_mem_region, ioremap. This does not only lead to a lot of code
    duplication, but also a huge number of similar error strings and
    inconsistent error codes on failure. So, introduce a helper function
    which simplifies remapping a resource and make it hard to do something
    wrong and add documentation for it.

    Signed-off-by: Wolfram Sang
    Acked-by: Grant Likely
    Acked-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Wolfram Sang
     
  • While working on devres, I found those make navigating the code a tad
    easier.

    Signed-off-by: Wolfram Sang
    Acked-by: Grant Likely
    Signed-off-by: Greg Kroah-Hartman

    Wolfram Sang
     

26 Jul, 2011

1 commit

  • devres uses the pointer value as key after it's freed, which is safe but
    triggers spurious use-after-free warnings on some static analysis tools.
    Rearrange code to avoid such warnings.

    Signed-off-by: Maxin B. John
    Reviewed-by: Rolf Eike Beer
    Acked-by: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Maxin B John
     

12 Jul, 2010

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo