platform/x86: intel_pmc_ipc: Don't map non-used optional resources
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 9 Apr 2019 11:25:14 +0000 (14:25 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 6 May 2019 14:54:04 +0000 (17:54 +0300)
commitaf6c7e1ffcb6db6c1265295fa1b20fc27a0753f2
tree52efbc3de02810f82758727a4044733a98128981
parent9eac0d75f132608159eb649ceadfc4e53b2a1686
platform/x86: intel_pmc_ipc: Don't map non-used optional resources

The intel_pmc_ipc driver has a placeholder for all possible resources
that may have been provided by ACPI. Since there are few optional ones,
the driver still uses them and binds to wrong ranges in resource tree:

  # grep intel_punit_ipc /proc/iomem
  00000000-00000000 : intel_punit_ipc
    00000000-00000000 : intel_punit_ipc
      00000000-00000000 : intel_punit_ipc
        00000000-00000000 : intel_punit_ipc

This leads to issues with resource management during inserting and
removing modules, such as intel_pmc_ipc itself, which can't be inserted
anymore after first removal.

Count the actual resources provided and supply only them to the child device.

This is a real fix of the commit 8cc7fb4a6523

  ("intel_pmc_ipc: update acpi resource structure for Punit")

that also fixes a symptoms described in the commit 6cc8cbbc8868

  ("platform/x86: intel_punit_ipc: Fix resource ioremap warning")

that is going to be reverted afterwards.

Reported-by: Junxiao Chang <junxiao.chang@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Qipeng Zha <qipeng.zha@intel.com>
Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
drivers/platform/x86/intel_pmc_ipc.c