1. 17 Dec, 2021 2 commits
    • Paul Cercueil's avatar
      PM: core: Redefine pm_ptr() macro · c06ef740
      Paul Cercueil authored
      The pm_ptr() macro was previously conditionally defined, according to
      the value of the CONFIG_PM option. This meant that the pointed structure
      was either referenced (if CONFIG_PM was set), or never referenced (if
      CONFIG_PM was not set), causing it to be detected as unused by the
      compiler.
      
      This worked fine, but required the __maybe_unused compiler attribute to
      be used to every symbol pointed to by a pointer wrapped with pm_ptr().
      
      We can do better. With this change, the pm_ptr() is now defined the
      same, independently of the value of CONFIG_PM. It now uses the (?:)
      ternary operator to conditionally resolve to its argument. Since the
      condition is known at compile time, the compiler will then choose to
      discard the unused symbols, which won't need to be tagged with
      __maybe_unused anymore.
      
      This pm_ptr() macro is usually used with pointers to dev_pm_ops
      structures created with SIMPLE_DEV_PM_OPS() or similar macros. These do
      use a __maybe_unused flag, which is now useless with this change, so it
      later can be removed. However in the meantime it causes no harm, and all
      the drivers still compile fine with the new pm_ptr() macro.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c06ef740
    • Paul Cercueil's avatar
      r8169: Avoid misuse of pm_ptr() macro · 5ef11c56
      Paul Cercueil authored
      The pm_ptr() macro should be used when the suspend and resume functions
      can be compiled independently of the CONFIG_PM Kconfig option.
      
      In the case of this driver, the suspend and resume functions are inside
      a section protected by a #ifdef CONFIG_PM guard. Therefore pm_ptr()
      should not be used.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5ef11c56
  2. 12 Dec, 2021 14 commits
  3. 11 Dec, 2021 24 commits