]> git.baikalelectronics.ru Git - kernel.git/commit
platform/x86: intel_pmc_core: do not create a static struct device
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Sep 2020 18:48:03 +0000 (20:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Oct 2020 13:47:09 +0000 (15:47 +0200)
commit7e2b0d983064bff5950793802b9b217d3d640155
tree5d991116b14e10f154a475e47f1afbd505fd5ded
parentbb9efa82c6b97d1a19a70b0ac04870022a5c9647
platform/x86: intel_pmc_core: do not create a static struct device

A struct device is a dynamic structure, with reference counting.
"Tricking" the kernel to make a dynamic structure static, by working
around the driver core release detection logic, is not nice.

Because of this, this code has been used as an example for others on
"how to do things", which is just about the worst thing possible to have
happen.

Fix this all up by making the platform device dynamic and providing a
real release function.

Fixes: 79cf38da6c44 ("platform/x86: intel_pmc_core: Attach using APCI HID "INT33A1"")
Cc: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Cc: Vishwanath Somayaji <vishwanath.somayaji@intel.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andy@infradead.org>
Reported-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Rajat Jain <rajatja@google.com>
Link: https://lore.kernel.org/r/20200923184803.192265-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/platform/x86/intel_pmc_core_pltdrv.c